【问题标题】:Summernote html code view when htmlMode true is not working fine with codemirror当 htmlMode true 无法与 codemirror 一起使用时,Summernote html 代码视图
【发布时间】:2015-05-03 09:37:22
【问题描述】:

$(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>

当您单击代码视图时,它不会正确格式化 html,而是使用 xml。如您所见,&lt;br&gt; 标记被解释为无效的 xml 标记,但是 htmlMode: true 已设置并且应该用于将内容解释为 html。

【问题讨论】:

  • 请在问题中包含您遇到问题的代码

标签: javascript jquery html codemirror summernote


【解决方案1】:

看来我需要设置:

codemirror: {
      ...
      htmlMode: true,
      lineNumbers: true,
      mode: 'text/html'
    }

尽管这些应该是默认值。

更新小提琴:https://jsfiddle.net/ungue/fzt257r6/41/

【讨论】:

    猜你喜欢
    • 2015-04-20
    • 2015-08-21
    • 2019-02-24
    • 1970-01-01
    • 2018-10-06
    • 1970-01-01
    • 2021-12-05
    • 2017-01-28
    • 1970-01-01
    相关资源
    最近更新 更多