kookma / TW-TOC

Table of contents and hierarchical navigator with non-recursive and recursive macros
https://kookma.github.io/TW-TOC/
MIT License
3 stars 2 forks source link

Folder icon #3

Closed linonetwo closed 1 month ago

linonetwo commented 1 month ago

Thank you for making this plugin! I'm going to prebuild this into TidGi app as a folder solution. https://github.com/tiddly-gittly/itonnote-plugin/blob/master/src/itonnote-plugin/Sidebar/FolderMenu.tid

One thing I find different to core toc is the icon

截屏2024-07-31 16 33 09

    <$let toc-open-icon="$:/core/images/fold-button" toc-closed-icon="$:/core/images/folder">
        <div class="tc-table-of-contents">
            <$transclude $variable="toc-selective-expandable" tag={{$:/plugins/linonetwo/itonnote/Configs/SideBarFolderMenuBaseTitle}} />
        </div>
    </$let>

and when using your macro the icon does not change

    <$let toc-open-icon="$:/core/images/fold-button" toc-closed-icon="$:/core/images/folder">
        <div class="tc-table-of-contents">
            <$transclude $variable="toc-ui" tag={{$:/plugins/linonetwo/itonnote/Configs/SideBarFolderMenuBaseTitle}} />
        </div>
    </$let>
kookma commented 1 month ago

Please look at $:/plugins/kookma/toc/macros/multilevel-exapndable and find

\define toggle-branch()
<$reveal type="nomatch" stateTitle=<<tidToggleState>> stateIndex=<<path>> text="yes">
  <$button class="tc-btn-invisible" setTitle=<<tidToggleState>> setIndex=<<path>> setTo="yes">
   {{$:/core/images/right-arrow}}
  </$button>
 </$reveal>
 <$reveal type="match" stateTitle=<<tidToggleState>> stateIndex=<<path>> text="yes">
  <$button class="tc-btn-invisible" setTitle=<<tidToggleState>> setIndex=<<path>> >
   {{$:/core/images/down-arrow}}
  </$button>
 </$reveal>
\end 

You should be able to use any image you like.

kookma commented 1 month ago

NOTE, you do not need wrap the TOC macro <div class="tc-table-of-contents">

This work in demo page.

\import [all[tiddlers+shadows]tag[$:/tags/Macro/Toc]]

<$let toc-open-icon="$:/core/images/fold-button" toc-closed-icon="$:/core/images/folder">
   <<toc-ui tag:"root" exclude:"-[prefix[TidB]]" stateTiddler:"202002201122">>
</$let>

A new release is pushed.

linonetwo commented 1 month ago

Thanks, v1.6.2 works, just not updated on CPL.

Because https://kookma.github.io/TW-PluginLibrary/library/recipes/library/tiddlers/%2524%253A%252Fplugins%252Fkookma%252Ftoc.json is not updated yet, don't know why.

kookma commented 1 month ago

I will update Pluginlibarary too!