From dc1ebbafde72eb19d1569ddaca57c4b65acde7cb Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 27 Oct 2020 14:08:33 +0000 Subject: [PATCH] [FIX] web_editor: encourage to use snippets in empty oe_structure (wizz) Make the draggable snippets "wizz" when the user clicks on an empty oe_structure. Part of https://github.com/odoo/odoo/pull/60837 Related to task-2363616 X-original-commit: 3ed3537abd416ebc35f8bc2ee65f209840c071bf --- addons/web_editor/static/src/js/editor/snippets.editor.js | 7 +++++++ 1 file changed, 7 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 1174f58cef5..46ef56cdc61 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2652,6 +2652,13 @@ var SnippetsMenu = Widget.extend({ if ($snippet.closest(this._notActivableElementsSelector).length) { return; } + const $oeStructure = $snippet.closest('.oe_structure'); + if ($oeStructure.length && !$oeStructure.children().length && this.$snippets) { + // If empty oe_structure, encourage using snippets in there by + // making them "wizz" in the panel. + this.$snippets.odooBounce(); + return; + } this._setLastSnippet($snippet); this._activateSnippet($snippet); },