Fix drag and drop of items
This commit is contained in:
parent
7138597d7e
commit
7ede2e8054
|
@ -364,21 +364,26 @@ function editor(root, inputData, options) {
|
|||
})
|
||||
|
||||
drake.on('drop', function (el, target, source, sibling) {
|
||||
let wasEditing = editing
|
||||
|
||||
stopEditing(root, store, currentEditor)
|
||||
|
||||
let stopID = $(sibling).attr('data-id')
|
||||
if (startID === stopID) {
|
||||
return
|
||||
}
|
||||
|
||||
let id = store.moveBefore(startID, stopID)
|
||||
if (id === startID) {
|
||||
return
|
||||
}
|
||||
|
||||
let position = store.index(id);
|
||||
cursor.set(position)
|
||||
let newPosition = store.moveBefore(startID, stopID)
|
||||
cursor.set(newPosition)
|
||||
|
||||
_.defer(() => {
|
||||
trigger('change')
|
||||
|
||||
if (wasEditing) {
|
||||
startEditing(root, store, cursor);
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
return drake;
|
||||
}
|
||||
|
@ -401,11 +406,6 @@ function editor(root, inputData, options) {
|
|||
})
|
||||
})
|
||||
|
||||
if (store.hasChanged()) {
|
||||
trigger('change')
|
||||
store.clearChanged()
|
||||
}
|
||||
|
||||
let $span = $('<div class="content">');
|
||||
options.transform(text, $span, id, EDITOR)
|
||||
element.replaceWith($span);
|
||||
|
|
Loading…
Reference in New Issue
Block a user