| 功能 |
语句 |
| 设置值 |
editor.setValue("the new text here"); // or session.setValue |
| 获取值 |
editor.getValue() |
| 跳到行 |
editor.gotoLine(1) |
| 光标跳到最后一行的结束位置 |
editor.execCommand('gotolineend') |
| 获取选中的代码 |
editor.session.getTextRange(editor.getSelectionRange()); |
| 在光标处插入字符串 |
editor.insert("Something cool"); |
| 获取当前光标所在的行和列 |
editor.selection.getCursor(); |
| 设置代码块只读 |
editor.setReadOnly(true); |
| 设置打印线是否显示 |
editor.setShowPrintMargin(false); |
| 获取总行数 |
editor.session.getLength() |
editor.find('needle',{
backwards: false,
wrap: false,
caseSensitive: false,
wholeWord: false,
regExp: false
});
editor.findNext();
editor.findPrevious();