Addresses #401, Add keyboard shortcuts
Improves tabbing between UI panes, including into metadata fields Still some quirks and things that don't work but should (e.g. ctrl-tab to cycle through tabs in metadata pane and ability to add new creators via the keyboard), but better
This commit is contained in:
parent
1395432f87
commit
fe92dd2cf0
|
@ -72,6 +72,7 @@ var ZoteroItemPane = new function()
|
|||
this.removeAttachment = removeAttachment;
|
||||
this.addAttachmentFromDialog = addAttachmentFromDialog;
|
||||
this.addAttachmentFromPage = addAttachmentFromPage;
|
||||
this.focusFirstField = focusFirstField;
|
||||
|
||||
|
||||
function onLoad()
|
||||
|
@ -637,8 +638,8 @@ var ZoteroItemPane = new function()
|
|||
lastName.setAttribute('flex', '1');
|
||||
|
||||
// Remove firstname field from tabindex
|
||||
var tab = parseInt(firstName.getAttribute('tabindex'));
|
||||
firstName.setAttribute('tabindex', -1);
|
||||
var tab = parseInt(firstName.getAttribute('ztabindex'));
|
||||
firstName.setAttribute('ztabindex', -1);
|
||||
if (_tabIndexMaxCreators==tab)
|
||||
{
|
||||
_tabIndexMaxCreators--;
|
||||
|
@ -672,8 +673,8 @@ var ZoteroItemPane = new function()
|
|||
lastName.setAttribute('flex', '0');
|
||||
|
||||
// Add firstname field to tabindex
|
||||
var tab = parseInt(lastName.getAttribute('tabindex'));
|
||||
firstName.setAttribute('tabindex', tab + 1);
|
||||
var tab = parseInt(lastName.getAttribute('ztabindex'));
|
||||
firstName.setAttribute('ztabindex', tab + 1);
|
||||
if (_tabIndexMaxCreators==tab)
|
||||
{
|
||||
_tabIndexMaxCreators++;
|
||||
|
@ -748,7 +749,7 @@ var ZoteroItemPane = new function()
|
|||
|
||||
if (!noedit){
|
||||
valueElement.setAttribute('flex', 1);
|
||||
valueElement.setAttribute('tabindex', tabindex);
|
||||
valueElement.setAttribute('ztabindex', tabindex);
|
||||
valueElement.setAttribute('onclick', 'ZoteroItemPane.showEditor(this)');
|
||||
valueElement.className = 'zotero-clicky';
|
||||
}
|
||||
|
@ -836,7 +837,7 @@ var ZoteroItemPane = new function()
|
|||
//Zotero.debug('Showing editor');
|
||||
|
||||
var fieldName = elem.getAttribute('fieldname');
|
||||
var tabindex = elem.getAttribute('tabindex');
|
||||
var tabindex = elem.getAttribute('ztabindex');
|
||||
|
||||
var [field, creatorIndex, creatorField] = fieldName.split('-');
|
||||
if (field == 'creator')
|
||||
|
@ -867,7 +868,7 @@ var ZoteroItemPane = new function()
|
|||
var t = document.createElement("textbox");
|
||||
t.setAttribute('value',value);
|
||||
t.setAttribute('fieldname', fieldName);
|
||||
t.setAttribute('tabindex', tabindex);
|
||||
t.setAttribute('ztabindex', tabindex);
|
||||
t.setAttribute('flex','1');
|
||||
|
||||
if (creatorField=='lastName')
|
||||
|
@ -1028,7 +1029,7 @@ var ZoteroItemPane = new function()
|
|||
return;
|
||||
}
|
||||
var fieldName = textbox.getAttribute('fieldname');
|
||||
var tabindex = textbox.getAttribute('tabindex');
|
||||
var tabindex = textbox.getAttribute('ztabindex');
|
||||
|
||||
var value = t.value;
|
||||
|
||||
|
@ -1351,6 +1352,15 @@ var ZoteroItemPane = new function()
|
|||
}
|
||||
|
||||
|
||||
function focusFirstField(mode) {
|
||||
switch (mode) {
|
||||
case 'info':
|
||||
_focusNextField('info', _dynamicFields, 0, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Advance the field focus forward or backward
|
||||
*
|
||||
|
@ -1358,8 +1368,6 @@ var ZoteroItemPane = new function()
|
|||
* which doesn't work well with the weird label/textbox stuff we're doing.
|
||||
* (The textbox being tabbed away from is deleted before the blur()
|
||||
* completes, so it doesn't know where it's supposed to go next.)
|
||||
*
|
||||
* Use of the 'tabindex' attribute is arbitrary.
|
||||
*/
|
||||
function _focusNextField(mode, box, tabindex, back){
|
||||
tabindex = parseInt(tabindex);
|
||||
|
@ -1371,6 +1379,7 @@ var ZoteroItemPane = new function()
|
|||
{
|
||||
case 1:
|
||||
//Zotero.debug('At beginning');
|
||||
document.getElementById('zotero-editpane-type-menu').focus();
|
||||
return false;
|
||||
|
||||
case _tabIndexMinCreators:
|
||||
|
@ -1438,7 +1447,7 @@ var ZoteroItemPane = new function()
|
|||
switch (mode)
|
||||
{
|
||||
case 'info':
|
||||
var next = box.getElementsByAttribute('tabindex', nextIndex);
|
||||
var next = box.getElementsByAttribute('ztabindex', nextIndex);
|
||||
if (!next[0])
|
||||
{
|
||||
//Zotero.debug("Next field not found");
|
||||
|
@ -1449,7 +1458,7 @@ var ZoteroItemPane = new function()
|
|||
// Tags pane
|
||||
case 'tags':
|
||||
var next = document.getAnonymousNodes(box)[0].
|
||||
getElementsByAttribute('tabindex', nextIndex);
|
||||
getElementsByAttribute('ztabindex', nextIndex);
|
||||
if (!next[0]){
|
||||
next[0] = box.addDynamicRow();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
<button id="zotero-tb-openurl" label="&zotero.toolbar.openURL.label;" tooltiptext="&zotero.toolbar.openURL.tooltip;" flex="1" oncommand="ZoteroItemPane.onOpenURLClick();"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<menulist id="zotero-editpane-type-menu" oncommand="ZoteroItemPane.changeTypeTo(this.value)" flex="1">
|
||||
<menulist id="zotero-editpane-type-menu" oncommand="ZoteroItemPane.changeTypeTo(this.value)" flex="1"
|
||||
onkeypress="if (event.keyCode == event.DOM_VK_TAB){ if (!event.shiftKey) { ZoteroItemPane.focusFirstField('info'); event.preventDefault(); } }">
|
||||
<menupopup/>
|
||||
</menulist>
|
||||
</hbox>
|
||||
|
|
|
@ -153,7 +153,8 @@
|
|||
<toolbarbutton id="zotero-tb-note-add" tooltiptext="&zotero.toolbar.note.standalone;" oncommand="ZoteroPane.newNote(event.shiftKey);"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&zotero.toolbar.search.label;" control="zotero-tb-search"/>
|
||||
<textbox id="zotero-tb-search" type="timed" timeout="250" command="cmd_zotero_search" dir="reverse" onkeypress="if(event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); return false; } return true;">
|
||||
<textbox id="zotero-tb-search" type="timed" timeout="250" command="cmd_zotero_search" dir="reverse"
|
||||
onkeypress="if (event.keyCode == event.DOM_VK_ESCAPE) { this.value = ''; this.doCommand('cmd_zotero_search'); }">
|
||||
<toolbarbutton id="zotero-tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/>
|
||||
</textbox>
|
||||
</toolbar>
|
||||
|
@ -161,6 +162,7 @@
|
|||
id="zotero-items-tree" context="zotero-itemmenu"
|
||||
ondblclick="ZoteroPane.onDoubleClick(event, this);"
|
||||
enableColumnDrag="true"
|
||||
onfocus="if (!ZoteroPane.getItemsView().selection.count) { ZoteroPane.getItemsView().selection.select(0); }"
|
||||
onkeypress="if (event.keyCode == event.DOM_VK_BACK_SPACE || event.keyCode == event.DOM_VK_DELETE){ ZoteroPane.deleteSelectedItem(); event.preventDefault(); }"
|
||||
onselect="ZoteroPane.itemSelected();"
|
||||
ondraggesture="if (event.target.localName == 'treechildren') nsDragAndDrop.startDrag(event,ZoteroPane.getItemsView());"
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
/* Tag selector */
|
||||
|
||||
/* Don't focus filter textbox if pane isn't open */
|
||||
zoterotagselector[collapsed=true] tags-search
|
||||
{
|
||||
-moz-user-focus: ignore;
|
||||
}
|
||||
|
||||
groupbox
|
||||
{
|
||||
overflow: auto;
|
||||
|
@ -21,6 +27,7 @@ label
|
|||
{
|
||||
margin-right: 5px;
|
||||
padding: 2px 4px;
|
||||
-moz-user-focus: ignore;
|
||||
}
|
||||
|
||||
label[selected=true]
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
#zotero-editpane-dynamic-fields row label
|
||||
{
|
||||
-moz-user-focus: ignore;
|
||||
}
|
||||
|
||||
/* creator type menu */
|
||||
#zotero-editpane-dynamic-fields row > toolbarbutton
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ tagsbox row
|
|||
seealsobox
|
||||
{
|
||||
-moz-binding: url('chrome://zotero/content/bindings/relatedbox.xml#seealso-box');
|
||||
-moz-user-focus: ignore;
|
||||
}
|
||||
|
||||
zoterosearch
|
||||
|
|
Loading…
Reference in New Issue
Block a user