为ace编辑器设置值,而无需选择整个编辑器 [英] Set Value for ace editor without selecting the whole editor

查看:122
本文介绍了为ace编辑器设置值,而无需选择整个编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,您可以使用 setValue 设置ace编辑器的值,但是在设置该值之后,编辑器将选择该编辑器的整个值。您如何禁用此功能?这意味着当我将ace编辑器的值设置为 Hello world 时,它不会突出显示 Hello world

So you can set value of an ace editor with setValue but after setting the value, the editor will select the whole value of the editor. How do you disable this? This mean when I set value of ace editor to Hello world, it won't highlight Hello world

推荐答案

您可以使用第二个参数来控制setValue之后的光标位置

You can use the second parameter to control cursor position after setValue

editor.setValue(str, -1) // moves cursor to the start
editor.setValue(str, 1) // moves cursor to the end

这篇关于为ace编辑器设置值,而无需选择整个编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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