From c35cc4296a42a67c59994a31925eedd3a28353da Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 22 Aug 2018 13:38:17 +0200 Subject: [PATCH] [REF] web_editor: review some dropzone code - Remove useless code - Make searching for the nearest dropzone more efficient --- addons/web_editor/static/src/js/editor/snippets.editor.js | 8 ++++---- addons/web_editor/static/src/scss/web_editor.ui.scss | 2 -- 2 files changed, 4 insertions(+), 6 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 87b8f0ced0b..ffade19c731 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1239,10 +1239,10 @@ var SnippetsMenu = Widget.extend({ stop: function (ev, ui) { $toInsert.removeClass('oe_snippet_body'); - 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); + if (!dropped && ui.position.top > 3 && ui.position.left + 50 > self.$el.outerWidth()) { + var $el = $.nearest({x: ui.position.left, y: ui.position.top}, '.oe_drop_zone').first(); + if ($el.length) { + $el.after($toInsert); dropped = true; } } diff --git a/addons/web_editor/static/src/scss/web_editor.ui.scss b/addons/web_editor/static/src/scss/web_editor.ui.scss index d2fefe9f23a..c6204c6bab3 100644 --- a/addons/web_editor/static/src/scss/web_editor.ui.scss +++ b/addons/web_editor/static/src/scss/web_editor.ui.scss @@ -270,8 +270,6 @@ html[lang] > body.editor_enable [data-oe-translation-state] { height: $o-we-dropzone-size; margin: (-$o-we-dropzone-size/2) 0; - transition: margin 400ms linear 0s; - &:after { content: ""; display: block;