TinyMCE is removing some part of html

只谈情不闲聊 提交于 2020-01-04 02:06:28

问题


I want to be able to insert empty div and span elements, text like [something], but when I save TinyMCE is removing all this code.

Is there a config option that tells TinyMCE to return me the exact text I've entered?

Thanks.


回答1:


Yes, you need to change your valid_elements config option to somethin like

    // 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",

Iportant here is that the 'P' and 'span' elements does not have a minus standing right before.



来源:https://stackoverflow.com/questions/9000237/tinymce-is-removing-some-part-of-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!