$(document).ready(function () {
$('.summernote').summernote({
codemirror: {
theme: 'monokai',
htmlMode: true
}
});
});
<textarea class="summernote"><p><br></p>
<p>Testing html </p>
<p><br> formatting<br></p></textarea>
当您单击代码 View 时,它不会正确格式化 html,而是会格式化 xml。如您所见,<br>
标签被解释为无效的 xml 标签,但是 htmlMode: true
已设置并且应该用于将内容解释为 html。
最佳答案
看来我需要设置:
codemirror: {
...
htmlMode: true,
lineNumbers: true,
mode: 'text/html'
}
尽管这些应该是默认值。
更新的 fiddle :https://jsfiddle.net/ungue/fzt257r6/41/
关于javascript - 当 htmlMode true 无法与 codemirror 正常工作时,Summernote html 代码 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28819889/