[英]ace editor - move to the end of the line
I'm using ace editor . 我正在使用ace编辑器 。 Sometimes, and I can not say exactly when (I put the text editor in ajax), Of the text cursor moves to the end of the line only there to write.
有时,我不能确切地说出什么时候(我将文本编辑器放在ajax中),文本光标中的光标移动到行尾,仅在那儿进行写操作。 Only if I refresh the page again, it works out.
仅当我再次刷新页面时,它才能正常工作。
Here is the code: 这是代码:
var ace_editor = null;
// Than I call to ajax to get the content of the ace editor
ace_editor = ace.edit("editbox");
ace_editor.setTheme("ace/theme/eclipse");
ace_editor.getSession().setMode("ace/mode/html");
ace_editor.getSession().setValue(ParseResponseRules(xmlhttp.responseText));
Try: 尝试:
ace_editor.setValue(ParseResponseRules(xmlhttp.responseText), -1);
instead of: 代替:
ace_editor.getSession().setValue(ParseResponseRules(xmlhttp.responseText));
The second parameter explained: undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end 第二个参数说明:undefined或0为selectAll,-1为文档开头,1为结尾
Ref: http://ace.c9.io/#nav=api&api=editor 参考: http : //ace.c9.io/#nav=api&api=editor
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.