1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 22:33:50 +00:00

restricted classic transclusion to type text/x-tiddlywiki

This commit is contained in:
buggyj 2014-09-02 08:02:21 +02:00
parent 7b8de4670c
commit e8b85a450d

View File

@ -82,6 +82,17 @@ TranscludeWidget.prototype.execute = function() {
this.makeChildWidgets([{type: "text", text: "Recursive transclusion error in transclude widget"}]);
return;
}
// Check for correct type
var existingTiddler = this.wiki.getTiddler(this.transcludeTitle);
// Check if we're dealing with a classic tiddler
if(existingTiddler && existingTiddler.hasField("type") && existingTiddler.fields.type !== "text/x-tiddlywiki") {
this.makeChildWidgets([{type: "text", text: "Tiddler not of type 'text/x-tiddlywiki'"}]);
return;
}
if(existingTiddler && !existingTiddler.hasField("type")) {
this.makeChildWidgets([{type: "text", text: "Tiddler not of type 'text/x-tiddlywiki'"}]);
return;
}
// Set context variables for recursion detection
this.setVariable("transclusion",recursionMarker);
// Parse