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 189c2580473..c0d6b60bfd1 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 @@ -1048,7 +1048,7 @@ export const formatSelection = (editor, formatName, {applyStyle, formatProps} = tag.remove(); formatSpec.addStyle(getOrCreateSpan(selectedTextNode, inlineAncestors), formatProps); } - } else { + } else if (formatName !== 'fontSize' || formatProps.size !== undefined) { formatSpec.addStyle(getOrCreateSpan(selectedTextNode, inlineAncestors), formatProps); } } diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/format.test.js b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/format.test.js index 30646c2c185..aca00d942f0 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/format.test.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/test/spec/format.test.js @@ -745,6 +745,20 @@ describe('Format', () => { contentAfter: '

b[c]d

', }); }); + it('should change the font-size to default', async () => { + await testEditor(BasicEditor, { + contentBefore: '

[ab]

', + stepFunction: setFontSize(), + contentAfter: '

[ab]

', + }); + }); + it('should change the font-size to default removing the existing style with no empty span at the end', async () => { + await testEditor(BasicEditor, { + contentBefore: '

[abc]

', + stepFunction: setFontSize(), + contentAfter: '

[abc]

', + }); + }); }); it('should add style to a span parent of an inline', async () => { diff --git a/addons/web_editor/static/src/xml/editor.xml b/addons/web_editor/static/src/xml/editor.xml index c877510ccd8..ec60ab859f8 100644 --- a/addons/web_editor/static/src/xml/editor.xml +++ b/addons/web_editor/static/src/xml/editor.xml @@ -84,7 +84,7 @@