[FIX] web_editor: re-encourage to use snippets in empty oe_structure

This commit re-applies the commit that was merged at [1] but whose
code was lost during Jabberwock revert at [2].

Make the draggable snippets "wizz" when the user clicks on an empty
oe_structure.

[1]: https://github.com/odoo/odoo/commit/3ed3537abd416ebc35f8bc2ee65f209840c071bf
[2]: https://github.com/odoo/odoo/commit/e5572c317a7775a58675ed73efc89b5c9f6c0c39

Related to task-2363616

closes odoo/odoo#82046

X-original-commit: 668539aa17f061c8851099863e4d5fb7b11b59e8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
qsm-odoo
2021-12-30 11:16:11 +00:00
parent 116afad9fa
commit 29e5516e2a
@@ -1300,6 +1300,13 @@ var SnippetsMenu = Widget.extend({
if ($target.closest(this._notActivableElementsSelector).length) {
return;
}
const $oeStructure = $target.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._activateSnippet($target);
};