[FIX] web_editor: close open invisible elements before deleting it

Before this commit, open invisible elements were not closed before
being deleted. This created issues like the 'modal-open' class wich
was not removed from the body when removing a modal.

Part of https://github.com/odoo/odoo/pull/61998
task-2312878

X-original-commit: a67f7df31a9e5a5550d54d52ae506299f4a62581
This commit is contained in:
Benjamin Vray
2021-01-27 17:48:26 +00:00
committed by qsm-odoo
parent 156cd55c4d
commit 12be071794
@@ -297,6 +297,8 @@ var SnippetEditor = Widget.extend({
removeSnippet: async function () {
this.toggleOverlay(false);
this.toggleOptions(false);
// If it is an invisible element, we must close it before deleting it (e.g. modal)
await this.toggleTargetVisibility(!this.$target.hasClass('o_snippet_invisible'));
await new Promise(resolve => {
this.trigger_up('call_for_each_child_snippet', {