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 e757deee2ee..533c0a7c4a7 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 @@ -567,7 +567,7 @@ export const editorCommands = { font = []; } } else if ((node.nodeType === Node.TEXT_NODE && !isWhitespace(node)) - || node.nodeName === "BR" + || (node.nodeName === 'BR' && isEmptyBlock(node.parentNode)) || (node.nodeType === Node.ELEMENT_NODE && ['inline', 'inline-block'].includes(getComputedStyle(node).display) && !isWhitespace(node.textContent) && diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/color.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/color.test.js index aebd678e0af..50153b142c8 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/color.test.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/color.test.js @@ -61,4 +61,20 @@ describe('applyColor', () => { contentAfter: '
[
]
', }); }); + it('should not merge line on background color change', async () => { + await testEditor(BasicEditor, { + contentBefore: '[abcd
efghi]
[abcd
' +
+ 'efghi]
[abcd
efghi]
[abcd
' +
+ 'efghi]