From 383f8d2219e5abb96f4895c0f86b4833beee777f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 10 Dec 2017 17:20:13 -0500 Subject: [PATCH] Fix context-menu paste into Add Item by Identifier The context menu was triggering onpopuphidden, which was clearing the textbox. --- chrome/content/zotero/lookup.js | 10 ++++++++-- chrome/content/zotero/zoteroPane.xul | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js index 885211d7c5..72bd7ce148 100644 --- a/chrome/content/zotero/lookup.js +++ b/chrome/content/zotero/lookup.js @@ -117,7 +117,10 @@ var Zotero_Lookup = new function () { /** * Focuses the field */ - this.onShowing = function() { + this.onShowing = function (event) { + // Ignore context menu + if (event.originalTarget.id != 'zotero-lookup-panel') return; + document.getElementById("zotero-lookup-panel").style.padding = "10px"; // Workaround for field being truncated in middle @@ -132,7 +135,10 @@ var Zotero_Lookup = new function () { /** * Cancels the popup and resets fields */ - this.onHidden = function() { + this.onHidden = function (event) { + // Ignore context menu to prevent blanking on paste + if (event.originalTarget.id != 'zotero-lookup-panel') return; + var txtBox = Zotero_Lookup.toggleMultiline(false); var mlTextbox = document.getElementById("zotero-lookup-multiline-textbox"); txtBox.value = ""; diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul index 429260f385..4afcecbbf8 100644 --- a/chrome/content/zotero/zoteroPane.xul +++ b/chrome/content/zotero/zoteroPane.xul @@ -161,7 +161,7 @@ - &zotero.lookup.description;