Menu

Limiting the scope of editor.document().textLines()

Anonymous
2017-10-15
2017-10-15
  • Anonymous

    Anonymous - 2017-10-15

    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?

     
  • Benito van der Zander

    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();})

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB