Include tags on shadow tiddlers in tagging filter

Ensures that for system tiddlers the info panel "Tagging" tab correctly
shows the tagged tiddlers.

Final fix for #478
This commit is contained in:
Jermolene 2014-03-10 19:41:38 +00:00
parent 2608a323eb
commit 0d7c4ae6c7
1 changed files with 21 additions and 11 deletions

View File

@ -490,21 +490,31 @@ Get a hashmap by tag of arrays of tiddler titles
exports.getTagMap = function() {
var self = this;
return this.getGlobalCache("tagmap",function() {
var tags = {};
// Collect up all the tags
for(var title in self.tiddlers) {
var tiddler = self.tiddlers[title];
if(tiddler.fields.tags) {
for(var index=0; index<tiddler.fields.tags.length; index++) {
var tag = tiddler.fields.tags[index];
if($tw.utils.hop(tags,tag)) {
tags[tag].push(title)
} else {
tags[tag] = [title];
var tags = {},
storeTags = function(tagArray) {
if(tagArray) {
for(var index=0; index<tagArray.length; index++) {
var tag = tagArray[index];
if($tw.utils.hop(tags,tag)) {
tags[tag].push(title)
} else {
tags[tag] = [title];
}
}
}
},
title, tiddler;
// Collect up all the tags
for(title in self.shadowTiddlers) {
if(!$tw.utils.hop(self.tiddlers,title)) {
tiddler = self.shadowTiddlers[title].tiddler;
storeTags(tiddler.fields.tags);
}
}
for(title in self.tiddlers) {
tiddler = self.tiddlers[title];
storeTags(tiddler.fields.tags);
}
return tags;
});
};