【问题标题】:how can i customize the way tinymce fixes broken html? particularly lists?如何自定义 tinymce 修复损坏的 html 的方式?特别列出?
【发布时间】:2013-01-25 01:56:53
【问题描述】:

我有这样创建 html 的最终用户:

<ol>
      <li>some text</li>
      <li>some more text</li>
      <div>a div in the wrong spot</div>
      <li>the last line of text</li>
</ol>

Tinymce 把它变成了这样的东西:

<ol>
      <li>some text</li>
      <li>some more text</li>
</ol>
      <div>a div in the wrong spot</div>
<ol>
      <li>the last line of text</li>
</ol>

这是一个问题,因为有时它会重新编号,有时它不会重新编号(start="3")但格式总是混乱。

如何强制 tinymce 将 &lt;div&gt; 附加到之前的 &lt;li&gt; 中?

我尝试将 fix_list_elements 设置为 false,但这没有帮助。

【问题讨论】:

    标签: html filter tinymce html-lists


    【解决方案1】:

    仍然没有找到确切的答案,但有足够的解决方法。使用valid_children TinyMCE 选项。

    {
      valid_children : "+ul[div],+ol[div]"
    }
    

    这可以让无效的 HTML 保持不固定状态。

    【讨论】:

      猜你喜欢
      • 2013-09-10
      • 1970-01-01
      • 2011-06-08
      • 2017-11-29
      • 2021-10-26
      • 2011-09-04
      • 2011-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多