[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
This commit is contained in:
qsm-odoo
2020-11-13 15:30:42 +00:00
parent 64f1017491
commit dc1ebbafde
@@ -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);
},