Hi Riz
> \define step1()
> <$action-setfield $tiddler="$:/state/title" sharetitle={{!!title}}/>
> \end
> \define step2()
> <$tiddler tiddler={{$:/state/title!!sharetitle}}>
> <$wikify name=content text=<<renderContent>>>
> <$action-setfield $tiddler="$:/state/content" text=<<content>>/>
> </$wikify>
> </$tiddler>
> \end
>
> <$button popup=<<qualify $:/state/Social>> class="tc-btn-invisible">
> <<step1>>
> <<step2>>
> {{$:/core/images/globe}}</$button>
>
> Here, despite the fact that <<step1>> is called first, the <<step2>> is
> executed first. Why?
The issue here is a subtle problem with the way that action widgets are
triggered. The action in step1 changes the value of a tiddler that is
referenced within step2. The action widgets within the button widget are
invoked sequentially, but there is no refresh cycle in between. That means that
even after the first action-setfield in step1, the compiled code for step 2
will still reference the previous value for the tiddler.
Here’s a snippet that shows an alternative approach that seems to work for
Twitter. Rather than creating a button, we create a link — so this would be
suitable for inclusion within your existing dropdown.
<$wikify name="tweet-text" text={{!!text}} type="formattedtext">
<a href={{{
[<tweet-text>encodeuri[]addprefix[https://twitter.com/intent/tweet?text=]] }}}
target="_blank" rel="noopener noreferrer">
Tweet this!
</a>
</$wikify>
A couple of points to note:
* The “formattedtext” output type for the wikify widget attempts to create
ASCII formatted output (eg inserting asterisks for bullet lists)
* The new triple brace syntax for a transcluded filtered attribute allows us to
calculate the URL in one go. We could add other elements with the addsuffix
operator too
* Including the above code in the tiddler to be output will cause an error
Best wishes
Jeremy.
>
>
>
> --
> 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 [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/tiddlywiki
> <https://groups.google.com/group/tiddlywiki>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/71146e3a-8791-42e6-9d4b-c6acc1315ae3%40googlegroups.com
>
> <https://groups.google.com/d/msgid/tiddlywiki/71146e3a-8791-42e6-9d4b-c6acc1315ae3%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/7C5F5561-7B5B-4430-BA4B-2745B7FE3C5D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.