From 20fd2e38c943c5397a49e654c1fb53da45e8ef1a Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 26 Mar 2020 15:49:35 +0000 Subject: [PATCH] [FIX] website: restore simple drop zones Commit https://github.com/odoo/odoo/commit/bb0cdec4594fab8c22265ed8af0c2d431a263b72#diff-e4ca107fe5c84ec39ba346fb90d1bdf6R76 added strange code affecting the whole editor when website_blog was installed. To stay consistent, commit https://github.com/odoo/odoo/commit/80f54f563a3917828c5f67dfe9c44d0f6b0c5324 moved it in standard website and marked it as to review. It is in fact the cause of a bug: *all* drop areas appeared with a big editor text "Drag and drop a building block here" because of this code. As a fix in stable, the problem was solved so that the code works as intended: adding an editor message on a normal .oe_structure makes it an .oe_structure.oe_empty automatically. Here in master, this code will simply be removed and it will be up to the devs to not make errors in their xml so that the editor messages appear. This commit in fact keeps the "removing spaces" feature and enables it for all oe_structure. Related to task-2210733 closes odoo/odoo#48463 X-original-commit: 5381e9d900b344e7d48a6b347c5fc551d433b15e Signed-off-by: Quentin Smetz (qsm) --- .../website/static/src/js/editor/wysiwyg_multizone.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/addons/website/static/src/js/editor/wysiwyg_multizone.js b/addons/website/static/src/js/editor/wysiwyg_multizone.js index c0c5bb6b87b..01162f16168 100644 --- a/addons/website/static/src/js/editor/wysiwyg_multizone.js +++ b/addons/website/static/src/js/editor/wysiwyg_multizone.js @@ -77,14 +77,13 @@ var WysiwygMultizone = Wysiwyg.extend({ }); }); - // TODO review why this is needed - _.each(this.$('.oe_structure[data-editor-message!="False"]'), el => { - var isBlank = !el.innerHTML.trim(); - if (isBlank) { + // Ensure :blank oe_structure elements are in fact empty as ':blank' + // does not really work with all browsers. + for (const el of this.$('.oe_structure')) { + if (!el.innerHTML.trim()) { el.innerHTML = ''; } - el.classList.toggle('oe_empty', isBlank); - }); + } return this._super.apply(this, arguments).then(() => { // Showing Mega Menu snippets if one dropdown is already opened