- Color tags in right pane
- Update colors in tag selector and tags box in all windows on update
This commit is contained in:
parent
c6c33099de
commit
faf478e386
|
@ -32,6 +32,7 @@
|
|||
<binding id="tags-box">
|
||||
<implementation>
|
||||
<field name="clickHandler"/>
|
||||
<field name="_tagColors"/>
|
||||
|
||||
<!-- Modes are predefined settings groups for particular tasks -->
|
||||
<field name="_mode">"view"</field>
|
||||
|
@ -120,6 +121,7 @@
|
|||
rows.removeChild(rows.firstChild);
|
||||
|
||||
var tags = this.item.getTags();
|
||||
this._tagColors = Zotero.Tags.getColors();
|
||||
|
||||
if(tags)
|
||||
{
|
||||
|
@ -255,6 +257,11 @@
|
|||
valueElement.appendChild(document.createTextNode(valueText));
|
||||
}
|
||||
|
||||
// Tag color
|
||||
if (color = this._tagColors[valueText]) {
|
||||
valueElement.setAttribute('style', 'color:' + this._tagColors[valueText]);
|
||||
}
|
||||
|
||||
return valueElement;
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -712,7 +712,25 @@
|
|||
tagIDs = tagIDs.split('-');
|
||||
var name = Zotero.Tags.getName(tagIDs[0]);
|
||||
Zotero.Tags.setColor(name, color);
|
||||
this.refresh();
|
||||
|
||||
// Iterate through all windows, updating tag selector and tags box
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var enumerator = wm.getEnumerator("navigator:browser");
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var win = enumerator.getNext();
|
||||
if (!win.ZoteroPane) continue;
|
||||
|
||||
var tagSelector = win.ZoteroPane.document.getElementById('zotero-tag-selector');
|
||||
var itemPane = win.ZoteroPane.document.getElementById('zotero-view-item');
|
||||
|
||||
tagSelector.refresh();
|
||||
|
||||
if (itemPane.selectedPanel.firstChild.getAttribute('id') == 'zotero-editpane-tags') {
|
||||
var tagsBox = win.ZoteroPane.document.getElementById('zotero-editpane-tags');
|
||||
tagsBox.reload();
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
|
|
@ -446,7 +446,7 @@ Zotero.Tags = new function() {
|
|||
tagColors = JSON.stringify(tagColors);
|
||||
Zotero.Prefs.set('tagColors', tagColors);
|
||||
|
||||
_reloadTagColors()
|
||||
_reloadTagColors();
|
||||
Zotero.Notifier.trigger('redraw', 'item', []);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user