mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 02:50:27 +00:00
Start using term shadow tiddlers for tiddlers from plugins
This commit is contained in:
parent
2479e38155
commit
d7b000fd6b
12
core/boot.js
12
core/boot.js
@ -519,7 +519,7 @@ Construct a wiki store object
|
||||
$tw.Wiki = function() {
|
||||
this.tiddlers = {};
|
||||
this.plugins = {}; // Hashmap of plugin information by title
|
||||
this.pluginTiddlers = {}; // Hashmap of constituent tiddlers from plugins by title
|
||||
this.shadowTiddlers = {}; // Hashmap of constituent tiddlers from plugins by title
|
||||
};
|
||||
|
||||
$tw.Wiki.prototype.addTiddler = function(tiddler) {
|
||||
@ -550,9 +550,9 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
|
||||
var constituentTiddler = pluginInfo.tiddlers[t],
|
||||
constituentTitle = pluginInfo.title + "/" + t;
|
||||
// Don't overwrite tiddlers that already exist
|
||||
if(!$tw.utils.hop(self.pluginTiddlers,constituentTitle)) {
|
||||
if(!$tw.utils.hop(self.shadowTiddlers,constituentTitle)) {
|
||||
// Save the tiddler object
|
||||
self.pluginTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
|
||||
self.shadowTiddlers[constituentTitle] = new $tw.Tiddler(constituentTiddler,{title: constituentTitle});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -588,7 +588,7 @@ Register all the module tiddlers that have a module type
|
||||
*/
|
||||
$tw.Wiki.prototype.definePluginModules = function() {
|
||||
var self = this;
|
||||
$tw.utils.each(this.pluginTiddlers,function(element,title,object) {
|
||||
$tw.utils.each(this.shadowTiddlers,function(element,title,object) {
|
||||
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.fields.type === "application/javascript" && tiddler.hasField("module-type")) {
|
||||
@ -603,8 +603,8 @@ $tw.Wiki.prototype.getTiddler = function(title) {
|
||||
var t = this.tiddlers[title];
|
||||
if(t instanceof $tw.Tiddler) {
|
||||
return t;
|
||||
} else if($tw.utils.hop(this.pluginTiddlers,title)) {
|
||||
return this.pluginTiddlers[title];
|
||||
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
|
||||
return this.shadowTiddlers[title];
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user