Fix context-menu paste into Add Item by Identifier

The context menu was triggering onpopuphidden, which was clearing the
textbox.
This commit is contained in:
Dan Stillman 2017-12-10 17:20:13 -05:00
parent df38f4ded7
commit 383f8d2219
2 changed files with 9 additions and 3 deletions

View file

@ -117,7 +117,10 @@ var Zotero_Lookup = new function () {
/** /**
* Focuses the field * 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"; document.getElementById("zotero-lookup-panel").style.padding = "10px";
// Workaround for field being truncated in middle // Workaround for field being truncated in middle
@ -132,7 +135,10 @@ var Zotero_Lookup = new function () {
/** /**
* Cancels the popup and resets fields * 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 txtBox = Zotero_Lookup.toggleMultiline(false);
var mlTextbox = document.getElementById("zotero-lookup-multiline-textbox"); var mlTextbox = document.getElementById("zotero-lookup-multiline-textbox");
txtBox.value = ""; txtBox.value = "";

View file

@ -161,7 +161,7 @@
</menupopup> </menupopup>
</toolbarbutton> </toolbarbutton>
<toolbarbutton id="zotero-tb-lookup" class="zotero-tb-button" tooltiptext="&zotero.toolbar.lookup.label;" type="panel"> <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)"> onpopuphidden="Zotero_Lookup.onHidden(event)">
<vbox> <vbox>
<description>&zotero.lookup.description;</description> <description>&zotero.lookup.description;</description>