diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index 5d320a827b4..fd357e061b9 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -2202,6 +2202,12 @@ const priorityRestoreStateRules = [ { direction: DIRECTIONS.LEFT, cType1: CTGROUPS.INLINE, cType2: CTGROUPS.BR }, { spaceVisibility: true }, ], + [ + // Replace a space by when it was content before and now it is + // a BR (removal of last character before a BR for example). + { direction: DIRECTIONS.RIGHT, cType1: CTGROUPS.CONTENT, cType2: CTGROUPS.BR }, + { spaceVisibility: true }, + ], [ // Replace a space by when it was visible thanks to a BR which // is now gone. 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 f1d08103229..6a847ddc980 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 @@ -3127,18 +3127,15 @@ X[] await testEditor(BasicEditor, { contentBefore: '
ab []cd
', stepFunction: insertLineBreak, - // The space is converted to a non-breaking - // space so it is visible (because it's before a - //ab
[]cd
ab
[]cd
ab
[]cd
ab[] cd
', stepFunction: insertLineBreak, - // The space is converted to a non-breaking - // space so it is visible (because it's after a - //ab
[] cd
abc []def
', stepFunction: insertLineBreak, - // JW cAfter: 'abc
[]def
abc
[]def
abc
[]def
abc[] def
', stepFunction: insertLineBreak, - // The space is converted to a non-breaking - // space so it is visible (because it's before a - //abc
[] def
abc
[] def
abc []def
', stepFunction: insertLineBreak, - // JW cAfter: 'abc []
def
abc
[]def
abc
[]def
ab []cd
', stepFunction: insertLineBreak, - // The space is converted to a non-breaking - // space so it is visible. - // JW cAfter: 'ab
[]cd
ab
[]cd
ab
[]cd
ab[] cd
',