问题
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