diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index b2af3340fe..75d11bd66d 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -100,21 +100,13 @@ - false - null - + null + =0; i--) { + let name = colorTags[positions[i]]; + let ids = Zotero.Tags.getIDs(name, self.libraryID); + orderedTags.unshift({ + id: ids ? ids.join('-') : null, + name: name, + type: 0, + hasColor: true + }); + } + var lastTag; for (let i=0; i=0; i--) { - tagsToggleBox.insertBefore(colorTags[positions[i]], tagsToggleBox.firstChild); - } - //start tag cloud code var tagCloud = Zotero.Prefs.get('tagCloud'); @@ -524,7 +556,12 @@ // This could be more optimized to insert new/changed tags at the appropriate // spot if we cared, but we probably don't var t = me.id('tags-search').inputField; - me.setFilterTags(Zotero.Tags.search(t.value), true); + if (t.value) { + me.setSearch(t.value, true); + } + else { + me.setSearch(false, true); + } me._dirty = true; me.doCommand(); @@ -598,7 +635,7 @@ if (typeof clear != 'undefined') { if (clear){ t.value = ''; - this.setFilterTags(false); + this.setSearch(); return false; } else { @@ -606,7 +643,12 @@ } } - this.setFilterTags(Zotero.Tags.search(t.value)); + if (t.value) { + this.setSearch(t.value); + } + else { + this.setSearch(); + } return true; ]]> @@ -647,16 +689,9 @@ - + - + @@ -765,10 +835,12 @@ } var label = document.createElement('label'); - label.className = 'zotero-clicky'; label.setAttribute('value', tagName); - label.setAttribute('tagID', tagID); + // Not used for color tags + if (tagID) { + label.setAttribute('tagID', tagID); + } label.setAttribute('tagType', tagType); if (editable) { label.setAttribute('context', 'tag-menu'); @@ -780,14 +852,12 @@ - + - - - + + + diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js index 57dcb05869..a8b8949cc8 100644 --- a/chrome/content/zotero/xpcom/data/tags.js +++ b/chrome/content/zotero/xpcom/data/tags.js @@ -470,13 +470,6 @@ Zotero.Tags = new function() { tagColors = tagColors || []; - // Remove colors for tags that don't exist - tagColors = tagColors.filter(function (val) { - var tagIDs = self.getIDs(val.name, libraryID); - // TEMP: handle future getIDs return format change - return tagIDs && tagIDs.length; - }); - _libraryColors[libraryID] = tagColors; _libraryColorsByName[libraryID] = {}; @@ -510,13 +503,6 @@ Zotero.Tags = new function() { var tagColors = _libraryColors[libraryID]; var tagIDs = self.getIDs(name, libraryID); - // Just to be safe, remove colors for tags that don't exist - tagColors = tagColors.filter(function (val) { - let tagIDs = self.getIDs(val.name, libraryID); - // TEMP: handle future getIDs return format change - return tagIDs && tagIDs.length; - }); - // Unset if (!color) { // Trying to clear color on tag that doesn't have one @@ -835,14 +821,29 @@ Zotero.Tags = new function() { function erase(ids) { ids = Zotero.flattenArguments(ids); + var deleted = []; + Zotero.DB.beginTransaction(); for each(var id in ids) { var tag = this.get(id); if (tag) { + deleted.push({ + libraryID: tag.libraryID ? parseInt(tag.libraryID) : 0, + name: tag.name + }); tag.erase(); } } Zotero.DB.commitTransaction(); + + // Also delete tag color setting + // + // Note that this isn't done in purge(), so the setting will not + // be removed if the tag is just removed from all items without + // without being explicitly deleted. + for (var i in deleted) { + this.setColor(deleted[i].libraryID, deleted[i].name, false); + } } diff --git a/chrome/skin/default/zotero/bindings/tagselector.css b/chrome/skin/default/zotero/bindings/tagselector.css index 22b0659ff1..fd0f86aad1 100644 --- a/chrome/skin/default/zotero/bindings/tagselector.css +++ b/chrome/skin/default/zotero/bindings/tagselector.css @@ -28,16 +28,14 @@ checkbox } /* Visible out-of-scope tags should be grey */ -#tags-toggle label[inScope="false"] +#tags-toggle label[inScope=false]:not([hasColor=true]) { color: #666 !important; } -/* Don't display clicky effect to out-of-scope icons */ -label.zotero-clicky[inScope="false"]:hover, -label.zotero-clicky[inScope="false"]:active +#tags-toggle label[inScope=false][hasColor=true] { - background: inherit !important; + opacity: .6; } #tags-toggle label[draggedOver="true"]