Short summary: getSelection().toString() behaves unexpectedly on https://vscode.dev.
Detailed question:
I need to write a javascript script which gets the text selected by the user. Usually I do it with getSelection().toString(), but for some reason this does not work for https://vscode.dev (online version of VSCode editor). Instead of copying all the selected text, the code above evaluates to a shortened version of the selected text, with an ellipsis in the middle. For example, if I select this text...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
then getSelection().toString() evaluates to
'1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n…21\n22\n23\n24\n25\n26\n27\n28\n29\n30'
that is it looses some text in the middle.
How to work around it and get all the selected text?
P.S. In case you ask, the Chrome console did not shorten this text, it was shortened by javascript for real:
