[FIX] web_editor: prevent editor rollback of top menu

To reproduce the issue:

- Website > Add menu items to activate the "+" dropdown.
- Edit mode > The top menu disappears.

On `_activateContenteditable()`, The `initAutoMoreMenu` > `_adapt()`
mutations (changes to move the overflowing menu items to a "+" dropdown)
are recorded and rollbacked by the editor, leading to reset the top menu
to the step before removing the `.o_menu_loading` class.

Recording the `initAutoMoreMenu` mutations leads to some other issues:

On edit mode (without overflowing items):

- Website > Edit mode > The editor starts (before any updates) with an
extra "history step".
- Undo > The top menu disappears.

On edit mode (with "Mega Menu" items):

- Website > Edit mode > Edit text in a "Mega Menu" item > The top menu
disappears.

The goal of this commit is to fix this behaviour using the
`renderingClasses` filter (added in [1]) to prevent the `o_menu_loading`
class from being taken into account in the `filterMutationRecords()`.

[1]: The https://github.com/odoo/odoo/commit/1c25ddb42393b136cac2a0ee0b9b7280fd803e7d

opw-3146873

closes odoo/odoo#113016

X-original-commit: 96c9ebd26aabc3f99acf5d586746b05db7cf4953
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
xO-Tx
2023-02-17 22:02:38 +01:00
parent 2075dd0848
commit d1e5e4420a
@@ -219,7 +219,7 @@ const Wysiwyg = Widget.extend({
plugins: options.editorPlugins,
direction: options.direction || localization.direction || 'ltr',
collaborationClientAvatarUrl: `${browser.location.origin}/web/image?model=res.users&field=avatar_128&id=${this.getSession().uid}`,
renderingClasses: ['o_dirty', 'o_transform_removal', 'oe_edited_link'],
renderingClasses: ['o_dirty', 'o_transform_removal', 'oe_edited_link', 'o_menu_loading'],
dropImageAsAttachment: options.dropImageAsAttachment,
}, editorCollaborationOptions));