Get selected text in RichTextArea?

Hi all,
As far as I know, there is no provided method to get selected text in RichTextArea. But is there any possibility to add one by myself? Maybe it could be done with JavaScript?
Thank you for any piece of advice!