From bdfddace29b16404c06a7ebfc0cc242463a0e768 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 29 Oct 2020 17:01:00 +0000 Subject: [FIX] web_editor, *: ease understanding of snippet drag, not click *: web, website Make the empty oe_structure messages "wizz" when the user clicks on a snippet to drag instead of dragging it. Part of https://github.com/odoo/odoo/pull/60837 Related to task-2363616 closes odoo/odoo#60837 Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.editor.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'addons/web_editor/static/src/js') 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 2f69ca64685..5e25ecd32a7 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -870,6 +870,7 @@ var SnippetsMenu = Widget.extend({ id: 'oe_snippets', cacheSnippetTemplate: {}, events: { + 'click .oe_snippet': '_onSnippetClick', 'click .o_install_btn': '_onInstallBtnClick', 'click .o_we_add_snippet_btn': '_onBlocksTabClick', 'click .o_we_invisible_entry': '_onInvisibleEntryClick', @@ -1930,7 +1931,6 @@ var SnippetsMenu = Widget.extend({ const smoothScrollOptions = this._getScrollOptions({ jQueryDraggableOptions: { - distance: 0, handle: '.oe_snippet_thumbnail:not(.o_we_already_dragging)', helper: function () { const dragSnip = this.cloneNode(true); @@ -2488,6 +2488,17 @@ var SnippetsMenu = Widget.extend({ this.trigger_up('request_save', data); }, true); }, + /** + * @private + */ + _onSnippetClick() { + const $els = this.getEditableArea().find('.oe_structure.oe_empty').addBack('.oe_structure.oe_empty'); + for (const el of $els) { + if (!el.children.length) { + $(el).odooBounce('o_we_snippet_area_animation'); + } + } + }, /** * @private * @param {OdooEvent} ev -- cgit v1.2.3