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 f22c431d0f7a372676a8efbd532d98357e6fe7e0..8de5147234b8c1e75a496c54b357e15cca1b32be 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 @@ -386,11 +386,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