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') {
|
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;
|
var targetLibraryID = targetTreeRow.ref.libraryID;
|
||||||
if (targetTreeRow.isCollection()) {
|
if (targetTreeRow.isCollection()) {
|
||||||
var parentCollectionID = targetTreeRow.ref.id;
|
var parentCollectionID = targetTreeRow.ref.id;
|
||||||
|
@ -1974,7 +1989,7 @@ var CollectionTree = class CollectionTree extends LibraryTree {
|
||||||
collections: parentCollectionID ? [parentCollectionID] : undefined
|
collections: parentCollectionID ? [parentCollectionID] : undefined
|
||||||
});
|
});
|
||||||
// If moving, delete original file
|
// If moving, delete original file
|
||||||
if (dragData.dropEffect == 'move') {
|
if (dropEffect == 'move') {
|
||||||
try {
|
try {
|
||||||
file.remove(false);
|
file.remove(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2360,6 +2360,21 @@ var ItemTree = class ItemTree extends LibraryTree {
|
||||||
return;
|
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 targetLibraryID = collectionTreeRow.ref.libraryID;
|
||||||
|
|
||||||
var parentItemID = false;
|
var parentItemID = false;
|
||||||
|
@ -2484,7 +2499,7 @@ var ItemTree = class ItemTree extends LibraryTree {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// If moving, delete original file
|
// If moving, delete original file
|
||||||
if (dragData.dropEffect == 'move') {
|
if (dropEffect == 'move') {
|
||||||
try {
|
try {
|
||||||
await OS.File.remove(file);
|
await OS.File.remove(file);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue