Editor YUI富文本编辑器:如何将光标设置到文本的末尾
我想用一些预加载的文本呈现YUI2富文本编辑器。但光标始终位于文本的第一个位置。如何在课文末尾设置它Editor YUI富文本编辑器:如何将光标设置到文本的末尾,editor,cursor,yui,rte,Editor,Cursor,Yui,Rte,我想用一些预加载的文本呈现YUI2富文本编辑器。但光标始终位于文本的第一个位置。如何在课文末尾设置它 谢谢我正在使用YUI3,但这可能仍然适用于YUI2。我用execCommand('insertandfocus','content')添加内容,而不是用内容初始化编辑器 例如,与此相反: YUI().use('editor', function(Y) { var yuiEditor = new Y.EditorBase({ content: myPreloadedContent
谢谢我正在使用YUI3,但这可能仍然适用于YUI2。我用
execCommand('insertandfocus','content')
添加内容,而不是用内容初始化编辑器
例如,与此相反:
YUI().use('editor', function(Y) {
var yuiEditor = new Y.EditorBase({
content: myPreloadedContent
});
...
yuiEditor.on('frame:ready', function() {
this.focus();
});
...
});
我插入的内容如下:
YUI().use('editor', function(Y) {
var yuiEditor = new Y.EditorBase();
...
yuiEditor.on('frame:ready', function() {
this.focus(function(){
yuiEditor.execCommand('insertandfocus', myPreloadedContent);
});
});
...
});