HTML tree: Don't move dragged external files by default on macOS
Fixes #2172
This commit is contained in:
parent
952663de73
commit
d723065a3d
2 changed files with 33 additions and 3 deletions
|
@ -1936,6 +1936,21 @@ var CollectionTree = class CollectionTree extends LibraryTree {
|
|||
}
|
||||
}
|
||||
else if (dataType == 'text/x-moz-url' || dataType == 'application/x-moz-file') {
|
||||
// See note in onDragOver() above
|
||||
if (dataType == 'application/x-moz-file' && Zotero.isMac) {
|
||||
if (event.metaKey) {
|
||||
if (event.altKey) {
|
||||
dropEffect = 'link';
|
||||
}
|
||||
else {
|
||||
dropEffect = 'move';
|
||||
}
|
||||
}
|
||||
else {
|
||||
dropEffect = 'copy';
|
||||
}
|
||||
}
|
||||
|
||||
var targetLibraryID = targetTreeRow.ref.libraryID;
|
||||
if (targetTreeRow.isCollection()) {
|
||||
var parentCollectionID = targetTreeRow.ref.id;
|
||||
|
@ -1974,7 +1989,7 @@ var CollectionTree = class CollectionTree extends LibraryTree {
|
|||
collections: parentCollectionID ? [parentCollectionID] : undefined
|
||||
});
|
||||
// If moving, delete original file
|
||||
if (dragData.dropEffect == 'move') {
|
||||
if (dropEffect == 'move') {
|
||||
try {
|
||||
file.remove(false);
|
||||
}
|
||||
|
|
|
@ -2359,7 +2359,22 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
window.ZoteroPane.displayCannotEditLibraryMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// See note in onDragOver() above
|
||||
if (dataType == 'application/x-moz-file' && Zotero.isMac) {
|
||||
if (event.metaKey) {
|
||||
if (event.altKey) {
|
||||
dropEffect = 'link';
|
||||
}
|
||||
else {
|
||||
dropEffect = 'move';
|
||||
}
|
||||
}
|
||||
else {
|
||||
dropEffect = 'copy';
|
||||
}
|
||||
}
|
||||
|
||||
var targetLibraryID = collectionTreeRow.ref.libraryID;
|
||||
|
||||
var parentItemID = false;
|
||||
|
@ -2484,7 +2499,7 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
}
|
||||
});
|
||||
// If moving, delete original file
|
||||
if (dragData.dropEffect == 'move') {
|
||||
if (dropEffect == 'move') {
|
||||
try {
|
||||
await OS.File.remove(file);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue