diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js index 3e750c6d194..17e5574eedb 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/commands/commands.js @@ -642,7 +642,9 @@ export const editorCommands = { ['inline', 'inline-block'].includes(getComputedStyle(node).display) && !isWhitespace(node.textContent) && !node.classList.contains('btn') && - !node.querySelector('font'))) { + !node.querySelector('font')) && + node.nodeName !== 'A' && + !(node.nodeName === 'SPAN' && node.style['fontSize'])) { // Node is a visible text or inline node without font nor a button: // wrap it in a . const previous = node.previousSibling; diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js index 3f26718ddb7..d2f0c72898b 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/editor.test.js @@ -6709,6 +6709,96 @@ X[] contentAfter: '

a[bcd]e

', }); }); + it('should apply background color to a list of 3 items with font size', async () => { + await testEditor(BasicEditor, { + contentBefore: '', + stepFunction: editor => editor.execCommand('applyColor', 'rgb(255, 0, 0)', 'backgroundColor'), + contentAfter: '', + }); + }); + it('should apply background color to a list of 3 links', async () => { + await testEditor(BasicEditor, { + contentBefore: '', + stepFunction: editor => editor.execCommand('applyColor', 'rgb(255, 0, 0)', 'backgroundColor'), + contentAfter: '', + }); + }); it('should distribute color to texts and to button separately', async () => { await testEditor(BasicEditor, { contentBefore: '

a[bcd]e

',