commit 383f8d2219e5abb96f4895c0f86b4833beee777f
parent df38f4ded7813fa2f9b4a6f74a731954296df68d
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 10 Dec 2017 17:20:13 -0500
Fix context-menu paste into Add Item by Identifier
The context menu was triggering onpopuphidden, which was clearing the
textbox.
Diffstat:
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git 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
@@ -161,7 +161,7 @@
</menupopup>
</toolbarbutton>
<toolbarbutton id="zotero-tb-lookup" class="zotero-tb-button" tooltiptext="&zotero.toolbar.lookup.label;" type="panel">
- <panel id="zotero-lookup-panel" type="arrow" onpopupshown="Zotero_Lookup.onShowing()"
+ <panel id="zotero-lookup-panel" type="arrow" onpopupshown="Zotero_Lookup.onShowing(event)"
onpopuphidden="Zotero_Lookup.onHidden(event)">
<vbox>
<description>&zotero.lookup.description;</description>