kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Introduce a PageMacros tiddler containing a tabs macro
This is a hacky way of having macro definitions that behave as if they are global to the wiki. The new tabs macro itself is cool, though: neatly encapsulates most of the gubbins around a tab control, and the rendering is quite easy to style.print-window-tiddler
rodzic
e42548997e
commit
63243c5855
|
@ -102,8 +102,8 @@ exports.startup = function() {
|
|||
$tw.rootWidget.addEventListener("tw-clear-password",function(event) {
|
||||
$tw.crypto.setPassword(null);
|
||||
});
|
||||
// Display the PageTemplate
|
||||
var templateTitle = "$:/core/ui/PageTemplate",
|
||||
// Display the PageMacros, which includes the PageTemplate
|
||||
var templateTitle = "$:/core/ui/PageMacros",
|
||||
parser = $tw.wiki.new_parseTiddler(templateTitle);
|
||||
$tw.pageWidgetNode = $tw.wiki.makeWidget(parser,{document: document, parentWidget: $tw.rootWidget});
|
||||
$tw.pageContainer = document.createElement("div");
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
title: $:/core/ui/PageMacros
|
||||
|
||||
\define tabs(tabsList,default,state:"$:/currentTab")
|
||||
<div class="tw-tab-buttons"><$list filter="$tabsList$" variable="currentTab"><$button set=<<qualify "$state$">> setTo=<<currentTab>> default="$default$" selectedClass="tw-tab-selected"><$macrocall $name="currentTab" $type="text/plain" $output="text/plain"/> </$button>
|
||||
</$list>
|
||||
</div>
|
||||
<div class="tw-tab-divider">
|
||||
</div>
|
||||
<div class="tw-tab-content">
|
||||
<$list filter="$tabsList$" variable="currentTab">
|
||||
<$reveal type="match" state=<<qualify "$state$">> text=<<currentTab>> default="$default$">
|
||||
<$transclude tiddler=<<currentTab>>/>
|
||||
</$reveal>
|
||||
</$list>
|
||||
</div>
|
||||
\end
|
||||
{{$:/core/ui/PageTemplate}}
|
|
@ -1,3 +1,3 @@
|
|||
title: $:/state/moreSideBarTabSet-{$:/core/ui/MoreSideBar|$:/core/ui/MoreSideBar||}{$:/core/ui/SideBar|$:/core/ui/SideBar||}
|
||||
title: $:/state/moreSideBarTabSet-{$:/core/ui/MoreSideBar|$:/core/ui/MoreSideBar||}{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}
|
||||
|
||||
tagsTab
|
|
@ -1,3 +1,3 @@
|
|||
title: $:/state/sideBarTabSet-{$:/core/ui/SideBar|$:/core/ui/SideBar||}
|
||||
title: $:/state/sideBarTabSet-{$:/core/ui/SideBar|$:/core/ui/SideBar||}{$:/core/ui/PageTemplate|$:/core/ui/PageTemplate||}
|
||||
|
||||
openTab
|
|
@ -0,0 +1,8 @@
|
|||
title: TabsExample
|
||||
tags: samples
|
||||
|
||||
Here is an example of the tabs macro:
|
||||
|
||||
<<tabs "Docs WikiText Features RoadMap" "WikiText" 1>>
|
||||
|
||||
<<tabs "[tag[tips]]" "GoogleChromeTips" 2>>
|
Ładowanie…
Reference in New Issue