diff --git a/chrome/content/zotero/locateMenu.js b/chrome/content/zotero/locateMenu.js
index c4ee9dea7e..836d101dff 100644
--- a/chrome/content/zotero/locateMenu.js
+++ b/chrome/content/zotero/locateMenu.js
@@ -94,8 +94,9 @@ var Zotero_LocateMenu = new function() {
* Clear the bottom part of the context menu and add locate options
* @param {menupopup} menu The menu to add context menu items to
* @param {Boolean} showIcons Whether menu items should have associated icons
+ * @return {Promise}
*/
- this.buildContextMenu = function(menu, showIcons) {
+ this.buildContextMenu = Zotero.Promise.coroutine(function* (menu, showIcons) {
// get selected items
var selectedItems = _getSelectedItems();
@@ -103,7 +104,7 @@ var Zotero_LocateMenu = new function() {
if(!selectedItems.length || selectedItems.length > 20) return;
// add view options
- _addViewOptions(menu, selectedItems, showIcons);
+ yield _addViewOptions(menu, selectedItems, showIcons);
/*// look for locate engines
var availableEngines = _getAvailableLocateEngines(selectedItems);
@@ -119,7 +120,7 @@ var Zotero_LocateMenu = new function() {
submenu.appendChild(submenuPopup);
menu.appendChild(submenu);
}*/
- }
+ });
function _addViewOption(selectedItems, optionName, optionObject, showIcons) {
var menuitem = _createMenuItem(Zotero.getString("locate."+optionName+".label"),
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
index 64617cc435..15b7bbe3c8 100644
--- a/chrome/content/zotero/zoteroPane.js
+++ b/chrome/content/zotero/zoteroPane.js
@@ -2591,7 +2591,7 @@ var ZoteroPane = new function()
}
// add locate menu options
- Zotero_LocateMenu.buildContextMenu(menu, true);
+ yield Zotero_LocateMenu.buildContextMenu(menu, true);
});
@@ -2625,12 +2625,25 @@ var ZoteroPane = new function()
}
}
}
-
- // Automatically select all equivalent items when clicking on an item
- // in duplicates view
else if (tree.id == 'zotero-items-tree') {
+ // Show context menu once it's ready
+ if (event.button == 2) {
+ // Allow item to be selected first
+ setTimeout(function () {
+ ZoteroPane_Local.buildItemContextMenu()
+ .then(function () {
+ document.getElementById('zotero-itemmenu').openPopup(
+ null, null, event.clientX, event.clientY, true, false, event
+ );
+ })
+ });
+ return;
+ }
+
let collectionTreeRow = ZoteroPane_Local.getCollectionTreeRow();
+ // Automatically select all equivalent items when clicking on an item
+ // in duplicates view
if (collectionTreeRow.isDuplicates()) {
// Trigger only on primary-button single clicks without modifiers
// (so that items can still be selected and deselected manually)
diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul
index 003a2da04b..0758c49ea2 100644
--- a/chrome/content/zotero/zoteroPane.xul
+++ b/chrome/content/zotero/zoteroPane.xul
@@ -258,7 +258,7 @@
-