Auto collapse first Layer in toc-selective-expandable on startup?

237 views
Skip to first unread message

Daniel S.

unread,
Nov 12, 2017, 3:58:33 AM11/12/17
to TiddlyWiki
Hi guys, 

i would like to auto collapse all first layer branches of my toc-selective-expandable on startup. That means, instead of

> Layer 1 LinkA
> Layer 1 LinkB
> Layer 1 LinkC

i would like to have something like this when opening the tiddlywiki:

> Layer 1 LinkA
   > Layer 2 Link F
      Layer 2 Link G
> Layer 1 LinkB
   > Layer 2 ...
   > Layer 2 ...
   > Layer 2 ...
> Layer 1 Link C
      Layer 2 ...
      Layer 2 ...

Is that possible without hacking the toc-selective-expandable to much? Maybe even within the Layer 1 Tiddlers by setting a state to expanded or something like that?

Thank you in advance,

best regards.

TonyM

unread,
Nov 12, 2017, 5:40:02 PM11/12/17
to TiddlyWiki
Daniel,

Looks like you want the opposite to what you are asking, " auto expand "

I don't have an exact solution, but I have no need to ask this question because I use Tobias's https://tobibeer.github.io/tb5/#Taggly%20Tagging%20For%20TW5

regards
Tony

 

Eric Shulman

unread,
Nov 12, 2017, 6:30:25 PM11/12/17
to TiddlyWiki
You could use a <$list> widget to manually display the top level *outside* the toc-selective-expandable, and then use toc-selective-expandable for the inner levels.  Something like this:

<div class="tc-table-of-contents">
<$list filter="[tag[Layer1]]">
<$button class="tc-btn-invisible">{{$:/core/images/right-arrow}}</$button>
<$link>
<b><$text text=<<currentTiddler>>/></b></$link>
@@display:block;margin-left:1em; <$macrocall $name="toc-selective-expandable" tag=<
<currentTiddler>>/>@@
</$list>
</div>

The result is that you *always* display the top level ("Layer1") items opened, while the inner levels behave as usual for the TOC macro (i.e., default to 'closed', click to expand).

Note: I did *some* layout formatting and styling to make it look mostly like the TOC at the top level, but you will want to adjust the formatting/styles to suit your needs.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals
Reply all
Reply to author
Forward
0 new messages