1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-18 15:54:50 +00:00

A slightly better fix for the render context inheritance issue with the htmlwikified viewer for the view widget

This commit is contained in:
Jeremy Ruston 2013-05-15 22:15:57 +01:00
parent 98986ba9cc
commit 07d4c9a639
2 changed files with 3 additions and 1 deletions

View File

@ -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");

View File

@ -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