YUI Rich Text Editor: How to set the cursor to the end of the text
i want to render a YUI2 Rich Text Editor with some preloaded text. But the cursor is always in the first position of the text. How can i set it at the end of the t开发者_C百科ext?
Thanks
I'm using YUI3, but this might still work for YUI2. I'm adding the content with execCommand('insertandfocus','content')
rather than initializing the editor with the content.
For instance, instead of this:
YUI().use('editor', function(Y) {
var yuiEditor = new Y.EditorBase({
content: myPreloadedContent
});
...
yuiEditor.on('frame:ready', function() {
this.focus();
});
...
});
I'm inserting the content like this:
YUI().use('editor', function(Y) {
var yuiEditor = new Y.EditorBase();
...
yuiEditor.on('frame:ready', function() {
this.focus(function(){
yuiEditor.execCommand('insertandfocus', myPreloadedContent);
});
});
...
});
精彩评论