From 0e1a16b96bd0ad87fd80b318f69617f1c0ccfa52 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Fri, 17 Jun 2022 18:49:07 -0500 Subject: [PATCH] fx-compat: Show native field/creator transform popups No longer anchored to the element, but instead to the cursor. --- chrome/content/zotero/elements/itemBox.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index 773dfb64c9..086584d743 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -908,9 +908,13 @@ } if (this.editable && fieldMode == 0) { - firstlast.oncontextmenu = () => { + firstlast.oncontextmenu = (event) => { document.popupNode = firstlast; - this._id('zotero-creator-transform-menu').openPopup(firstlast); + this._id('zotero-creator-transform-menu').openPopupAtScreen( + event.screenX + 1, + event.screenY + 1, + true + ); }; } @@ -1404,9 +1408,14 @@ if (this.editable && (fieldName == 'seriesTitle' || fieldName == 'shortTitle' || Zotero.ItemFields.isFieldOfBase(fieldID, 'title') || Zotero.ItemFields.isFieldOfBase(fieldID, 'publicationTitle'))) { - valueElement.oncontextmenu = () => { + valueElement.setAttribute('context', 'zotero-field-transform-menu'); + valueElement.oncontextmenu = (event) => { document.popupNode = valueElement; - this._id('zotero-field-transform-menu').openPopup(valueElement); + this._id('zotero-field-transform-menu').openPopupAtScreen( + event.screenX + 1, + event.screenY + 1, + true + ); }; } }