www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 8caecdf91aeb47b4118853bbe2c98bb314eda0d4
parent 9c0ad6517250d9fb38c20b4005acb5e398ed66d9
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  8 Aug 2009 14:30:18 +0000

Fix some errors in the tree during add/remove operations


Diffstat:
Mchrome/content/zotero/xpcom/collectionTreeView.js | 6++++++
Mchrome/content/zotero/xpcom/itemTreeView.js | 2+-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -281,6 +281,8 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids) var madeChanges = false; if (action == 'delete') { + var selectedIndex = this.selection.count ? this.selection.selectedIndex : 0; + //Since a delete involves shifting of rows, we have to do it in order //sort the ids by row @@ -324,6 +326,10 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids) this._refreshHashMap(); } + + if (!this.selection.count) { + this.selection.select(selectedIndex) + } } else if(action == 'move') { diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -310,7 +310,7 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) // Select the last item even if there are no changes (e.g. if the tag // selector is open and already refreshed the pane) - if (splitIDs.length > 0) { + if (splitIDs.length > 0 && (action == 'add' || action == 'modify')) { var selectItem = splitIDs[splitIDs.length - 1]; } }