From 9eb58db5a3a56f9d1c752778a1fc82b11a8531f3 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 17 Dec 2006 23:28:21 +0000 Subject: [PATCH] Fix tabbing in tags pane (broken by last commit) and make ensureItemIsVisible() work for tags --- chrome/content/zotero/bindings/tagsbox.xml | 15 +++++++++++---- chrome/content/zotero/itemPane.js | 19 +++++++++++++++---- chrome/content/zotero/itemPane.xul | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/bindings/tagsbox.xml b/chrome/content/zotero/bindings/tagsbox.xml index e1c5d060a..b15742bce 100644 --- a/chrome/content/zotero/bindings/tagsbox.xml +++ b/chrome/content/zotero/bindings/tagsbox.xml @@ -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 @@ ]]> + + + + + - + @@ -261,7 +268,7 @@ - + \ No newline at end of file diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js index 3f2b64f6b..26e27a8c1 100644 --- a/chrome/content/zotero/itemPane.js +++ b/chrome/content/zotero/itemPane.js @@ -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(); } } diff --git a/chrome/content/zotero/itemPane.xul b/chrome/content/zotero/itemPane.xul index ac395db92..d3fc88f0c 100644 --- a/chrome/content/zotero/itemPane.xul +++ b/chrome/content/zotero/itemPane.xul @@ -97,7 +97,7 @@ - + \ No newline at end of file