Page 1 of 1

How to get Caret Position?

PostPosted: Fri Feb 02, 2024 2:12 am
by john1598360627
CARET POSITION
Prior to NG Client, text fields had a 'Caret Position' value.

Previously, was using an algorithm that used the Caret Position to insert special text tags within a textfield by using this Caret Position value.

However, within NG Client, there seems to be no reference to the Caret Position.

There is a CSSPosition, but I'm pretty sure that's just the position of the element on the page and not related to the Caret Position.

HELP
How do I get the Caret Position of a text field, like the HTML Area? Does the CSS Position have something to do with it?

Re: How to get Caret Position?

PostPosted: Fri Feb 02, 2024 2:01 pm
by mboegem
Hi,

in 2023.12 I have this function in the html area api
Code: Select all
replaceSelectedText(s)
Replaces the selected text; if no text has been selected, the replaced value will be inserted at the last cursor position.


According to the description that will do what you need.

Hope that helps

Re: How to get Caret Position?

PostPosted: Sat Feb 03, 2024 2:44 am
by john1598360627
mboegem wrote:Hi,

in 2023.12 I have this function in the html area api
Code: Select all
replaceSelectedText(s)
Replaces the selected text; if no text has been selected, the replaced value will be inserted at the last cursor position.


According to the description that will do what you need.

Hope that helps

That worked as you said, thank you!