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 5bc118e4ff8..a40989597d1 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 @@ -686,7 +686,9 @@ export const editorCommands = { } referenceColumn.forEach((cell, rowIndex) => { const newCell = document.createElement('td'); - newCell.append(document.createElement('br')); + const p = document.createElement('p'); + p.append(document.createElement('br')); + newCell.append(p); cell[beforeOrAfter](newCell); if (rowIndex === 0) { newCell.style.width = cell.style.width; @@ -712,7 +714,9 @@ export const editorCommands = { const referenceRowWidths = [...cells].map(cell => cell.style.width || cell.clientWidth + 'px'); newRow.append(...Array.from(Array(cells.length)).map(() => { const td = document.createElement('td'); - td.append(document.createElement('br')); + const p = document.createElement('p'); + p.append(document.createElement('br')); + td.append(p); return td; })); referenceRow[beforeOrAfter](newRow); 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 2a2e90e06c3..c3c30f00b14 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 @@ -4784,9 +4784,9 @@ X[] '', stepFunction: async editor => editor.execCommand('addRow', 'before'), contentAfter: '' + - '' + - '' + - '' + + '' + + '' + + '' + '' + '' + '' + @@ -4814,9 +4814,9 @@ X[] '' + '' + '' + - '' + - '' + - '' + + '' + + '' + + '' + '' + '' + '' + @@ -4841,9 +4841,9 @@ X[] '' + '' + '' + - '' + - '' + - '' + + '' + + '' + + '' + '






abef






abef[]






', }); }); @@ -4866,9 +4866,9 @@ X[] 'ef[]' + '' + '' + - '
' + - '
' + - '
' + + '


' + + '


' + + '


' + '' + '' + 'ab' + @@ -4895,13 +4895,13 @@ X[] '', stepFunction: async editor => editor.execCommand('addColumn', 'before'), contentAfter: '' + - '' + + '' + '' + '' + '' + '' + '' + - '' + + '' + '' + '' + '' + @@ -4928,19 +4928,19 @@ X[] stepFunction: async editor => editor.execCommand('addColumn', 'before'), contentAfter: '


ab[]cdef


abcdef
' + '' + - '' + + '' + '' + '' + '' + '' + '' + - '' + + '' + '' + '' + '' + '' + '' + - '' + + '' + '' + '' + '
ab


cdef
ab


cd[]ef
ab


cdef
', @@ -4968,13 +4968,13 @@ X[] // size was slightly adjusted to // preserve table width in view on // fractional division results - '
' + + '


' + '' + '' + 'ab' + 'cd' + 'ef' + - '
' + + '


' + '', }); }); @@ -4999,19 +4999,19 @@ X[] contentAfter: '' + '' + '' + - '' + + '' + '' + '' + '' + '' + '' + - '' + + '' + '' + '' + '' + '' + '' + - '' + + '' + '' + '
abcd


ef
abcd[]


ef
abcd


ef
', }); @@ -5024,7 +5024,7 @@ X[] await testEditor(BasicEditor, { contentBefore: '
abcdef[]
', stepFunction: async editor => triggerEvent(editor.editable, 'keydown', { key: 'Tab'}), - contentAfter: '
abcdef
[]


', + contentAfter: '
abcdef
[


]



', }); }); });