Files
odoo_source/addons/web_editor
Sébastien Geelen (sge) b160eabafd [FIX] web_editor: keep cursor in empty inline tag
Ensure the user can keep typing inside a newly emptied inline tag:

* Add Zero-width Spaces (ZWS) in empty html tag

> We add zero-width spaces in elements in certain cases where they would
> not be correctly displayed by the browser if they were truly empty.
> This also ensure the user cursor can stay in an empty elements,
> and thus we keep the ability to add content in those elements.
>
> See the `fillEmpty` utils function.

* Remove lingering zero-width spaces

> However, we never remove those zero-width spaces when they are not
> useful anymore. In particular, keeping those invisible characters in the
> content prevents the ecommerce from saving the new price of a product if
> the previous price was previously completely emptied during edition.
> This commit fixes that.
>
> The issue didn't happen with the previous editor because they were
> using non-breaking space instead, which is removed by the text_content
> method of lxml. However, non-breaking space were visible during edition,
> which was weird on its own.
>
> Some changes had to be made to the deleteForward and backward commands,
> to ensure the new behaviors.
> Author : @dmo-odoo

* Adapt the deleteForward and backward commands

> To ensure the added ZWS do not break the Deletes behaviors,
> we need to adapt the `deleteForward` and `deleteBackward` commands.

Co-authored-by David Monjoie <dmo@odoo.com>

task-2622455

closes odoo/odoo#84891

X-original-commit: 4360643a446271d4ff1898d67a5b5287722a0820
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-18 14:29:30 +00:00
..
…