mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 17:40:29 +00:00
Refactor story macro to use reexecuteInDom()
This commit is contained in:
parent
cec60db30d
commit
5a3e2ce438
@ -231,16 +231,7 @@ exports.postRenderInDom = function() {
|
|||||||
exports.refreshInDom = function(changes) {
|
exports.refreshInDom = function(changes) {
|
||||||
// If the storyview has changed we'll have to completely re-execute the macro
|
// If the storyview has changed we'll have to completely re-execute the macro
|
||||||
if(this.hasParameter("storyviewTiddler") && $tw.utils.hop(changes,this.params.storyviewTiddler)) {
|
if(this.hasParameter("storyviewTiddler") && $tw.utils.hop(changes,this.params.storyviewTiddler)) {
|
||||||
// This logic should be reused from the base macro class, and not duplicated
|
this.reexecuteInDom();
|
||||||
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);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If the story tiddler has changed we need to sync the story elements
|
// If the story tiddler has changed we need to sync the story elements
|
||||||
|
Loading…
Reference in New Issue
Block a user