Fix dragging external files onto library root

This commit is contained in:
Dan Stillman 2016-12-27 03:11:21 -05:00
parent b01487dccc
commit e282a5643f
2 changed files with 52 additions and 58 deletions

View file

@ -60,7 +60,7 @@ Zotero.Attachments = new function(){
throw new Error("parentItemID and collections cannot both be provided");
}
var attachmentItem, itemID, newFile, contentType;
var attachmentItem, itemID, newFile, contentType, destDir;
try {
yield Zotero.DB.executeTransaction(function* () {
// Create a new attachment

View file

@ -2227,8 +2227,6 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
var parentCollectionID = false;
}
var commitNotifier = Zotero.Notifier.begin();
try {
for (var i=0; i<data.length; i++) {
var file = data[i];
@ -2269,14 +2267,14 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
if (dropEffect == 'link') {
yield Zotero.Attachments.linkFromFile({
file: file,
collections: [parentCollectionID]
collections: parentCollectionID ? [parentCollectionID] : undefined
});
}
else {
yield Zotero.Attachments.importFromFile({
file: file,
libraryID: targetLibraryID,
collections: [parentCollectionID]
collections: parentCollectionID ? [parentCollectionID] : undefined
});
// If moving, delete original file
if (dragData.dropEffect == 'move') {
@ -2290,10 +2288,6 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
}
}
}
finally {
Zotero.Notifier.commit(unlock);
}
}
});