Focus on edit after a tm-edit-tiddler message

50 views
Skip to first unread message

Cade Roux

unread,
Sep 3, 2019, 6:17:49 PM9/3/19
to TiddlyWiki
I have a set of macros that let me transclude a tiddler and offer a link next to the transcluded tiddler to edit it if it exists or a link button to create it if it's missing.

This is one of the relevant sub-macros for the Edit button:

\define edit-btn(title)
(<$button class="tc-btn-invisible tc-tiddlylink">
<$action-sendmessage $message="tm-edit-tiddler" $param="$title$"/>
Edit
</$button>)
\end

After the tm-edit-tiddler message, I want to set the focus on that draft tiddler that comes up so that the cursor is in the text field and not in the title field.

Any tips?

Thanks,

Cade

Cade Roux

unread,
Sep 10, 2019, 9:33:33 AM9/10/19
to TiddlyWiki
Bumping this up - is there any way to set the focus to the text instead of the title when you go into edit mode?

Thanks in advance,

Cade

Jeremy Ruston

unread,
Sep 10, 2019, 9:38:26 AM9/10/19
to tiddl...@googlegroups.com
Hi Cade

Bumping this up - is there any way to set the focus to the text instead of the title when you go into edit mode?

The mechanism by which the title gets the focus when a tiddler is edited is that the wikitext of the edittext widget includes the focus="true” attribute. So, as things stand, the only way to change that behaviour would be to overwrite that template to remove the focus attribute, and modify the body text tiddler to add a focus attribute.

You may be able to hack things with the new tm-focus-selector message...

Best wishes

Jeremy.


Thanks in advance,

Cade

On Tuesday, September 3, 2019 at 5:17:49 PM UTC-5, Cade Roux wrote:
I have a set of macros that let me transclude a tiddler and offer a link next to the transcluded tiddler to edit it if it exists or a link button to create it if it's missing.

This is one of the relevant sub-macros for the Edit button:

\define edit-btn(title)
(<$button class="tc-btn-invisible tc-tiddlylink">
<$action-sendmessage $message="tm-edit-tiddler" $param="$title$"/>
Edit
</$button>)
\end

After the tm-edit-tiddler message, I want to set the focus on that draft tiddler that comes up so that the cursor is in the text field and not in the title field.

Any tips?

Thanks,

Cade

-- 
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a714e54e-01ec-4376-b3f2-10c0232e7333%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages