How can I determine what annotation content is currently in focus? ( FreeText Annotation )

WebViewer Version: 10.2.2

How can I determine what annotation content is currently in focus?

For example, in the current screenshot, the annotation is selected, so I can move the annotation:
1

But on picture below the content is in focus
2
3

I would like to determine what annotation’s content is currently in focus

Regards!

1 Like

Hello Maksym,

Could you clarify what you mean by “what annotation’s content is currently in focus”? In your third image, do you want to get the highlighted portion “AA”?

You check if the free text annotation is being focused with the hasFocus() API.
Here is the API documentation: Apryse WebViewer Class: RichTextEditor

Best Regards,
Darian Chen

1 Like

annotation and content

As you can see, after I click on an annotation, I can move it in any direction. However, when I click twice on the text content, a Style popup appears, and I can change the content. If I try to move the annotation to a certain position, I will end up selecting the text instead of moving the annotation. And it’s correct behaviour

annotationManager.getSelectedAnnotations() - will return me a list of selected annotations.

I want to understand how to determine whether I can currently edit the content.

For example, if I select the annotation and then click the “ArrowDown” button, it will shift the annotation 5px downwards. But if I’m editing the text content within the annotation and click the “ArrowDown” button, it should move the cursor to the next line, not the annotation itself.

Therefore, I want to be able to distinguish whether I’m focusing on the text content (able to edit the content without requiring additional clicks on the annotation) or if I have simply selected the annotation

1 Like

Hello Maksym,

As mentioned in the previous response, you can check if the free text annotation is being focused with the hasFocus() API. Apryse WebViewer Class: RichTextEditor

Here is a video demonstration of the API on our showcase demo.

If the free text annotation is selected, you access the editor property and call the hasFocus API. If it returns true, you are currently focusing on the text content.

instance.Core.annotationManager.getSelectedAnnotations()[0].editor.hasFocus()

Hope this helps.

Best Regards,
Darian Chen

1 Like

thanks. It helped me.

1 Like