Fix tabbing in tags pane (broken by last commit) and make ensureItemIsVisible() work for tags

This commit is contained in:
Dan Stillman 2006-12-17 23:28:21 +00:00
parent 4ff95b1715
commit 9eb58db5a3
3 changed files with 27 additions and 9 deletions

View File

@ -102,7 +102,7 @@
if (this.id('tagRows').lastChild)
{
tabindex = parseInt(this.id('tagRows').lastChild.
firstChild.nextSibling.getAttribute('tabindex')) + 1;
firstChild.nextSibling.getAttribute('ztabindex')) + 1;
}
else {
tabindex = 1;
@ -121,7 +121,7 @@
remove.setAttribute('class','zotero-clicky');
if (id)
{
remove.setAttribute('tabindex', -1);
remove.setAttribute('ztabindex', -1);
remove.setAttribute('onclick',"this.parentNode.parentNode.parentNode.parentNode.parentNode.remove('"+id+"');");
}
else
@ -246,9 +246,16 @@
]]>
</body>
</method>
<method name="getScrollBox">
<body>
<![CDATA[
return document.getAnonymousNodes(this)[0];
]]>
</body>
</method>
</implementation>
<content>
<xul:vbox xbl:inherits="flex">
<xul:scrollbox xbl:inherits="flex" orient="vertical" style="overflow:auto">
<xul:hbox align="center">
<xul:label id="tagsNum"/>
<xul:button label="&zotero.item.add;" oncommand="this.parentNode.parentNode.parentNode.new();"/>
@ -261,7 +268,7 @@
</xul:columns>
<xul:rows id="tagRows"/>
</xul:grid>
</xul:vbox>
</xul:scrollbox>
</content>
</binding>
</bindings>

View File

@ -35,6 +35,7 @@ var ZoteroItemPane = new function()
var _loaded;
var _itemBeingEdited;
var _activeScrollbox;
var _lastTabIndex;
var _tabDirection;
@ -165,6 +166,8 @@ var ZoteroItemPane = new function()
// Info pane
if(index == 0)
{
_activeScrollbox = document.getElementById('zotero-info');
// Enable/disable "View =>" button
testView: try
{
@ -400,6 +403,7 @@ var ZoteroItemPane = new function()
// Tags pane
else if(index == 3)
{
_activeScrollbox = document.getElementById('zotero-editpane-tags').getScrollBox();
var focusMode = 'tags';
var focusBox = _tagsBox;
_tagsBox.item = _itemBeingEdited;
@ -421,14 +425,20 @@ var ZoteroItemPane = new function()
function scrollToTop() {
var sbo = document.getElementById('zotero-info').boxObject;
if (!_activeScrollbox) {
return;
}
var sbo = _activeScrollbox.boxObject;
sbo.QueryInterface(Components.interfaces.nsIScrollBoxObject);
sbo.scrollTo(0,0);
}
function ensureElementIsVisible(elem) {
var sbo = document.getElementById('zotero-info').boxObject;
if (!_activeScrollbox) {
return;
}
var sbo = _activeScrollbox.boxObject;
sbo.QueryInterface(Components.interfaces.nsIScrollBoxObject);
sbo.ensureElementIsVisible(elem);
}
@ -1189,8 +1199,9 @@ var ZoteroItemPane = new function()
}
_focusNextField(focusMode, focusBox, _lastTabIndex, _tabDirection==-1);
}
// If not tab, return focus to items pane
else {
// If not tab and not new tag, return focus to items pane
// DEBUG: is this the best place for this?
else if (focusMode != 'tags') {
document.getElementById('zotero-items-tree').focus();
}
}

View File

@ -97,7 +97,7 @@
<rows id="zotero-editpane-dynamic-attachments" flex="1"/>
</grid>
</vbox>
<tagsbox id="zotero-editpane-tags" flex="1" style="overflow:auto"/>
<tagsbox id="zotero-editpane-tags" flex="1"/>
<seealsobox id="zotero-editpane-related" flex="1"/>
</deck>
</overlay>