diff --git a/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js b/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js index c4a4b4de663..dd4097b6d12 100644 --- a/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js +++ b/addons/web_editor/static/lib/odoo-editor/src/commands/commands.js @@ -336,7 +336,7 @@ export const editorCommands = { ) { setSelection(block, 0, block, nodeSize(block)); editor.historyPauseSteps(); - editor.document.execCommand('removeFormat'); + editor.execCommand('removeFormat'); editor.historyUnpauseSteps(); setTagName(block, tagName); } else { @@ -373,7 +373,13 @@ export const editorCommands = { italic: editor => editor.document.execCommand('italic'), underline: editor => editor.document.execCommand('underline'), strikeThrough: editor => editor.document.execCommand('strikeThrough'), - removeFormat: editor => editor.document.execCommand('removeFormat'), + removeFormat: editor => { + editor.document.execCommand('removeFormat'); + for (const node of getTraversedNodes(editor.editable)) { + // The only possible background image on text is the gradient. + closestElement(node).style.backgroundImage = ''; + } + }, // Align justifyLeft: editor => align(editor, 'left'), diff --git a/addons/web_editor/static/lib/odoo-editor/test/spec/editor.test.js b/addons/web_editor/static/lib/odoo-editor/test/spec/editor.test.js index 84bee154759..fe9efdebfb3 100644 --- a/addons/web_editor/static/lib/odoo-editor/test/spec/editor.test.js +++ b/addons/web_editor/static/lib/odoo-editor/test/spec/editor.test.js @@ -2805,6 +2805,13 @@ X[] contentAfter: '
[ab]