Files
odoo_source/addons/web_editor
Stanislas Gueniffey c46ee8f4c0 [IMP] web_editor: create links with (Shift+) Enter
Typing a valid URL and pressing Space creates a clickable link with that
URL. Users expect the same to happen when pressing Enter instead (with
or without holding Shift), but that was not the case previously.

This commit enables link creation with both Enter and Shift+Enter. It
factorises the code that creates the link into a function
`_handleAutomaticLinkInsertion`.

While this feature is part of the `keydown` event for Space and
Shift+Enter, it is part of the later `input` event for Enter (without
Shift). This is due to a required call to historyRollback(), which would
undo the just-created link, forcing its creation to be delayed.

Two tests have been added for these new use cases. For the Space use
case, an existing test has been adapted to account for the change of
handling (from `input` to `keydown` event). That test is also simplified
to avoid modifying the DOM content (which was meant to replicate the
exact behavior of the browser for regular users, deemed not necessary
for tests).

Task-3094666

closes odoo/odoo#122001

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2023-06-02 14:29:57 +02:00
..
…
2023-05-12 22:59:22 +02:00
…