Ace Editor获取当前选定的行号和文本 [英] Ace Editor get current selected line number and text

查看:640
本文介绍了Ace Editor获取当前选定的行号和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Ace编辑器,但我无法在检索当前所选行号及其文本的文档中找到任何内容。

I'm currently using Ace Editor, but I couldn't find anything in the docs along the lines of retrieving the current selected line number and its text.

有什么想法?

推荐答案

你可以这样做:

selectionRange = editor.getSelectionRange();

startLine = selectionRange.start.row;
endLine = selectionRange.end.row;

content = editor.session.getTextRange(selectionRange);

这篇关于Ace Editor获取当前选定的行号和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆