How to disable pasting inline styles on CKEditor? -
how disable contents styles when pasting ckeditor?
overview, i'm trying fix width styles on dompdf, inline styles pasted ckeditor messing styles i've set in dompdf.
i've applied posted here https://docs.ckeditor.com/#!/guide/dev_disallowed_content.
and far, here's of tried ckeditor.config.disallowedcontent = "table(width)", ckeditor.config.disallowedcontent = "table[style]"
but when copy , paste word docs or customized html strings, styles or width still pasted. tips? thanks!
first of if want remove width style table, need use: ckeditor.config.disallowedcontent = 'table{width}';.
the rule ckeditor.config.disallowedcontent = "table(width)" remove width class table , ckeditor.config.disallowedcontent = "table[style]" not because styles defined in {} , not in [].
read more format of allowed content rules here: https://docs.ckeditor.com/#!/guide/dev_allowed_content_rules
but when copy , paste word docs or customized html strings, styles or width still pasted.
please open full preset editor sample , try bolding text or using inline styles styles dropdown. see tags strong, code, big or span etc. being used. in order disallow them acf rule need example:
var editor = ckeditor.replace( 'editor1', { disallowedcontent : 'span;code;strong;big' }); please note above rule disables span, strong, code , big tags in ckeditor. if still wish use these tags in editor filter content during pasting, should use paste events , regex change incoming html:
Comments
Post a Comment