[FIX] web_editor: properly apply/unapply underline and strikeThrough
Underline and strikeThrough styles are special beasts in that they both are applied to the `text-decoration-line` property. Unlike `font-weight` or `color`, They behave like a border: setting `text-decoration-line: none` to an element won't undo the value of the parent and therefore the text will still show the decoration applied to its parent. Similarly, nested decorations will apply over each other: a text node whose parent has an underline decoration and whose grandparent has a line-through decoration will be both underlined _and_ struck through. Consequently, we can't treat these styles the same way we treat bold, italic and colors: 1. To undo the style, we have to split the text from its styled ancestor 2. To apply eg underline to a struck through text, we have to insert a new span. task-2778416 X-original-commit: 93102a7dcb3e2c1a5803ab99f2f924b0b24e44c2 Part-of: odoo/odoo#86930
Showing
- addons/web_editor/static/lib/odoo-editor/src/commands/commands.js 49 additions, 11 deletions...eb_editor/static/lib/odoo-editor/src/commands/commands.js
- addons/web_editor/static/lib/odoo-editor/src/utils/sanitize.js 5 additions, 2 deletions...s/web_editor/static/lib/odoo-editor/src/utils/sanitize.js
- addons/web_editor/static/lib/odoo-editor/src/utils/utils.js 18 additions, 2 deletionsaddons/web_editor/static/lib/odoo-editor/src/utils/utils.js
- addons/web_editor/static/lib/odoo-editor/test/spec/format.test.js 228 additions, 38 deletions...eb_editor/static/lib/odoo-editor/test/spec/format.test.js
Loading
Please register or sign in to comment