fx-compat: Fix Add Item by Identifier window

Still a little buggy
This commit is contained in:
Dan Stillman 2021-07-29 04:24:53 -04:00
parent 8075c2d938
commit 7ee40c4682
3 changed files with 47 additions and 19 deletions

View file

@ -146,7 +146,6 @@ var Zotero_Lookup = new function () {
if (event.originalTarget.id != 'zotero-lookup-panel') return; if (event.originalTarget.id != 'zotero-lookup-panel') return;
document.getElementById("zotero-lookup-panel").style.padding = "10px"; document.getElementById("zotero-lookup-panel").style.padding = "10px";
this.getActivePanel().getElementsByTagName('textbox')[0].focus();
// Resize arrow box to fit content // Resize arrow box to fit content
if (Zotero.isMac) { if (Zotero.isMac) {
@ -157,6 +156,17 @@ var Zotero_Lookup = new function () {
} }
/**
* Focuses the field
*/
this.onShown = function (event) {
// Ignore context menu
if (event.originalTarget.id != 'zotero-lookup-panel') return;
this.getActivePanel().querySelector('input').focus();
}
/** /**
* Cancels the popup and resets fields * Cancels the popup and resets fields
*/ */
@ -175,11 +185,21 @@ var Zotero_Lookup = new function () {
this.getActivePanel = function() { this.getActivePanel = function() {
var mlPanel = document.getElementById("zotero-lookup-multiline"); var mlPanel = document.getElementById("zotero-lookup-multiline");
if (mlPanel.collapsed) return document.getElementById("zotero-lookup-singleLine"); if (mlPanel.hidden) return document.getElementById("zotero-lookup-singleLine");
return mlPanel; return mlPanel;
} }
this.handleToolbarButtonMouseDown = function (event) {
var button = event.target;
if (button.disabled) {
event.preventDefault();
return;
}
this.showPanel(button)
};
/** /**
* Handles a key press * Handles a key press
*/ */

View file

@ -731,28 +731,31 @@
<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"
onmousedown="if (this.disabled) { event.preventDefault(); return; } Zotero_Lookup.showPanel(this)"/> onmousedown="if (this.disabled) { event.preventDefault(); return; } Zotero_Lookup.showPanel(this)"/>
<panel id="zotero-lookup-panel" type="arrow" onpopupshown="Zotero_Lookup.onShowing(event)" <panel id="zotero-lookup-panel" type="arrow"
onpopuphidden="Zotero_Lookup.onHidden(event)"> onpopupshowing="Zotero_Lookup.onShowing(event)"
<vbox> onpopupshown="Zotero_Lookup.onShown(event)"
<description>&zotero.lookup.description;</description> onpopuphidden="Zotero_Lookup.onHidden(event)"
<vbox id="zotero-lookup-singleLine"> >
<html:div>
<html:label>&zotero.lookup.description;</html:label>
<html:div id="zotero-lookup-singleLine">
<stack> <stack>
<progressmeter id="zotero-lookup-progress" mode="determined"/> <progressmeter id="zotero-lookup-progress" mode="determined"/>
<textbox id="zotero-lookup-textbox" <html:input id="zotero-lookup-textbox"
onkeypress="return Zotero_Lookup.onKeyPress(event, this)" onkeypress="return Zotero_Lookup.onKeyPress(event, this)"
oninput="Zotero_Lookup.onInput(event, this)" oninput="Zotero_Lookup.onInput(event, this)"/>
flex="1"
newlines="pasteintact"/>
</stack> </stack>
</vbox> </html:div>
<vbox id="zotero-lookup-multiline" collapsed="true"> <html:div id="zotero-lookup-multiline" hidden="">
<textbox id="zotero-lookup-multiline-textbox" onkeypress="return Zotero_Lookup.onKeyPress(event, this)" multiline="true" rows="5" wrap="off" flex="1"/> <html:input id="zotero-lookup-multiline-textbox" onkeypress="return Zotero_Lookup.onKeyPress(event, this)" rows="5"/> <!-- wrap="off" flex="1"/> -->
<hbox align="start" id="zotero-lookup-buttons" class="zotero-button-clear-image"> <html:div id="zotero-lookup-buttons" class="zotero-button-clear-image"> <!-- align="start" -->
<button label="&zotero.lookup.button.search;" align="start" oncommand="Zotero_Lookup.accept(document.getElementById('zotero-lookup-multiline-textbox'))"/> <html:button align="start" onclick="Zotero_Lookup.accept(document.getElementById('zotero-lookup-multiline-textbox'))">
&zotero.lookup.button.search;
</html:button>
<progressmeter id="zotero-lookup-multiline-progress" mode="determined" flex="1" hidden="true"/> <progressmeter id="zotero-lookup-multiline-progress" mode="determined" flex="1" hidden="true"/>
</hbox> </html:div>
</vbox> </html:div>
</vbox> </html:div>
</panel> </panel>
<!--<toolbarbutton id="zotero-tb-note-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.note.standalone;" oncommand="ZoteroPane_Local.newNote(event.shiftKey);"/>--> <!--<toolbarbutton id="zotero-tb-note-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.note.standalone;" oncommand="ZoteroPane_Local.newNote(event.shiftKey);"/>-->

View file

@ -301,6 +301,11 @@
list-style-image: url('chrome://zotero/skin/toolbar-item-from-page.png'); list-style-image: url('chrome://zotero/skin/toolbar-item-from-page.png');
} }
#zotero-lookup-multiline-progress
{
height: 2em;
}
/* /*
#zotero-tb-link-page #zotero-tb-link-page
{ {