summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorBenjamin Vray <bvr@odoo.com>2020-11-03 10:50:23 +0000
committerBenjamin Vray <bvr@odoo.com>2020-11-12 08:34:43 +0000
commit55ff2d971b672dec5f103215be39101c88856b6c (patch)
tree15a590b19a3a6deaec92da4b1117a6d2b18946b2 /addons/web_editor/static/src/js
parent3e026392cf90373103f1278d8ba1930b4afb60af (diff)
[FIX] web_editor: fix drag and drop a snippet
This commit fix the following issues: - When you move a snippet using the drag and drop button, the dropzones were not hidden during the preview of the snippet. - The out event of the droppable widget was not triggered after scrolling the page with the autoscroll. This was because we were using the d-none class on the drop zones. What was causing issues in jquery's drag and drop system. task-2312878 closes odoo/odoo#61521 X-original-commit: 31b69917639562a9b54d0e4d58d6dae1cdf90dc9 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js20
1 files changed, 12 insertions, 8 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 c8ac1b23cf1..15a4873bdc9 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -644,14 +644,18 @@ var SnippetEditor = Widget.extend({
this.$editable.find('.oe_drop_zone').droppable({
over: function () {
- self.$editable.find('.oe_drop_zone.hide').removeClass('hide');
- $(this).addClass('hide').first().after(self.$target);
- self.dropped = true;
+ if (!self.dropped) {
+ self.dropped = true;
+ $(this).first().after(self.$target).addClass('invisible');
+ }
},
out: function () {
- $(this).removeClass('hide');
- self.$target.detach();
- self.dropped = false;
+ var prev = self.$target.prev();
+ if (this === prev[0]) {
+ self.dropped = false;
+ self.$target.detach();
+ $(this).removeClass('invisible');
+ }
},
});
},
@@ -1960,7 +1964,7 @@ var SnippetsMenu = Widget.extend({
over: function () {
if (!dropped) {
dropped = true;
- $(this).first().after($toInsert).addClass('d-none');
+ $(this).first().after($toInsert).addClass('invisible');
$toInsert.removeClass('oe_snippet_body');
}
},
@@ -1969,7 +1973,7 @@ var SnippetsMenu = Widget.extend({
if (this === prev[0]) {
dropped = false;
$toInsert.detach();
- $(this).removeClass('d-none');
+ $(this).removeClass('invisible');
$toInsert.addClass('oe_snippet_body');
}
},