Skip to content

WYSIWYG: Table cell format handling clears more styles than expected #4964

Closed
@ssddanbrown

Description

@ssddanbrown

This is due to cell range handling added to help clear formatting:

// TinyMCE does not seem to do a great job on clearing styles in complex
// scenarios (like copied word content) when a range of table cells
// are selected. Here we watch for clear formatting events, so some manual
// cleanup can be performed.
const attrsToRemove = ['class', 'style', 'width', 'height'];
editor.on('FormatRemove', () => {
for (const cell of selectedCells) {
for (const attr of attrsToRemove) {
cell.removeAttribute(attr);
}
}
});

The FormatRemove event is much wider than just format clearing calls, This is also fired on un-toggle of formats (bold, italic etc..) and format changes (alignment changes etc...). This needs to be better scoped to only action upon format remove button presses (Might need custom button action).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions