1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-04 23:39:57 +00:00

add a tooltip and make caption the default fallback

This commit is contained in:
pmario 2024-05-12 18:13:54 +02:00
parent 546016d5cb
commit 04ea2dd076

View File

@ -18,13 +18,17 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc
\whitespace trim \whitespace trim
\procedure toc-defaultItemTemplate() \procedure toc-defaultItemTemplate()
<span class="tc-toc-caption tc-tiny-gap-left" title={{!!tooltip}}> <span class="tc-toc-caption tc-tiny-gap-left" title={{{ [{!!toc-tooltip}!is[blank]] :else[<currentTiddler>] }}}>
<$let tv-wikilinks="no"> <$let tv-wikilinks="no">
<$transclude $tiddler={{{ [<itemTemplate>!is[blank]then<itemTemplate>else<currentTiddler>] }}} <$transclude $tiddler={{{ [<itemTemplate>!is[blank]then<itemTemplate>else<currentTiddler>] }}}
$field={{{ [<itemTemplate>!is[blank]then[text]] :else[<captionField>!is[blank]then<captionField>else[caption]] }}} $field={{{ [<itemTemplate>!is[blank]then[text]]
:else[<captionField>!is[blank]then<captionField>] }}}
> >
<$transclude $field={{{ [{!!caption}!is[blank]then[caption]else[title]] }}}>
<$view field="title"/> <$view field="title"/>
</$transclude> </$transclude>
</$transclude>
<$log/>
</$let> </$let>
</span> </span>
\end \end
@ -190,14 +194,16 @@ v5.3.4 itemClassFilter has been replaced by tf.toc-itemClassFilter see: tf.toc-i
--> -->
\procedure toc-item(isUnlinked:"") \procedure toc-item(isUnlinked:"")
<% if [<toc-state>get[text]else[close]match[close]] %> <% if [<toc-state>get[text]else[close]match[close]] %>
<$button actions=<<toc-openBranch>> setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible" tooltip=<<toc-state>>> <!-- <$button actions=<<toc-openBranch>> setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible" tooltip=<<toc-state>>> -->
<$button actions=<<toc-openBranch>> setTitle=<<toc-state>> setTo="open" class="tc-btn-invisible">
<$transclude tiddler=<<toc-closed-icon>> /> <$transclude tiddler=<<toc-closed-icon>> />
<% if [<isUnlinked>match[yes]] %> <% if [<isUnlinked>match[yes]] %>
<<_itemTemplate>> <<_itemTemplate>>
<% endif %> <% endif %>
</$button> </$button>
<% elseif [<toc-state>get[text]match[open]] %> <% elseif [<toc-state>get[text]match[open]] %>
<$button actions=<<toc-closeBranch>> setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible" tooltip=<<toc-state>>> <!-- <$button actions=<<toc-closeBranch>> setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible" tooltip=<<toc-state>>> -->
<$button actions=<<toc-closeBranch>> setTitle=<<toc-state>> setTo="close" class="tc-btn-invisible">
<$transclude tiddler=<<toc-open-icon>> /> <$transclude tiddler=<<toc-open-icon>> />
<% if [<isUnlinked>match[yes]] %> <% if [<isUnlinked>match[yes]] %>
<<_itemTemplate>> <<_itemTemplate>>
@ -287,7 +293,7 @@ Shows an expandable toc. Item always have an open/close chevron
<% if [subfilter<tf.toc-hasChildren>] [subfilter<tf.toc-curTidInclude>] -[<currentTiddler>] -[subfilter<exclude>] +[limit[1]] %> <% if [subfilter<tf.toc-hasChildren>] [subfilter<tf.toc-curTidInclude>] -[<currentTiddler>] -[subfilter<exclude>] +[limit[1]] %>
<<toc-item>> <<toc-item>>
<% else %> <% else %>
<$button class='tc-btn-invisible'> <$button class='tc-btn-invisible' tabindex="-1">
{{$:/core/images/blank}} {{$:/core/images/blank}}
</$button> </$button>
<% endif %> <% endif %>