mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-28 15:08:46 +00:00
Update transclude widget to flag events with the current field
This commit is contained in:
parent
7a080b7aac
commit
ab75dde048
@ -54,7 +54,8 @@ var TranscludeWidget = function(renderer) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TranscludeWidget.prototype.generate = function() {
|
TranscludeWidget.prototype.generate = function() {
|
||||||
var tr, templateParseTree, templateTiddler;
|
var self = this,
|
||||||
|
tr, templateParseTree, templateTiddler;
|
||||||
// Get the render target details
|
// Get the render target details
|
||||||
this.targetTitle = this.renderer.getAttribute("target",this.renderer.tiddlerTitle);
|
this.targetTitle = this.renderer.getAttribute("target",this.renderer.tiddlerTitle);
|
||||||
this.targetField = this.renderer.getAttribute("field");
|
this.targetField = this.renderer.getAttribute("field");
|
||||||
@ -107,8 +108,16 @@ TranscludeWidget.prototype.generate = function() {
|
|||||||
tiddlerTitle: this.targetTitle,
|
tiddlerTitle: this.targetTitle,
|
||||||
templateTitle: this.templateTitle
|
templateTitle: this.templateTitle
|
||||||
};
|
};
|
||||||
|
// If a current field is specified
|
||||||
if(this.currentField) {
|
if(this.currentField) {
|
||||||
|
// Record the current field in the render context
|
||||||
this.renderer.context.field = this.currentField;
|
this.renderer.context.field = this.currentField;
|
||||||
|
// Add an event handler to record the current field
|
||||||
|
var addCurrentField = function(event) {
|
||||||
|
event.currentField = self.currentField;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
this.events = [{name: "tw-remove-field", handlerFunction: addCurrentField}];
|
||||||
}
|
}
|
||||||
// Set the element
|
// Set the element
|
||||||
this.tag = this.renderer.parseTreeNode.isBlock ? "div" : "span";
|
this.tag = this.renderer.parseTreeNode.isBlock ? "div" : "span";
|
||||||
|
Loading…
Reference in New Issue
Block a user