[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) <qsm@odoo.com>
This commit is contained in:
xO-Tx
2023-01-26 18:51:26 +01:00
committed by qsm-odoo
parent a62d2c694f
commit 84a445a8e0
@@ -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;