Commit a8ef00b0 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

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

parents 9bc8c6ba 9a241ca8
......@@ -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