How to get currently selected text from within electron desktop application?


I am building a desktop application with electron. As a part of its functionality I want to get text that is currently selected, when a particular event fires. This text can be any where - webpage, pdf, sublime etc.

Is there any way I can do this?


Have you solved this?


Google “userSelection” & “html Range” will help