Recognise that the text selected changed rather than text selection was cleared

When text is selected and the text selection handle is dragged to change the selected text, the 'selectedText' getter returns null during the text selection change.

This makes sense if using the example 'Copy' overlay because you would want the overlay to disappear during the text selection change and then reappear when the text selection handle is released. However, in my code getting null from the 'selectedText' getter when the text selection handle is being dragged inadvertently shows an IconButton that I don't want shown at that time.

Is there a way to distinguish between when the text selection is changing and when the text selection is cleared?


2 Replies 1 reply marked as answer

DB Dilli Babu Nandha Gopal Syncfusion Team December 6, 2021 12:17 PM UTC

Hi Luke, 
 
Thank you for contacting Syncfusion support. 
 
Yes, `selectedText` in TextSelectionChanged callback will return null while text selection drag handle moved. This is known behavior in SfPdfViewer since it will used when overlaying the copy in clipboard. However, getSelectedTextLines will return selected textline in the document which can be used in your scenario. Please refer the following link to know more about getSelectedTextLines method. 
 
Please let us know if you have any queries. 
 
Regards, 
Dilli babu 


Marked as answer

LU Luke December 7, 2021 07:39 AM UTC

Hi Dilli,

That looks like it is working now. Thank you very much for your help.

It's a great product.

Regards,

Luke


Loader.
Up arrow icon