mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-08 06:43:49 +00:00
Fixed support for storyviewTiddler parameter for story macro
This commit is contained in:
parent
ca9b68a5d3
commit
b3c0bec838
@ -170,7 +170,14 @@ exports.executeMacro = function() {
|
|||||||
|
|
||||||
exports.postRenderInDom = function() {
|
exports.postRenderInDom = function() {
|
||||||
// Instantiate the story view
|
// Instantiate the story view
|
||||||
var StoryView = this.wiki.macros.story.viewers[this.params.storyview];
|
var storyviewName;
|
||||||
|
if(this.hasParameter("storyviewTiddler")) {
|
||||||
|
storyviewName = this.wiki.getTextReference(this.params.storyviewTiddler)
|
||||||
|
}
|
||||||
|
if(!storyviewName && this.hasParameter("storyview")) {
|
||||||
|
storyviewName = this.params.storyview;
|
||||||
|
}
|
||||||
|
var StoryView = this.wiki.macros.story.viewers[storyviewName];
|
||||||
if(StoryView) {
|
if(StoryView) {
|
||||||
this.storyview = new StoryView(this);
|
this.storyview = new StoryView(this);
|
||||||
}
|
}
|
||||||
@ -184,6 +191,20 @@ exports.postRenderInDom = function() {
|
|||||||
|
|
||||||
exports.refreshInDom = function(changes) {
|
exports.refreshInDom = function(changes) {
|
||||||
var t;
|
var t;
|
||||||
|
// 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)) {
|
||||||
|
// This logic should be reused from the base macro class, and not duplicated
|
||||||
|
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;
|
||||||
|
}
|
||||||
/*jslint browser: true */
|
/*jslint browser: true */
|
||||||
if(this.dependencies.hasChanged(changes,this.tiddlerTitle)) {
|
if(this.dependencies.hasChanged(changes,this.tiddlerTitle)) {
|
||||||
// Get the tiddlers we're supposed to be displaying
|
// Get the tiddlers we're supposed to be displaying
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
title: $:/templates/PageTemplate
|
title: $:/templates/PageTemplate
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<<story story:"$:/StoryTiddlers" storyview:scroller ><
|
<<story story:"$:/StoryTiddlers" storyviewTiddler:[[$:/CurrentView]] storyview:scroller ><
|
||||||
{{navigation-panel{
|
{{navigation-panel{
|
||||||
<<chooser><<<list all>>>>
|
<<chooser><<<list all>>>>
|
||||||
}}}
|
}}}
|
||||||
@ -17,7 +17,7 @@ title: $:/templates/PageTemplate
|
|||||||
*{{divider-vertical}}
|
*{{divider-vertical}}
|
||||||
|
|
||||||
{{pull-right btn btn-info{
|
{{pull-right btn btn-info{
|
||||||
<<button popup:ViewDropDownState><View<span class="caret"></span>>>
|
<<button popup:ViewDropDownState><View <span class="caret"></span>>>
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
}}}
|
}}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user