I\'ve got this:
var quoted_text = window.getSelection;
For example:
Accepting the Terms of Service The Stack Exchange Netw
Accepting the Terms of Service
The Stack Exchange Netw
Use split()
Fore example
str = "abc\ndef"; console.log(str.split("\n"));
will print out
["abc", "def"]