【问题标题】:TinyMCE is removing some part of htmlTinyMCE 正在删除 html 的某些部分
【发布时间】:2012-01-25 09:21:36
【问题描述】:

我希望能够插入空的 div 和 span 元素,像 [something] 这样的文本,但是当我保存 TinyMCE 时会删除所有这些代码。

是否有一个配置选项告诉 TinyMCE 将我输入的确切文本返回给我?

谢谢。

【问题讨论】:

    标签: javascript tinymce rich-text-editor


    【解决方案1】:

    是的,您需要将您的 valid_elements 配置选项更改为类似

        // The valid_elements option defines which elements will remain in the edited text when the editor saves.
        valid_elements: "@[id|class|title|style|onmouseover]," +
        "a[name|href|target|title|alt]," +
        "p,blockquote,-ol,-ul,-li,br,img[src|height|width],-sub,-sup,-b,-i,-u," +
        "span[data-mce-type],hr",
    

    重要的是,'P' 和 'span' 元素前面没有减号。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-18
      • 1970-01-01
      • 1970-01-01
      • 2013-08-10
      相关资源
      最近更新 更多