mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-04 09:46:55 +00:00
Fixed slider to refresh child nodes correctly
This commit is contained in:
parent
525fd3631e
commit
106380b98a
@ -59,13 +59,19 @@ exports.macro = {
|
||||
return [content];
|
||||
},
|
||||
refresh: function(changes) {
|
||||
if(this.params.target && changes.hasOwnProperty(this.params.target) !== -1) {
|
||||
if(this.params.target && changes.hasOwnProperty(this.params.target)) {
|
||||
// If the target has changed, re-render the macro
|
||||
} else if (this.params.state && changes.hasOwnProperty(this.params.state) !== -1) {
|
||||
// If it was just the state tiddler that's changed, set the display appropriately
|
||||
var el = this.domNode.firstChild.firstChild.nextSibling,
|
||||
isOpen = this.store.getTiddlerText(this.params.state,"").trim() === "open";
|
||||
el.style.display = isOpen ? "block" : "none";
|
||||
} else {
|
||||
if (this.params.state && changes.hasOwnProperty(this.params.state)) {
|
||||
// If it was just the state tiddler that's changed, set the display appropriately
|
||||
var el = this.domNode.firstChild.firstChild.nextSibling,
|
||||
isOpen = this.store.getTiddlerText(this.params.state,"").trim() === "open";
|
||||
el.style.display = isOpen ? "block" : "none";
|
||||
}
|
||||
// Refresh any children
|
||||
for(var t=0; t<this.content.length; t++) {
|
||||
this.content[t].refreshInDom(changes);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -8,5 +8,5 @@ And here's another slider that is also keyed to JackSlider (<<slider JackSlider
|
||||
And here's another slider that contains a video, with the state stored in VideoSlider (currently <<tiddler VideoSlider>>):
|
||||
<<slider VideoSlider "VideoTests">>
|
||||
|
||||
And here's a slider that works with text, rather than a separate tiddler.
|
||||
And here's a MiniSlider that works with text, rather than a separate tiddler.
|
||||
<<slider state:MiniSlider label:"Click me!" content:"This is the //content// of the slider. The state is stored in MiniSlider">>
|
||||
|
Loading…
x
Reference in New Issue
Block a user