[FIX] web_editor: clear format not working properly
Before this commit: The text moves back to the left side on remove format even if the direction rtl is applied. After this commit: The text will not move to the left side on remove format if the direction rtl is applied. task-3482193 closes odoo/odoo#136849 X-original-commit: ff955e2cf74189a7cd4b175e8edfe5cfc8f31821 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -389,11 +389,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
|
||||
|
||||
Reference in New Issue
Block a user