summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-10-29 17:01:00 +0000
committerqsm-odoo <qsm@odoo.com>2020-11-13 13:56:18 +0000
commitbdfddace29b16404c06a7ebfc0cc242463a0e768 (patch)
treec16b565a3fa6fa92c82f3df2531cbef00f1e6c9f /addons/web_editor/static
parent3ed3537abd416ebc35f8bc2ee65f209840c071bf (diff)
[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) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js13
1 files changed, 12 insertions, 1 deletions
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);
@@ -2490,6 +2490,17 @@ var SnippetsMenu = Widget.extend({
},
/**
* @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
* @param {Object} ev.data
* @param {function} ev.data.exec