mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-06 16:44:07 +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() {
|
$tw.Wiki = function() {
|
||||||
this.tiddlers = {};
|
this.tiddlers = {};
|
||||||
this.plugins = {}; // Hashmap of plugin information by title
|
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) {
|
$tw.Wiki.prototype.addTiddler = function(tiddler) {
|
||||||
@ -550,9 +550,9 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
|
|||||||
var constituentTiddler = pluginInfo.tiddlers[t],
|
var constituentTiddler = pluginInfo.tiddlers[t],
|
||||||
constituentTitle = pluginInfo.title + "/" + t;
|
constituentTitle = pluginInfo.title + "/" + t;
|
||||||
// Don't overwrite tiddlers that already exist
|
// 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
|
// 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() {
|
$tw.Wiki.prototype.definePluginModules = function() {
|
||||||
var self = this;
|
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);
|
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(!$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")) {
|
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];
|
var t = this.tiddlers[title];
|
||||||
if(t instanceof $tw.Tiddler) {
|
if(t instanceof $tw.Tiddler) {
|
||||||
return t;
|
return t;
|
||||||
} else if($tw.utils.hop(this.pluginTiddlers,title)) {
|
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
|
||||||
return this.pluginTiddlers[title];
|
return this.shadowTiddlers[title];
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user