Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Editor YUI富文本编辑器:如何将光标设置到文本的末尾_Editor_Cursor_Yui_Rte - Fatal编程技术网

Editor YUI富文本编辑器:如何将光标设置到文本的末尾

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

我想用一些预加载的文本呈现YUI2富文本编辑器。但光标始终位于文本的第一个位置。如何在课文末尾设置它


谢谢

我正在使用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);
    });
  });
  ...
});