From fb15c9a37ca36b2b3a0af269af26df5c3e4b72e2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 20 Oct 2016 23:19:33 -0400 Subject: [PATCH] Allow file drag to web targets (e.g., Gmail) and Linux filesystem Closes #67 Closes #465 --- chrome/content/zotero/xpcom/itemTreeView.js | 83 +++++++++++---------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index 7690e06b4f..bb0a6f5ab6 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -2485,47 +2485,49 @@ Zotero.ItemTreeView.prototype.onDragStart = function (event) { var items = Zotero.Items.get(itemIDs); - // Multi-file drag - // - Doesn't work on Windows - if (!Zotero.isWin) { - // If at least one file is a non-web-link attachment and can be found, - // enable dragging to file system - for (var i=0; i item.isAttachment()) + .map(item => item.getFilePath()) + .filter(path => path); + + if (files.length) { + // Advanced multi-file drag (with unique filenames, which otherwise happen automatically on + // Windows but not Linux) and auxiliary snapshot file copying on macOS + let dataProvider; + if (Zotero.isMac) { + dataProvider = new Zotero.ItemTreeView.fileDragDataProvider(itemIDs); } - } - // Copy first file on Windows - else { - var index = 0; - for (var i=0; i