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);
});
}
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)
});
return swappable;
}
export default function Flexbox() {
const containers = document.querySelectorAll('#Flexbox .BlockLayout');
if (containers.length === 0) {
return false;
}
const swappable = new Swappable(containers, {
draggable: '.Block--isDraggable',
mirror: {
constrainDimensions: true,
},
plugins: [Plugins.ResizeMirror],
});
return swappable;
}
export default function Floated() {
const containers = document.querySelectorAll('#Floated .BlockLayout');
if (containers.length === 0) {
return false;
}
const swappable = new Swappable(containers, {
draggable: '.Block--isDraggable',
mirror: {
constrainDimensions: true,
},
plugins: [Plugins.ResizeMirror],
});
return swappable;
}
export default function GridLayout() {
const containerSelector = '#GridLayout .BlockLayout';
const containers = document.querySelectorAll(containerSelector);
if (containers.length === 0) {
return false;
}
const swappable = new Swappable(containers, {
draggable: '.Block--isDraggable',
mirror: {
appendTo: containerSelector,
constrainDimensions: true,
},
plugins: [Plugins.ResizeMirror],
});
return swappable;
}