1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-22 23:16:53 +00:00

Update shadow tiddler handling to record source plugin tiddler

This commit is contained in:
Jeremy Ruston 2013-04-03 13:23:26 +01:00
parent 7b45c0bec8
commit 0d247cb752

View File

@ -527,7 +527,7 @@ Construct a wiki store object
$tw.Wiki = function() {
this.tiddlers = {};
this.plugins = {}; // Hashmap of plugin information by title
this.shadowTiddlers = {}; // Hashmap of constituent tiddlers from plugins by title
this.shadowTiddlers = {}; // Hashmap by title of {source:, tiddler:}
};
$tw.Wiki.prototype.addTiddler = function(tiddler) {
@ -558,7 +558,10 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
// Don't overwrite tiddlers that already exist
if(!$tw.utils.hop(self.shadowTiddlers,constituentTitle)) {
// Save the tiddler object
self.shadowTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
self.shadowTiddlers[constituentTitle] = {
source: title,
tiddler: new $tw.Tiddler(constituentTiddler,{title: constituentTitle})
};
}
});
}
@ -594,7 +597,7 @@ Register all the module tiddlers that have a module type
*/
$tw.Wiki.prototype.definePluginModules = function() {
var self = this;
$tw.utils.each(this.shadowTiddlers,function(element,title,object) {
$tw.utils.each(this.shadowTiddlers,function(element,title) {
var tiddler = self.getTiddler(title);
if(!$tw.utils.hop(self.tiddlers,title)) { // Don't define the module if it is overidden by an ordinary tiddler
if(tiddler.hasField("module-type")) {
@ -610,7 +613,7 @@ $tw.Wiki.prototype.getTiddler = function(title) {
if(t instanceof $tw.Tiddler) {
return t;
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
return this.shadowTiddlers[title];
return this.shadowTiddlers[title].tiddler;
} else {
return undefined;
}