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