Ignore drags to tag selector background
This was causing tags to be created with the text of all tags.
This commit is contained in:
parent
697937a72c
commit
3561864542
1 changed files with 18 additions and 5 deletions
|
@ -1012,9 +1012,16 @@
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var elem = event.target;
|
||||||
|
|
||||||
|
// Ignore drops not on tags
|
||||||
|
if (elem.localName != 'button') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Store the event, because drop event does not have shiftKey attribute set
|
// Store the event, because drop event does not have shiftKey attribute set
|
||||||
Zotero.DragDrop.currentEvent = event;
|
Zotero.DragDrop.currentEvent = event;
|
||||||
event.target.setAttribute('draggedOver', true);
|
elem.setAttribute('draggedOver', true);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.dataTransfer.dropEffect = "copy";
|
event.dataTransfer.dropEffect = "copy";
|
||||||
}
|
}
|
||||||
|
@ -1026,8 +1033,14 @@
|
||||||
|
|
||||||
|
|
||||||
this.onDrop = Zotero.Promise.method(function (event) {
|
this.onDrop = Zotero.Promise.method(function (event) {
|
||||||
var node = event.target;
|
var elem = event.target;
|
||||||
node.setAttribute('draggedOver', false);
|
|
||||||
|
// Ignore drops not on tags
|
||||||
|
if (elem.localName != 'button') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.setAttribute('draggedOver', false);
|
||||||
|
|
||||||
var dt = event.dataTransfer;
|
var dt = event.dataTransfer;
|
||||||
var ids = dt.getData('zotero/item');
|
var ids = dt.getData('zotero/item');
|
||||||
|
@ -1038,7 +1051,7 @@
|
||||||
return Zotero.DB.executeTransaction(function* () {
|
return Zotero.DB.executeTransaction(function* () {
|
||||||
ids = ids.split(',');
|
ids = ids.split(',');
|
||||||
var items = Zotero.Items.get(ids);
|
var items = Zotero.Items.get(ids);
|
||||||
var value = node.textContent
|
var value = elem.textContent
|
||||||
|
|
||||||
for (let i=0; i<items.length; i++) {
|
for (let i=0; i<items.length; i++) {
|
||||||
let item = items[i];
|
let item = items[i];
|
||||||
|
|
Loading…
Reference in a new issue