Fix quick format bubble drag-and-drop (see 5a1e3296
)
This commit is contained in:
parent
aef198d6b5
commit
5fa979575e
1 changed files with 6 additions and 5 deletions
|
@ -1252,7 +1252,7 @@ var Zotero_QuickFormat = new function () {
|
||||||
function _getBubbleIndex(bubble) {
|
function _getBubbleIndex(bubble) {
|
||||||
var nodes = qfe.childNodes, index = 0;
|
var nodes = qfe.childNodes, index = 0;
|
||||||
for (let node of nodes) {
|
for (let node of nodes) {
|
||||||
if (node.dataset.citationItem) {
|
if (node.dataset && node.dataset.citationItem) {
|
||||||
if (node == bubble) return index;
|
if (node == bubble) return index;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
@ -1267,13 +1267,14 @@ var Zotero_QuickFormat = new function () {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
var range = document.createRange();
|
|
||||||
|
|
||||||
// Find old position in list
|
// Find old position in list
|
||||||
var oldPosition = _getBubbleIndex(dragging);
|
var oldPosition = _getBubbleIndex(dragging);
|
||||||
range.setStart(event.rangeParent, event.rangeOffset);
|
|
||||||
|
// Move bubble
|
||||||
|
var range = document.createRange();
|
||||||
|
range.setStartBefore(event.rangeParent);
|
||||||
dragging.parentNode.removeChild(dragging);
|
dragging.parentNode.removeChild(dragging);
|
||||||
var bubble = _insertBubble(dragging.citationItem, range);
|
var bubble = _insertBubble(JSON.parse(dragging.dataset.citationItem), range);
|
||||||
|
|
||||||
// If moved out of order, turn off "Keep Sources Sorted"
|
// If moved out of order, turn off "Keep Sources Sorted"
|
||||||
if(io.sortable && keepSorted.hasAttribute("checked") && oldPosition !== -1 &&
|
if(io.sortable && keepSorted.hasAttribute("checked") && oldPosition !== -1 &&
|
||||||
|
|
Loading…
Reference in a new issue