四种办法
一、第一种
您可以使用第二个参数来控制setValue之后的光标位置
editor.setValue(str, -1) // moves cursor to the start
editor.setValue(str, 1) // moves cursor to the end
二、第二种
在执行setValue()之后,您甚至可以使用clearSelection();
editor.setValue("Hello World");
editor.clearSelection(); // This will remove the highlight over the text
三、第三种
editor.session.setValue(text);
四、第四种
editor.getSession().setValue(text);