Hide stuff added by a custom template in folded mode

58 views
Skip to first unread message

jln

unread,
Apr 3, 2021, 9:36:39 AM4/3/21
to TiddlyWiki
Hi,

First of all, I want to thank the authors of TiddlyWiki and the whole community. I am a new user impressed by the tool, its simplicity and its power!

I have created a custom template that adds, at the top of the tiddler, a link to my Nextcloud platform if the "url-nxc" field is filled. This works very well, but the only small issue I have is that this link is still visible when the tiddler is folded.

How to resolve this problem?

Thanks a lot.

Eric Shulman

unread,
Apr 3, 2021, 9:41:54 AM4/3/21
to TiddlyWiki
On Saturday, April 3, 2021 at 6:36:39 AM UTC-7 jln wrote:
I have created a custom template that adds, at the top of the tiddler, a link to my Nextcloud platform if the "url-nxc" field is filled. This works very well, but the only small issue I have is that this link is still visible when the tiddler is folded.
How to resolve this problem?

wrap your custom template content within a $reveal that checks the value of <<folded-state>>, like this:

<$reveal tag="div" type="nomatch" stateTitle=<<folded-state>> text="hide">
... your content here ...
</$reveal>
 
Note: <<folded-state>> is defined in $:/core/ui/ViewTemplate, so it is automatically available to all templates tagged with $:/tags/ViewTemplate

enjoy,
-e

jln

unread,
Apr 3, 2021, 9:58:26 AM4/3/21
to TiddlyWiki
Thank you very much for this very quick and efficient response. It works perfectly!

Have a nice day!
Reply all
Reply to author
Forward
0 new messages