First of all if you want to remove the width
style from the table, you need to use:
CKEDITOR.config.disallowedContent = 'table{width}';
.
The rule CKEDITOR.config.disallowedContent = "table(width)"
will remove the width
class from the table and CKEDITOR.config.disallowedContent = "table[style]"
will not do anything because styles are defined in {}
and not in []
.
Read more about the format of Allowed Content Rules here: https://docs.ckeditor.com/#!/guide/dev_allowed_content_rules
But when I copy and paste from word docs or customized html strings,
styles or width would still be pasted.
Please open the Full preset editor sample and try bolding the text or using some inline styles from the Styles dropdown. You will see tags like strong
, code
, big
or span
etc. are being used. In order to disallow them your ACF rule would need to look like so for example:
var editor = CKEDITOR.replace( 'editor1', {
disallowedContent : 'span;code;strong;big'
});
Please note that above rule disables span
, strong
, code
and big
tags completely in CKEditor. If you still wish to use these tags in the editor but filter content only during pasting, you should use paste events and regex to change the incoming HTML: