Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function dragSetup() {
const containerSelector = '#discovered_list, #editor_holder';
const containers = document.querySelectorAll(containerSelector);
if (containers.length === 0) {
return false;
}
const sortable = new Sortable(containers, {
draggable: '.cfg-row',
handle: '.navbar-dark',
mirror: {
constrainDimensions: true,
},
plugins: [Plugins.ResizeMirror],
});
// sortable.on('sortable:start', () => console.log('drag:start'));
// sortable.on('sortable:move', () => console.log('drag:move'));
sortable.on('drag:stop', () => {
setTimeout(updateSlotID, 125);
});
}
export default function MultipleContainers() {
const containers = document.querySelectorAll('#MultipleContainers .StackedList');
if (containers.length === 0) {
return false;
}
const sortable = new Sortable(containers, {
draggable: `.${Classes.draggable}`,
mirror: {
constrainDimensions: true,
},
plugins: [Plugins.Releasable],
});
const containerTwoCapacity = 3;
const containerTwoParent = sortable.containers[1].parentNode;
let currentMediumChildren;
let capacityReached;
let lastOverContainer;
// --- Draggable events --- //
sortable.on('drag:start', (evt) => {
currentMediumChildren = sortable.getDraggableElementsForContainer(sortable.containers[1]).length;
function GridLayout() {
const containerSelector = '.drag-container';
const containers = document.querySelectorAll(containerSelector);
if (containers.length === 0) {
return false;
}
swappable = new Sortable(containers, {
draggable: '.col-sm',
mirror: {
appendTo: containerSelector,
constrainDimensions: true,
},
plugins: [Plugins.ResizeMirror],
});
renderEditSlots(calcEditSlots());
swappable.on('sortable:stop', (evt) => {
console.log('DROP');
console.log(evt.dragEvent);
setTimeout(onDrop, 125, evt.dragEvent.source, evt.oldContainer.id, evt.newContainer.id)
});
export default function Transformed() {
const containerSelector = '#Transformed .PaperStack';
const containers = document.querySelectorAll(containerSelector);
if (containers.length === 0) {
return false;
}
const sortable = new Sortable(containers, {
draggable: '.PaperStackItem--isDraggable',
mirror: {
appendTo: containerSelector,
constrainDimensions: true,
},
});
return sortable;
}
options = _.assign({}, options, {
delay,
sensors,
plugins,
});
if (this.ownInstance) {
switch (draggableType) {
case 'droppable':
this.draggableInstance = new Droppable(this.ownInstance, options);
break;
case 'swappable':
this.draggableInstance = new Swappable(this.ownInstance, options);
break;
case 'sortable':
this.draggableInstance = new Sortable(this.ownInstance, options);
break;
case 'draggable':
default:
this.draggableInstance = new Draggable(this.ownInstance, options);
break;
}
}
}
export default function PluginsSwapAnimation() {
const containers = document.querySelectorAll('#SwapAnimation .BlockLayout');
if (containers.length === 0) {
return false;
}
const sortable = new Sortable(containers, {
draggable: '.Block--isDraggable',
mirror: {
constrainDimensions: true,
},
plugins: [Plugins.SwapAnimation],
swapAnimation: {
duration: 200,
easingFunction: 'ease-in-out',
},
});
return sortable;
}
export default function SimpleList() {
const containerSelector = '#SimpleList .StackedList';
const containers = document.querySelectorAll(containerSelector);
if (containers.length === 0) {
return false;
}
const sortable = new Sortable(containers, {
draggable: '.StackedListItem--isDraggable',
mirror: {
appendTo: containerSelector,
constrainDimensions: true,
},
});
return sortable;
}