如何将重点放在ace编辑器上?
问题描述:
我正在使用ajax.org的ace编辑器组件在jquery选项卡界面内. 每个选项卡将包含一个单独的ace编辑器.每当我切换到新标签时,其中的编辑器都不会获得焦点.
I am using the ace editor component from ajax.org inside a jquery tab interface. Each tab will contain a separate ace editor. Whenever I switch to a new tab, the editor in it won't get the focus.
我可以通过绑定到jquery UI的"tabsshow"事件来检测何时选择了选项卡.如果有人说我的编辑器div的ID是editor-tab-0,是否有人知道如何将焦点设置到其中的编辑器 对于第一个标签,依此类推...?
I can detect when a tab is selected by binding to the "tabsshow" event of jquery UI. Does any one know how to set focus to the editor in it if say the id of my editor div is editor-tab-0 for the first tab, and so on...?
请帮忙吗?
答
editor.focus(); //To focus the ace editor
var n = editor.getSession().getValue().split("\n").length; // To count total no. of lines
editor.gotoLine(n); //Go to end of document