[FIX] web_editor: unformat only if full selection is bold
Take `<p>a<b>bcde</b>f` and select the whole paragraph. If you click the "bold" button, you would expect the whole paragraph to become bold. Only if you only select "bcde" do you expect to unbold it. This is the behavior of other editors. Odoo-editor so far was unbolding as long as a part of the selection was bold. The same applies to other formats. Currently the format buttons are active when the closest start container is that format but it should be active when pressing it would undo the format, ie when the whole selection is that format. This harmonizes it with the browser defaults. task-2754127 X-original-commit: 69c5db26f81ace1a9a032b2ef7f488c997be00ad Part-of: odoo/odoo#86930
Showing
- addons/web_editor/static/lib/odoo-editor/src/OdooEditor.js 7 additions, 12 deletionsaddons/web_editor/static/lib/odoo-editor/src/OdooEditor.js
- addons/web_editor/static/lib/odoo-editor/src/commands/commands.js 32 additions, 13 deletions...eb_editor/static/lib/odoo-editor/src/commands/commands.js
- addons/web_editor/static/lib/odoo-editor/src/utils/utils.js 24 additions, 0 deletionsaddons/web_editor/static/lib/odoo-editor/src/utils/utils.js
- addons/web_editor/static/lib/odoo-editor/test/spec/format.test.js 93 additions, 9 deletions...eb_editor/static/lib/odoo-editor/test/spec/format.test.js
Loading
Please register or sign in to comment