Copy selected text

Hi,

Is there a way to get selected text from a component such as TextArea? I am trying to provide search on selected text with a context menu.

Thanks a lot for developing this amazing platform.

Thanks,

Ali

Hi,

Unfortunately, there is no built-in functionality to obtain selected text. But you can either extend the TextArea component or write an extension for it.

I’ve prepared a demo project with two types of extensions: Regular GWT extension and JavaScript extension. Bear in mind that the first one requires the web-toolkit module.

You can find the demo application in GitHub.

Also, take a look at the Vaadin extensions documentation:


Regards,
Gleb

1 Like

This is very helpful. Thank you for sharing it.

-ali