From 84a445a8e0321333b082a2e9e8c3d4813496e7ce Mon Sep 17 00:00:00 2001 From: xO-Tx Date: Tue, 17 Jan 2023 11:09:31 +0000 Subject: [PATCH] [FIX] web_editor: prevent clicking on the page while saving To reproduce the issue: - Website page (e.g. "Contact us") > Edit mode > save. - Try to click on the page right after the save (and before the preview is blocked) > traceback. In this specific case, clicking in the page will activate the targeted snippet and initializes its "SnippetEditor" while destroying the options and cleaning the DOM, leading to wrong behaviors. The goal of this commit is to fix this issue by simply ignoring the click on the page during the save process. opw-3119347 closes odoo/odoo#111030 X-original-commit: 6bf3823c2996af4ec0534ff69471887ac43a8ddf Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.editor.js | 5 +++++ 1 file changed, 5 insertions(+) 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 1576c59e845..0d2131db7bd 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -3440,6 +3440,11 @@ var SnippetsMenu = Widget.extend({ * @private */ _onClick(ev) { + // Clicking in the page should be ignored on save + if (this.willDestroyEditors) { + return; + } + var srcElement = ev.target || (ev.originalEvent && (ev.originalEvent.target || ev.originalEvent.originalTarget)) || ev.srcElement; if (!srcElement || this.lastElement === srcElement) { return;