1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Update the transclude widget to update parameters for remove tag message

This commit is contained in:
Jeremy Ruston 2013-06-09 19:27:15 +01:00
parent d4b6c05bc2
commit e4aa80b277

View File

@ -108,17 +108,23 @@ TranscludeWidget.prototype.generate = function() {
tiddlerTitle: this.targetTitle, tiddlerTitle: this.targetTitle,
templateTitle: this.templateTitle templateTitle: this.templateTitle
}; };
// Initialise events
this.events = [];
// If a current field is specified // If a current field is specified
if(this.currentField) { if(this.currentField) {
// Record the current field in the render context // 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 // Add an event handler to record the current field
var addCurrentField = function(event) { this.events.push({name: "tw-remove-field", handlerFunction: function(event) {
event.currentField = self.currentField; event.currentField = self.currentField;
return true; return true;
} }});
this.events = [{name: "tw-remove-field", handlerFunction: addCurrentField}];
} }
// Trap and update tag modification events
this.events.push({name: "tw-remove-tag", handlerFunction: function(event) {
event.currentTag = self.targetTitle;
return true;
}});
// Set the element // Set the element
this.tag = this.renderer.parseTreeNode.isBlock ? "div" : "span"; this.tag = this.renderer.parseTreeNode.isBlock ? "div" : "span";
this.attributes = {}; this.attributes = {};