Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ssddanbrown opened this issue Apr 21, 2024 · 0 comments
Closed

Comments

@ssddanbrown
Copy link
Member

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant