From e4aa80b277691cee02a7f87dd2aaac6039b91d9b Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sun, 9 Jun 2013 19:27:15 +0100 Subject: [PATCH] Update the transclude widget to update parameters for remove tag message --- core/modules/widgets/transclude.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/modules/widgets/transclude.js b/core/modules/widgets/transclude.js index 3b30a6c1c..478770508 100644 --- a/core/modules/widgets/transclude.js +++ b/core/modules/widgets/transclude.js @@ -108,17 +108,23 @@ TranscludeWidget.prototype.generate = function() { tiddlerTitle: this.targetTitle, templateTitle: this.templateTitle }; + // Initialise events + this.events = []; // If a current field is specified if(this.currentField) { // Record the current field in the render context this.renderer.context.field = this.currentField; // 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; 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 this.tag = this.renderer.parseTreeNode.isBlock ? "div" : "span"; this.attributes = {};