TinyMCE 4 disable cleanup html

笑着哭i 提交于 2019-12-10 12:56:25

问题


How can I disable the automatic cleaning of HTML code in TinyMCE 4.x When I copy text from WORD, TinyMCE removes styles


回答1:


This might not fix all your problem but this allowed me to be able to use all html tags and attributes, so it might be a step in right direction.

tinyMCE.init({
    // ...
    valid_elements : '*[*]',
});

Edit :

This worked better for me:

tinyMCE.init({
    // ...
    extended_valid_elements : '*[*]',
});



回答2:


tinyMCE.init({
    // ...
    cleanup : false,
    verify_html : false
});



回答3:


You will need to oppose this problem differtly because tinymce will cleanup the content no matter what.

Have a look at the tinymce config parameter paste_preprocess.

Using this param you can define a function in which you are able to modify the content to be inserted as you need to. This can be helpfull for debugging purposes too.

The other thing is you will need to define styles as valid using your valid_elements setting.



来源:https://stackoverflow.com/questions/20364133/tinymce-4-disable-cleanup-html

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