[FIX] web_editor, website: update invisible elements panel on undo

Before this commit, after:
- Drop a popup,
- Click on the undo button,
=> The invisible elements panel was still displayed, with the popup
entry.

To fix that, the panel visibility is updated on the
'historyUndo'/'historyRedo' events alongside refreshing the snippets
editors.

task-2687506

closes odoo/odoo#98807

X-original-commit: 76704f47db46ac7e71a894f620d8061a3eb594a7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Younn Olivier
2022-08-25 04:21:07 +02:00
parent 34c88157a6
commit a0a184fdf6
2 changed files with 26 additions and 0 deletions
@@ -1440,6 +1440,8 @@ var SnippetsMenu = Widget.extend({
const target = selection.getRangeAt(0).startContainer.parentElement;
this._activateSnippet($(target));
}
this._updateInvisibleDOM();
}, 500);
this.options.wysiwyg.odooEditor.addEventListener('historyUndo', refreshSnippetEditors);
this.options.wysiwyg.odooEditor.addEventListener('historyRedo', refreshSnippetEditors);
@@ -28,4 +28,28 @@ wTourUtils.registerEditionTour('snippet_popup_add_remove', {
in_modal: false,
trigger: 'iframe #wrap.o_editable:not(:has([data-snippet="s_popup"]))',
run: () => null,
},
// Test that undoing dropping the snippet removes the invisible elements panel.
{
content: "Drop the snippet again.",
trigger: '#oe_snippets .oe_snippet:has(> [data-snippet="s_popup"]) .oe_snippet_thumbnail',
run: "drag_and_drop iframe #wrap",
}, {
content: "The popup should be in the invisible elements panel.",
in_modal: false,
trigger: '.o_we_invisible_el_panel .o_we_invisible_entry',
run: () => null, // It's a check.
}, {
content: "Click on the 'undo' button.",
in_modal: false,
trigger: '#oe_snippets button[data-action="undo"]',
}, {
content: "Check that the s_popup was removed.",
in_modal: false,
trigger: 'iframe #wrap.o_editable:not(:has([data-snippet="s_popup"]))',
run: () => null, // It's a check.
}, {
content: "The invisible elements panel should also be removed.",
trigger: '#oe_snippets:has(.o_we_invisible_el_panel.d-none)',
run: () => null, // It's a check.
}]);