[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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user