[FIX] web_editor: changing header style keep its text alignment

Before this commit:

changing header style, changes the alignment of the selection

After this commit:

Now after applying header on selection it doesnot changes its alignment.

Task-2641462

closes odoo/odoo#99358

X-original-commit: da8d2669b03e1016dc05f031a2a7ac840541962e
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
shsa-odoo
2022-09-01 09:23:20 +02:00
committed by Hiral Bhavsar
parent 3160c7c0ac
commit 8c8d283286
@@ -586,7 +586,12 @@ export const editorCommands = {
) {
setSelection(block, 0, block, nodeSize(block));
editor.historyPauseSteps();
// Keep the alignment and remove rest of the applied styles.
const textAlign = block.style.textAlign;
editor.execCommand('removeFormat');
if (textAlign) {
block.style.textAlign = textAlign;
}
editor.historyUnpauseSteps();
const inLI = block.closest('li');
if (inLI && tagName === "P") {