From ed6348ee316d779172061c252acf2bd9fedc55c8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 5 Jan 2007 21:08:37 +0000 Subject: [PATCH] Fixes #481, Deleting tag with tag-selected item makes library seem to disappear Fixed some subtle tag issues, hopefully without causing new ones: 1) If no tags visible after a delete, deselect all 2) If a selected tag is deleted, deselect it 3) If a selected tag goes out of scope in Display All mode, deselect it (otherwise a tag stays selected after removing an item with that tag from the current collection) --- .../content/zotero/bindings/tagselector.xml | 67 ++++++++++++++++--- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index 54919e112..608f49b4d 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -37,6 +37,7 @@ false null null + null false @@ -108,7 +109,7 @@ @@ -219,6 +220,16 @@ else { //Zotero.debug(5); labels[i].setAttribute('inScope', false); + + // If out of scope, make sure it's not selected (otherwise a tag + // stays selected after removing an item with that tag from the + // current collection) + if (this.selection[labels[i].value]) { + labels[i].setAttribute('selected', false); + delete this.selection[labels[i].value]; + var doCommand = true; + } + } labels[i].setAttribute('hidden', false); @@ -226,21 +237,37 @@ } } + this.updateNumSelected(); + this._empty = empty; this.id('tags-toggle').setAttribute('collapsed', empty); this.id('no-tags-box').setAttribute('collapsed', !empty); + + if (doCommand) { + Zotero.debug('A selected tag went out of scope -- deselecting'); + this.doCommand(); + } ]]> - + + + + + + + @@ -309,7 +358,7 @@ delete this.selection[labels[i].value]; } - // Bubbles up to command + this.doCommand(); ]]> @@ -539,7 +588,7 @@ + oncommand="this.parentNode.parentNode.parentNode.parentNode.clearAll(); event.stopPropagation();"/>