From 3d4b93c86a39252d5646a44f6720ada16e66a426 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 17 Jan 2023 23:05:48 -0500 Subject: [PATCH] Fix DOI field context menu not appearing after field edit Context menu wouldn't appear again until the item box was refreshed --- chrome/content/zotero/elements/itemBox.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index d5fb02a4b4..8142a92800 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -600,13 +600,6 @@ th.classList.add("pointer"); th.addEventListener('click', event => ZoteroPane_Local.loadURI(doi, event)); th.setAttribute('title', Zotero.getString('pane.item.viewOnline.tooltip')); - valueElement.oncontextmenu = (event) => { - this._id('zotero-doi-menu').openPopupAtScreen( - event.screenX + 1, - event.screenY + 1, - true - ); - }; var openURLMenuItem = this._id('zotero-doi-menu-view-online'); openURLMenuItem.addEventListener('command', event => ZoteroPane_Local.loadURI(doi, event)); @@ -1447,6 +1440,17 @@ } } + // Add popup menu on DOI field with value + if (fieldName == 'DOI' && valueText) { + valueElement.oncontextmenu = (event) => { + this._id('zotero-doi-menu').openPopupAtScreen( + event.screenX + 1, + event.screenY + 1, + true + ); + }; + } + valueElement.textContent = valueText; // Attempt to make bidi things work automatically: