mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-10-02 08:50:46 +00:00
A better fix for refreshing nested macros
This commit is contained in:
parent
2282a825ec
commit
9d39e9a5f1
@ -54,12 +54,12 @@ exports.executeMacro = function() {
|
|||||||
if(value === undefined) {
|
if(value === undefined) {
|
||||||
return $tw.Tree.Text("");
|
return $tw.Tree.Text("");
|
||||||
} else {
|
} else {
|
||||||
var link = $tw.Tree.Element("span",{},[$tw.Tree.Macro("link",{
|
var link = $tw.Tree.Macro("link",{
|
||||||
srcParams: {to: value},
|
srcParams: {to: value},
|
||||||
content: [$tw.Tree.Text(value)],
|
content: [$tw.Tree.Text(value)],
|
||||||
isBlock: this.isBlock,
|
isBlock: this.isBlock,
|
||||||
wiki: this.wiki
|
wiki: this.wiki
|
||||||
})]);
|
});
|
||||||
link.execute(parents,this.tiddlerTitle);
|
link.execute(parents,this.tiddlerTitle);
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
@ -208,9 +208,13 @@ Macro.prototype.refreshInDom = function(changes) {
|
|||||||
if(this.dependencies.hasChanged(changes,this.tiddlerTitle)) {
|
if(this.dependencies.hasChanged(changes,this.tiddlerTitle)) {
|
||||||
// Re-execute the macro if so
|
// Re-execute the macro if so
|
||||||
// Macros can only auto-refresh if their immediate child is a DOM node
|
// Macros can only auto-refresh if their immediate child is a DOM node
|
||||||
var parentDomNode = this.child.domNode.parentNode,
|
var child = this.child;
|
||||||
insertBefore = this.child.domNode.nextSibling;
|
while(!child.domNode && child.child) {
|
||||||
parentDomNode.removeChild(this.child.domNode);
|
child = child.child;
|
||||||
|
}
|
||||||
|
var parentDomNode = child.domNode.parentNode,
|
||||||
|
insertBefore = child.domNode.nextSibling;
|
||||||
|
parentDomNode.removeChild(child.domNode);
|
||||||
this.execute(this.parents,this.tiddlerTitle);
|
this.execute(this.parents,this.tiddlerTitle);
|
||||||
this.renderInDom(parentDomNode,insertBefore);
|
this.renderInDom(parentDomNode,insertBefore);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user