WYSIWYG Adding Inline Styles to Tables
Request Type:
Bug Fix
Issue/Request:
When creating tables in WYSIWYGs, it’s possible to insert inline styles to tables (especially inadvertantly) that break the table, including fixed width, min width, etc. When a style is done inadvertantly, it can be difficult or impossible to reverse without editing the HTML in plaintext.
Text formats for tables allow all attributes to be inserted. (e.g. table[*], td[*]). Would it be feasible to change text formats / add an additional format where style attributes cannot be added to table elements?
I created a new text format, which I called “Table Friendly Filtered HTML”. It’s purpose is to prevent the WYSIWYG to adding inline styles to tables.
It’s essentially a clone of the “Filtered HTML” text format, but with the following definitions for allowed table fields (instead of table[*], etc):
table[border|accesskey|class|content editable|dir|hidden|id|lang|spellcheck|tabindex|title|translate],
I’ll escalate this for verification and implementation.
It may be worth considering disallowing inline styles for all wysiwyg items, not just this one. That would require a bit of a different approach. I’m happy to keep poking around with it.
I’ve updated the table styling to strip out any inline styles, and to permit the class “table-fix” to be added to elements. It’s new name is “No Styles HTML”.