mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 11:00:27 +00:00
Extend the transclude widget to allow a currentField to be set
We set the current field as a context variable for the transcluded content
This commit is contained in:
parent
456d50b6ef
commit
d5b0a0fb68
@ -59,6 +59,7 @@ TranscludeWidget.prototype.generate = function() {
|
||||
this.targetTitle = this.renderer.getAttribute("target",this.renderer.tiddlerTitle);
|
||||
this.targetField = this.renderer.getAttribute("field");
|
||||
this.targetIndex = this.renderer.getAttribute("index");
|
||||
this.currentField = this.renderer.getAttribute("currentField");
|
||||
// Get the render tree for the template
|
||||
this.templateTitle = undefined;
|
||||
if(this.renderer.parseTreeNode.children && this.renderer.parseTreeNode.children.length > 0) {
|
||||
@ -106,6 +107,9 @@ TranscludeWidget.prototype.generate = function() {
|
||||
tiddlerTitle: this.targetTitle,
|
||||
templateTitle: this.templateTitle
|
||||
};
|
||||
if(this.currentField) {
|
||||
this.renderer.context.field = this.currentField;
|
||||
}
|
||||
// Set the element
|
||||
this.tag = this.renderer.parseTreeNode.isBlock ? "div" : "span";
|
||||
this.attributes = {};
|
||||
|
Loading…
Reference in New Issue
Block a user