How to focus the cursor after pasted text

Hi everyone, I hope you are having a great weekend.

I have an editor toolbar button with this:

<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="replace-selection"
	text={{{ [{$:/.giffmex/Current.source.text!!title}get[text]]  }}}
/>

But when it pastes the text from the tiddler, the text gets selected. Is there a way to have it paste and then focus the cursor right after the pasted content?

It looks like the new focus-editor parameter might for this, but there is no documentation yet, so I don’t know what to put into it.

no one loves me. :slight_smile: and it looks like I need to add more text to send this.

1 Like

Hi Dave, we all love you but I am also stuck with a similar problem…

1 Like

Mee too @DaveGifford , I remember asking about this before but don’t think it was possible at the time, need the widget itself to be extended by a developer I think. I would love to be proven wrong though.

What is the “similar problem”?

As stobot wrote, it’s not possible atm. … We would need to add a new parameter to the replace-selection editor-action.

But you can try this:

<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="wrap-selection"
	prefix={{{ [{$:/.giffmex/Current.source.text!!title}get[text]]  }}}
	suffix=""
/>

IMO it’s not a 100% fit, because if you have an active selection when you click the button there will still be a selection. … But if you have no active selection it will just add the text.

2 Likes

Thank you Mario! That worked great! My use case does not involve any selection, so it just pastes it. Perfect! World domination is now within my grasp! mwah hahahahaha! Thanks again!

Dave what is this?

If $:/.giffmex/Current.source.text is a tiddler, for getting the text is not enough to just use something like below:

{{$:/.giffmex/Current.source.text}}

If so, then the below code

<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="wrap-selection"
	prefix={{{ [{$:/.giffmex/Current.source.text!!title}get[text]]  }}}
	suffix=""
/>

can be written as:

<$action-sendmessage
	$message="tm-edit-text-operation"
	$param="wrap-selection"
	prefix={{$:/.giffmex/Current.source.text}}
	suffix=""
/>

Hi Mario,

With all the tricks I used the cursor lands 2mm below and behind the inputfield so that the keyboard-navigation won’t work.

Hi Mohammad

The get[text] snippet you asked about was a leftover from when I had a macro add prefix and suffix to it. That’s why it looks that way. But it gets the job done. Thanks for pointing out the shorter version.

Ah, OK. I don’t have an idea about this one. sorry.