diff --git a/core/modules/macros/view.js b/core/modules/macros/view.js index a23e370ab..4736d3483 100644 --- a/core/modules/macros/view.js +++ b/core/modules/macros/view.js @@ -54,12 +54,12 @@ exports.executeMacro = function() { if(value === undefined) { return $tw.Tree.Text(""); } else { - var link = $tw.Tree.Element("span",{},[$tw.Tree.Macro("link",{ + var link = $tw.Tree.Macro("link",{ srcParams: {to: value}, content: [$tw.Tree.Text(value)], isBlock: this.isBlock, wiki: this.wiki - })]); + }); link.execute(parents,this.tiddlerTitle); return link; } diff --git a/core/modules/treenodes/macro.js b/core/modules/treenodes/macro.js index 4779838ea..03340af79 100644 --- a/core/modules/treenodes/macro.js +++ b/core/modules/treenodes/macro.js @@ -208,9 +208,13 @@ Macro.prototype.refreshInDom = function(changes) { if(this.dependencies.hasChanged(changes,this.tiddlerTitle)) { // Re-execute the macro if so // Macros can only auto-refresh if their immediate child is a DOM node - var parentDomNode = this.child.domNode.parentNode, - insertBefore = this.child.domNode.nextSibling; - parentDomNode.removeChild(this.child.domNode); + var child = this.child; + while(!child.domNode && child.child) { + child = child.child; + } + var parentDomNode = child.domNode.parentNode, + insertBefore = child.domNode.nextSibling; + parentDomNode.removeChild(child.domNode); this.execute(this.parents,this.tiddlerTitle); this.renderInDom(parentDomNode,insertBefore); } else {