From f81f2a124c6e0922afc207519e5ae3490714ea57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20De=20Caluw=C3=A9?= Date: Wed, 29 Sep 2021 14:21:09 +0000 Subject: [PATCH] [IMP] website: prevent clicking while starting the editor When visiting a page with enable_editor set to true, the web editor will be automatically started. However, while the editor is loading, the end user can still click other buttons in the navbar. For example, some changes in the web editor require a save and reload of the current page being edited. After saving, the same page will be reloaded with enable_editor. This commit blocks any clicks while the editor is being loaded. task-2607755 closes odoo/odoo#78721 X-original-commit: 89bdfcd16828e1432900ea46118fd6ddadf96f2d Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/js/menu/edit.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/website/static/src/js/menu/edit.js b/addons/website/static/src/js/menu/edit.js index 28d37ccd0b5..e9c6af74dcc 100644 --- a/addons/website/static/src/js/menu/edit.js +++ b/addons/website/static/src/js/menu/edit.js @@ -69,7 +69,7 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ * * @override */ - start: function () { + start() { var def = this._super.apply(this, arguments); // If we auto start the editor, do not show a welcome message @@ -205,6 +205,13 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ if (this.editModeEnable) { return; } + + $.blockUI({overlayCSS: { + backgroundColor: '#000', + opacity: 0, + zIndex: 1050 + }, message: false}); + this.trigger_up('widgets_stop_request', { $target: this._targetForEdition(), }); @@ -228,6 +235,8 @@ var EditPageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({ $loader.remove(); } + $.unblockUI(); + return res; }, /**