Page 1 of 1

Retrieve the insert position in a text

Posted: Wed Nov 20, 2019 2:05 pm
by Isabelle
Hello everyone,

I am using the Oxygen SDK 21.1.0.2 and I wondered if it is possible to retrieve the exact insert position in a text.

Currently I have overridden the method

Code: Select all

insertText
in our own

Code: Select all

DocumentFilter
class.
But I only manage to use the offset attribut to get the current node.
And I don't manage to retrieve the exacte position of the insert in the text of this node.
I tried to use the method

Code: Select all

getFilteredText
from

Code: Select all

AuthorDocumentController
with

Code: Select all

offset -1 and offset
as parameters but without success.

Is it possible to retrieve this position ?
I need it to automatically detect specific abbreviations when users writes in a document.

Regards,
Isabelle

Re: Retrieve the insert position in a text

Posted: Wed Nov 20, 2019 4:23 pm
by Radu
Hi Isabelle,

So you want to somehow look around the current offset and see what text is there, right?
Maybe you can create a text content iterator ro.sync.ecss.extensions.api.AuthorDocumentController.getTextContentIterator(int, int) starting from the current node's start offset to the current offset and use it to see what text is there.

Regards,
Radu

Re: Retrieve the insert position in a text

Posted: Thu Nov 21, 2019 1:43 pm
by Isabelle
Hello Radu,

It is exactly what I am looking for.
Thanks a lot.

Regards,
Isabelle