mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-14 12:34:08 +00:00
Update shadow tiddler handling to record source plugin tiddler
This commit is contained in:
parent
7b45c0bec8
commit
0d247cb752
11
boot/boot.js
11
boot/boot.js
@ -527,7 +527,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.shadowTiddlers = {}; // Hashmap of constituent tiddlers from plugins by title
|
this.shadowTiddlers = {}; // Hashmap by title of {source:, tiddler:}
|
||||||
};
|
};
|
||||||
|
|
||||||
$tw.Wiki.prototype.addTiddler = function(tiddler) {
|
$tw.Wiki.prototype.addTiddler = function(tiddler) {
|
||||||
@ -558,7 +558,10 @@ $tw.Wiki.prototype.unpackPluginTiddlers = function() {
|
|||||||
// Don't overwrite tiddlers that already exist
|
// Don't overwrite tiddlers that already exist
|
||||||
if(!$tw.utils.hop(self.shadowTiddlers,constituentTitle)) {
|
if(!$tw.utils.hop(self.shadowTiddlers,constituentTitle)) {
|
||||||
// Save the tiddler object
|
// 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() {
|
$tw.Wiki.prototype.definePluginModules = function() {
|
||||||
var self = this;
|
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);
|
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.hasField("module-type")) {
|
if(tiddler.hasField("module-type")) {
|
||||||
@ -610,7 +613,7 @@ $tw.Wiki.prototype.getTiddler = function(title) {
|
|||||||
if(t instanceof $tw.Tiddler) {
|
if(t instanceof $tw.Tiddler) {
|
||||||
return t;
|
return t;
|
||||||
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
|
} else if($tw.utils.hop(this.shadowTiddlers,title)) {
|
||||||
return this.shadowTiddlers[title];
|
return this.shadowTiddlers[title].tiddler;
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user