Javascript TinyMCE正在删除html的某些部分

Javascript TinyMCE正在删除html的某些部分,javascript,tinymce,rich-text-editor,Javascript,Tinymce,Rich Text Editor,我希望能够插入空的div和span元素,像[something]这样的文本,但当我保存TinyMCE时,就会删除所有这些代码 是否有一个配置选项告诉TinyMCE返回我输入的确切文本 谢谢。是的,您需要将有效的元素配置选项更改为 // The valid_elements option defines which elements will remain in the edited text when the editor saves. valid_elements: "@[id

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

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


谢谢。

是的,您需要将有效的元素配置选项更改为

    // 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”元素在前面没有负数