summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/snippets.editor.js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2016-07-19 11:35:14 +0200
committerqsm-odoo <qsm@odoo.com>2016-07-19 11:55:02 +0200
commite01cb8f7176f8449f8080d9c5a667365b94e5a45 (patch)
treef154613add57f7a3a63662cb9bff89917f7d4027 /addons/web_editor/static/src/js/snippets.editor.js
parent19b4902c71bfdae1fa689dabd83c8ff3880142bc (diff)
[FIX] web_editor: prevent adding snippets by mistake
* Start dragging after the mouse move of some distance * Cancel drop if the user drops a snippet in the snippet bar
Diffstat (limited to 'addons/web_editor/static/src/js/snippets.editor.js')
-rw-r--r--addons/web_editor/static/src/js/snippets.editor.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js
index 082a3b6204d..19f60a25741 100644
--- a/addons/web_editor/static/src/js/snippets.editor.js
+++ b/addons/web_editor/static/src/js/snippets.editor.js
@@ -500,6 +500,7 @@ data.Class = Widget.extend({
appendTo: 'body',
cursor: "move",
handle: ".oe_snippet_thumbnail",
+ distance: 30,
cursorAt: {
'left': left,
'top': top
@@ -553,7 +554,7 @@ data.Class = Widget.extend({
stop: function (ev, ui) {
$toInsert.removeClass('oe_snippet_body');
- if (! dropped && self.$editable.find('.oe_drop_zone') && ui.position.top > 3) {
+ if (! dropped && self.$editable.find('.oe_drop_zone') && ui.position.top > 3 && ui.position.left + 50 > self.$el.outerWidth()) {
var el = self.$editable.find('.oe_drop_zone').nearest({x: ui.position.left, y: ui.position.top}).first();
if (el.length) {
el.after($toInsert);