draggable
refers to a Draggable.Sortable instance.You can also check out the fiddle.
Add revertOnSpill functionality to Sortable
var outContainer;
draggable.on('drag:out:container', (e) => {
outContainer = e.data.overContainer;
});
draggable.on('sortable:stop', (e) => {
var newContainer = e.data.newContainer;
var spill = outContainer && outContainer === newContainer;
if (spill) {
var oldContainer = e.data.oldContainer;
var oldContainerChildren = draggable.getDraggableElementsForContainer(oldContainer);
var emptyOldContainer = !oldContainerChildren.length;
var source = e.data.dragEvent.data.source;
if (emptyOldContainer) {
oldContainer.appendChild(source);
} else {
var oldIndex = e.data.oldIndex;
oldContainer.insertBefore(source, oldContainer.children[oldIndex]);
}
}
});