diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index 612b249f67c..2a8402284d9 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -1713,7 +1713,7 @@ export function isEmptyBlock(blockEl) { for (const node of nodes) { // There is no text and no double BR, the only thing that could make // this visible is a "visible empty" node like an image. - if (node.nodeName != 'BR' && isSelfClosingElement(node)) { + if (node.nodeName != 'BR' && (isSelfClosingElement(node) || isFontAwesome(node))) { return false; } } diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/insert.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/insert.test.js index e6438d5ac1a..97d134b90ad 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/insert.test.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/insert.test.js @@ -92,6 +92,15 @@ describe('insert HTML', () => { contentAfter: '
abcdef[]', }); }); + it('should keep an "empty" block which contains fontawesome nodes when inserting multiple nodes', async () => { + await testEditor(BasicEditor, { + contentBefore: '
ghi
content[]
', + stepFunction: async editor => { + await editor.execCommand('insert', parseHTML('unwrapped
culprit
after
')); + }, + contentAfter: 'contentunwrapped
culprit
after[]
', + }); + }); it('should not unwrap single node if the selection anchorNode is the editable', async () => { await testEditor(BasicEditor, { contentBefore: 'content
[]',