Commit 9a241ca8 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1813987:droping a new block outside grid removes lastest block

behatnotneeded

Change-Id: I376d646fc034f88450c7bf0bbceee332692230ed
parent 9e81132d
......@@ -444,20 +444,24 @@
return helper;
},
connectToSortable: '.grid-stack',
stop: function(event, ui) {
appendTo: 'body',
});
$( ".gridedit" ).droppable({
drop: function(event, ui) {
var placeholder = $('.grid-stack').children().last(),
x = placeholder.attr('data-gs-x'),
y = placeholder.attr('data-gs-y');
if (typeof(x) != 'undefined' && typeof(y) != 'undefined') {
var grid = $('.grid-stack').data('gridstack');
grid.removeWidget(placeholder);
$(placeholder).remove();
x = placeholder.attr('data-gs-x'),
y = placeholder.attr('data-gs-y');
$('.grid-stack .blocktype-drag').removeClass('btn btn-primary');
addNewBlock({'positionx': x, 'positiony': y}, 'placeholder');
}
},
appendTo: 'body',
var grid = $('.grid-stack').data('gridstack');
grid.removeWidget(placeholder);
$(placeholder).remove();
$('.grid-stack .blocktype-drag').removeClass('btn btn-primary');
addNewBlock({'positionx': x, 'positiony': y}, 'placeholder');
}
});
$('.blocktype-drag').off('click keydown'); // remove old event handlers
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment