Cancel should close lookup panel

This commit is contained in:
Simon Kornblith 2011-07-24 17:49:16 +00:00
parent 09e07df294
commit 617646f0a2
2 changed files with 14 additions and 1 deletions

View File

@ -91,6 +91,19 @@ const Zotero_Lookup = new function () {
return false;
}
/**
* Handles a key press
*/
this.onKeyPress = function(event) {
var keyCode = event.keyCode;
if(keyCode === 13 || keyCode === 14) {
Zotero_Lookup.accept();
} else if(keyCode == event.DOM_VK_ESCAPE) {
document.getElementById("zotero-lookup-panel").hidePopup();
}
return true;
}
/**
* Focuses the field
*/

View File

@ -145,7 +145,7 @@
onpopuphidden="Zotero_Lookup.onHidden()" noautohide="true">
<vbox>
<description>&zotero.lookup.description;</description>
<textbox id="zotero-lookup-textbox" style="margin: 2px 0 2px 0" onkeypress="if([13, 14].indexOf(event.keyCode) !== -1) { Zotero_Lookup.accept(); } return true;" flex="1"/>
<textbox id="zotero-lookup-textbox" style="margin: 2px 0 2px 0" onkeypress="return Zotero_Lookup.onKeyPress(event)" flex="1"/>
<hbox>
<toolbarbutton class="zotero-small-progress-indicator" id="zotero-lookup-progress"/>
<spacer flex="1"/>