From 07d4c9a63990f8a3750a667d54336cad3b6ba4a5 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 15 May 2013 22:15:57 +0100 Subject: [PATCH] A slightly better fix for the render context inheritance issue with the htmlwikified viewer for the view widget --- core/modules/rendertree/wikirendertree.js | 2 ++ core/modules/widgets/view/viewers/htmlwikified.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/modules/rendertree/wikirendertree.js b/core/modules/rendertree/wikirendertree.js index a2e38071a..73841a93a 100644 --- a/core/modules/rendertree/wikirendertree.js +++ b/core/modules/rendertree/wikirendertree.js @@ -19,6 +19,7 @@ Create a render tree object for a parse tree Options include: wiki: mandatory reference to wiki associated with this render tree context: optional hashmap of context variables (see below) + parentRenderer: optional reference to a parent renderer node for the context chain Context variables include: tiddlerTitle: title of the tiddler providing the context templateTitle: title of the tiddler providing the current template @@ -28,6 +29,7 @@ var WikiRenderTree = function(parser,options) { this.parser = parser; this.wiki = options.wiki; this.context = options.context || {}; + this.parentRenderer = options.parentRenderer; // Hashmap of the renderer classes if(!this.rendererClasses) { WikiRenderTree.prototype.rendererClasses = $tw.modules.applyMethods("wikirenderer"); diff --git a/core/modules/widgets/view/viewers/htmlwikified.js b/core/modules/widgets/view/viewers/htmlwikified.js index 845ef49c8..c7900ce42 100644 --- a/core/modules/widgets/view/viewers/htmlwikified.js +++ b/core/modules/widgets/view/viewers/htmlwikified.js @@ -23,7 +23,7 @@ HtmlWikifiedViewer.prototype.render = function() { // Parse the field text var wiki = this.viewWidget.renderer.renderTree.wiki, parser = wiki.parseText("text/vnd.tiddlywiki",this.value), - renderTree = new $tw.WikiRenderTree(parser,{wiki: wiki, context: this.viewWidget.renderer.renderTree.context}); + renderTree = new $tw.WikiRenderTree(parser,{wiki: wiki, parentRenderer: this.viewWidget.renderer}); renderTree.execute(); var text = renderTree.render("text/html"); // Set the element details