yay! It worked!

And thanks for the explaination.

If you don't mind, I'll update the github issue with your explanation as 
well in case other are looking around as well

On Tuesday, June 9, 2020 at 2:33:26 PM UTC+2, Eric Shulman wrote:
>
> On Tuesday, June 9, 2020 at 5:20:10 AM UTC-7, Lars Solberg wrote:
>>
>> I am trying to create a shortcut to create a bunch of different 
>> journal-types. They will have different template-text, titles and so on.
>> Mostly, the title will contain a suffix coming from an <$edit-text, but 
>> they also a macro <<now>>.
>> Below is what I got so far, it works, but the text-box looses focus after 
>> a keypress. I think I am hitting the issue @ 
>> https://github.com/Jermolene/TiddlyWiki5/issues/341 (from 2014), but I'm 
>> not sure.
>> Anyone got any idea how to solve this? Or maybe there is a plugin around 
>> that does what I want instead?
>>
>
> Every keystroke in the $edit-text widget changes the value of 
> $:/state/new-journal-log-title,
> which triggers an automatic refresh of everything inside the <$set 
> name="titleSuffix" value={{$:/state/new-journal-log-title}}>
> This includes the $edit-text widget itself, which causes the input control 
> to lose focus after each keystroke.
>
> To fix this, simply move the $edit-text widget outside of the <$set>, like 
> this:
>  
>
>> \define journalLogButton()
>> <$button>
>> <$action-sendmessage
>>   $message="tm-new-tiddler"
>>   title=<<now "YYYY-0MM-0DD $(titleSuffix)$ ">>
>>   tags="Journal"
>>   journal-type="log"
>>   year=<<now "YYYY">>
>>   month=<<now "0MM">>
>>   day=<<now "0DD">>
>> />
>> New log
>> </$button>
>> \end
>>
>> <$edit-text tiddler="$:/state/new-journal-log-title" tag="input" 
>> default=""/>
>> <$set name="titleSuffix" value={{$:/state/new-journal-log-title}}>
>> <<journalLogButton>>
>> </$set>
>>
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ac05b50c-5db2-498f-9454-7a266e36b93bo%40googlegroups.com.

Reply via email to