1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-28 23:10:46 +00:00

Switched slider to use new syntax for inline content

This commit is contained in:
Jeremy Ruston 2012-06-06 11:29:10 +01:00
parent 11a563dfc6
commit 7c382c5f43
2 changed files with 7 additions and 8 deletions

View File

@ -47,8 +47,7 @@ exports.info = {
label: {byPos: 2, type: "text"}, label: {byPos: 2, type: "text"},
tooltip: {byPos: 3, type: "text"}, tooltip: {byPos: 3, type: "text"},
"default": {byName: true, type: "text"}, "default": {byName: true, type: "text"},
"class": {byName: true, type: "text"}, "class": {byName: true, type: "text"}
content: {byName: true, type: "text"}
}, },
events: ["click"] events: ["click"]
}; };
@ -76,15 +75,15 @@ exports.saveOpenState = function() {
}; };
exports.getSliderChildren = function() { exports.getSliderChildren = function() {
if(this.hasParameter("content")) { // Use the target tiddler if specified
return this.wiki.parseText("text/x-tiddlywiki",this.params.content).tree; if(this.hasParameter("target")) {
} else if(this.hasParameter("target")) {
return [$tw.Tree.Macro("tiddler",{ return [$tw.Tree.Macro("tiddler",{
srcParams: {target: this.params.target}, srcParams: {target: this.params.target},
wiki: this.wiki wiki: this.wiki
})]; })];
} else { } else {
return [$tw.Tree.errorNode("No content specified for slider")]; // Otherwise use the content of the macro
return this.content;
} }
}; };

View File

@ -15,8 +15,8 @@ And here's another slider that contains a video, with the state stored in VideoS
And here's a MiniSlider 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">> <<slider state:MiniSlider label:"Click me! »"><This is the //content// of the slider. The state is stored in MiniSlider>>
And here's a slider that doesn't use a state tiddler: And here's a slider that doesn't use a state tiddler:
<<slider label:"Click me! »" content:"This is the //content// of the slider. The state is not retained.">> <<slider label:"Click me! »"><This is the //content// of the slider. The state is not retained.>>