From 90b393ed7953cd284ef7e22aa428dc7b5fa160ca Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 8 Apr 2020 03:50:36 -0400 Subject: [PATCH] Fix Shift-drag/Cmd-drag to tag selector to remove tags Apparently we implemented this 5 years ago in #873 and then broke it (with the move to React, I think) without ever announcing it as a new feature in Zotero 5? Anyway, this restores it, using Cmd on macOS (the same as for moving vs copying items, or files in Finder). --- .../zotero/containers/tagSelectorContainer.jsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/containers/tagSelectorContainer.jsx b/chrome/content/zotero/containers/tagSelectorContainer.jsx index 4b633fc9ef..ce0f6b9d05 100644 --- a/chrome/content/zotero/containers/tagSelectorContainer.jsx +++ b/chrome/content/zotero/containers/tagSelectorContainer.jsx @@ -538,14 +538,13 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent { return; } - // Store the event, because drop event does not have shiftKey attribute set - Zotero.DragDrop.currentEvent = event; elem.classList.add('dragged-over'); event.preventDefault(); - event.dataTransfer.dropEffect = "copy"; + // Don't show + cursor when removing tags + var remove = (Zotero.isMac && event.metaKey) || (!Zotero.isMac && event.shiftKey); + event.dataTransfer.dropEffect = remove ? "move" : "copy"; }, onDragExit: function (event) { - Zotero.DragDrop.currentEvent = null; event.target.classList.remove('dragged-over'); }, onDrop: async function(event) { @@ -564,6 +563,9 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent { return; } + // Remove tags on Cmd-drag/Shift-drag + var remove = (Zotero.isMac && event.metaKey) || (!Zotero.isMac && event.shiftKey); + return Zotero.DB.executeTransaction(function* () { ids = ids.split(','); var items = Zotero.Items.get(ids); @@ -571,9 +573,10 @@ Zotero.TagSelector = class TagSelectorContainer extends React.PureComponent { for (let i=0; i