diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-03-25 16:47:05 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-03-25 16:47:05 +0100 |
| commit | e9068c290b3ca16e5e2ac9c2e30d824c7a655b62 (patch) | |
| tree | 52a8ac6d3505b3c557b3a47d8620e41939237441 /addons/web_editor/static/src | |
| parent | 36289e77baa585d2923b95e5145d7169a66f8675 (diff) | |
| parent | 0196a6feb5a15a1e023faa2ffa0865f3338c4e7b (diff) | |
[MERGE] forward port branch 11.0 up to 0196a6feb5a
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.editor.js | 14 |
1 files changed, 13 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 e731ec0fd99..9a486d958c0 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -374,6 +374,7 @@ var SnippetEditor = Widget.extend({ */ _onDragAndDropStart: function () { var self = this; + this.dropped = false; self.size = { width: self.$target.width(), height: self.$target.height() @@ -419,10 +420,21 @@ var SnippetEditor = Widget.extend({ * 'move' button. * * @private + * @param {Event} ev + * @param {Object} ui */ - _onDragAndDropStop: function () { + _onDragAndDropStop: function (ev, ui) { var self = this; + // TODO lot of this is duplicated code of the d&d feature of snippets + if (!this.dropped) { + var $el = $.nearest({x: ui.position.left, y: ui.position.top}, '.oe_drop_zone').first(); + if ($el.length) { + $el.after(this.$target); + this.dropped = true; + } + } + $('.oe_drop_zone').droppable('destroy').remove(); var prev = this.$target.first()[0].previousSibling; |
