Skip to content
Snippets Groups Projects
Commit 223e0242 authored by srosse's avatar srosse
Browse files

OO-3620: destroy dragula after every drop

parent f37959f5
No related branches found
No related tags found
No related merge requests found
...@@ -41,9 +41,10 @@ ...@@ -41,9 +41,10 @@
initEdit(); initEdit();
initWindowListener(); initWindowListener();
initDragAndDrop(container); this.container = container;
this.drake = initDragAndDrop(container);
}; };
function initEdit() { function initEdit() {
jQuery(".o_page_part").each(function(index, el) { jQuery(".o_page_part").each(function(index, el) {
jQuery(el).on('click', function(e) { jQuery(el).on('click', function(e) {
...@@ -62,7 +63,6 @@ ...@@ -62,7 +63,6 @@
o_info.contentEditorWindowListener = function(e) { o_info.contentEditorWindowListener = function(e) {
var componentUrl = jQuery(".o_page_content_editor").data("oo-content-editor-url"); var componentUrl = jQuery(".o_page_content_editor").data("oo-content-editor-url");
if(componentUrl === undefined || componentUrl == null) { if(componentUrl === undefined || componentUrl == null) {
console.log('remove');
jQuery(window).off('click', o_info.contentEditorWindowListener); jQuery(window).off('click', o_info.contentEditorWindowListener);
o_info.contentEditorWindowListener = null; o_info.contentEditorWindowListener = null;
} else { } else {
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
} }
function initDragAndDrop(container) { function initDragAndDrop(container) {
dragula([container], { var drake = dragula([container], {
isContainer: function(el) { isContainer: function(el) {
return jQuery(el).hasClass('o_page_drop'); return jQuery(el).hasClass('o_page_drop');
}, },
...@@ -91,7 +91,9 @@ ...@@ -91,7 +91,9 @@
moves: function (el, targetContainer, handle) { moves: function (el, targetContainer, handle) {
return jQuery(handle).hasClass('o_page_tools_dd') ; return jQuery(handle).hasClass('o_page_tools_dd') ;
} }
}).on('dragend', function(el) { });
drake.on('dragend', function(el) {
cleanAcceptMarker(container); cleanAcceptMarker(container);
}).on('cancel', function() { }).on('cancel', function() {
cleanAcceptMarker(container); cleanAcceptMarker(container);
...@@ -100,8 +102,11 @@ ...@@ -100,8 +102,11 @@
}).on('out', function(el, target, source) { }).on('out', function(el, target, source) {
jQuery(target).removeClass('oo-accepted'); jQuery(target).removeClass('oo-accepted');
}).on('drop', function(el, target, source, sibling) { }).on('drop', function(el, target, source, sibling) {
drake.destroy();// drop trigger a reload -> clean up all and more
drop(el, target, source, sibling); drop(el, target, source, sibling);
}); });
return drake;
} }
function drop(el, target, source, sibling) { function drop(el, target, source, sibling) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment