Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get selected text in Ace editor?

I look into docs and also pick at the source code and I dind't find anything, all I see is selection and range objects, and methods that manipulate ranges.

like image 692
jcubic Avatar asked Jun 02 '14 14:06

jcubic


2 Answers

It's better to use editor.getSelectedText() instead.

like image 75
a user Avatar answered Sep 21 '22 18:09

a user


Found in Ace editor source code:

editor.getSession().doc.getTextRange(editor.selection.getRange());
like image 32
jcubic Avatar answered Sep 20 '22 18:09

jcubic