There is a command for use in user Javascript macros, editor.document().textLines(), which returns an array of all the text lines. Is there an argument that I can pass to this (or a separate command) that I can use to obtain an array of only the selected text (instead of the whole document)?
Or at least, limit the scope of this command?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "TXS - Open Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
There is a command for use in user Javascript macros,
editor.document().textLines(), which returns an array of all the text lines. Is there an argument that I can pass to this (or a separate command) that I can use to obtain an array of only the selected text (instead of the whole document)?Or at least, limit the scope of this command?
The best way to handle selections is to use editor.replaceSelectedText
If you pass a function, it gets the text, e.g.
editor.replaceSelectedText(function(s){return s.toUpperCase();})