diff options
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 57721dd1e87..c759cd84ece 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1477,18 +1477,20 @@ var SnippetsMenu = Widget.extend({ if ($snippet && !$snippet.is(':visible')) { return; } + // Take the first parent of the provided DOM (or itself) which + // should have an associated snippet editor. + // It is important to do that before the mutex exec call to compute it + // before potential ancestor removal. + if ($snippet && $snippet.length) { + $snippet = globalSelector.closest($snippet); + } const exec = previewMode ? action => this._mutex.exec(action) : action => this._execWithLoadingEffect(action, false); return exec(() => { return new Promise(resolve => { - // Take the first parent of the provided DOM (or itself) which - // should have an associated snippet editor and create + enable it. if ($snippet && $snippet.length) { - $snippet = globalSelector.closest($snippet); - if ($snippet.length) { - return this._createSnippetEditor($snippet).then(resolve); - } + return this._createSnippetEditor($snippet).then(resolve); } resolve(null); }).then(editorToEnable => { |
