diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-03-20 10:15:49 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-03-20 10:15:49 +0000 |
| commit | 92f8a3c9ef4a22d906b8df3795ad2ab55f672979 (patch) | |
| tree | 3d32b88741c30a7148113ecc927ac4b88708a744 /addons/web_editor/static/src/js | |
| parent | 98fe5054c26828a3a15c8cd7b5905c7cf99c6103 (diff) | |
[FIX] web_editor: review drag and drop in the editor
Forward-port of https://github.com/odoo/odoo/commit/be689c53c13330832510c8cef332ac862d4ed5e8
was missed from 11.0.
closes odoo/odoo#31971
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.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 2e9975014e3..11a96897fa6 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -370,6 +370,7 @@ var SnippetEditor = Widget.extend({ */ _onDragAndDropStart: function () { var self = this; + this.dropped = false; self.size = { width: self.$target.width(), height: self.$target.height() @@ -415,10 +416,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; |
