fix(drag): while dragging copy marginLeft to show item with right indent
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-08-24 22:02:56 +02:00
parent 8167f6d85d
commit c1fe438925

View File

@ -396,15 +396,19 @@ function editor(root, inputData, options) {
} }
function enableDragging(rootElement) { function enableDragging(rootElement) {
let start = -1;
let startID = null;
let drake = dragula([rootElement], { let drake = dragula([rootElement], {
moves: function (el, container, handle, sibling) { moves: function (el, container, handle, sibling) {
return handle.classList.contains('marker') return handle.classList.contains('marker')
},
accepts: function (el, target, source, sibling) {
el.style.marginLeft = sibling === null ? 0 : sibling.style.marginLeft
return true
} }
}) })
let start = -1;
let startID = null;
drake.on('drag', function (el, source) { drake.on('drag', function (el, source) {
startID = $(el).attr('data-id') startID = $(el).attr('data-id')
}) })