On Tuesday, June 9, 2020 at 1:01:07 PM UTC-7, Geoff Tothill wrote:
>
> It works perfectly, but I have discovered a problem with my grand plan, 
> which I should have predicted.
> Many of the tags are repeated in the new tiddler, as they are transcluded, 
> and when one is clicked, all the others also produce drop downs of their 
> associated tiddler titles.
> Is there any way of stopping that behaviour on a per tiddler basis so that 
> the tags displayed by your filter code are not clickable.  Or even, at a 
> push, all tags globally are rendered non clickable?
>

There *is* a workaround that allows the tag popups to be displayed 
individually... but it's a subtle bit of a trick.  First... a little 
technical background info:

The tag pill popup is defined in the *$:/core/ui/TagTemplate* shadow 
tiddler, and uses this line to control when it is displayed
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" 
position="below" animate="yes" class="tc-drop-down">
Note the use of <<qualify ...>> in the $reveal state parameter.  The 
qualify macro (see https://tiddlywiki.com/#qualify%20Macro) *"returns a 
unique string that encodes its position within the widget tree, as 
identified by the stack of transcluded tiddlers that lead to that 
position."*  Thus, the result of the <<qualify>> macro returns the same 
value for all items shown in the same tiddler.  To force each tag pill 
occurrence gets a uniquely qualified state value, we need that value to be 
calculated from a different position on the "stack of transcluded 
tiddlers".  We can achieve this by splitting the tiddler content into two 
tiddlers so that we render the tag pill from a different tiddler.

Here's what you need to do:

1) Rewrite the previous version of the code like this:
<$list filter="[tag[... your tag here ...]]">
   __<$link />__<br>
   <$list filter="[<currentTiddler>tags[]]" variable="currentTag">
      {{||ShowTagPill}}
   </$list><br>
   <blockquote><$transclude mode="block"/></blockquote>
</$list>

Note how
<$macrocall $name="tag" tag=<<currentTag>> />
has been replaced with a transclusion of a separate "ShowTagPill" tiddler
{{||ShowTagPill}}

2) Define the "ShowTagPill" tiddler, containing just the previous $macrocall
<$macrocall $name="tag" tag=<<currentTag>> />

That's it.  Now, when the "tag" $macrocall is invoked, it will be from a 
different position in the transclusion stack, resulting in a different -- 
and unique <<qualify>> value for that tag pill.

The effect is that clicking on one tag pill will only open the popup for 
that instance of the tag pill, and will no longer open the popup for ALL 
occurrences of the same tag pill.

Hopefully, this explanation wasn't too confusing!...Give it a try and let 
me know how it goes.

enjoy,
-e


-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/98166f9d-2a23-4cfe-bea1-fe65ffb4ef6do%40googlegroups.com.

Reply via email to