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 e71a8cb1a6b52c303b804034623e4c1f49de3c45..b75c9075f3de45ba257165fd2a478a0fa7ef615a 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 @@ -415,11 +415,21 @@ export const editorCommands = { } }, removeFormat: editor => { + const textAlignStyles = new Map(); + getTraversedNodes(editor.editable).forEach((element) => { + const block = closestBlock(element); + if (block.style.textAlign) { + textAlignStyles.set(block, block.style.textAlign); + } + }); 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 = ''; } + textAlignStyles.forEach((textAlign, block) => { + block.style.setProperty('text-align', textAlign); + }); }, // Align