tinymce 4如何将光标放到文本的末尾

Hen*_* H. 14 html javascript jquery tinymce text-editor

出于某种原因,我需要执行:

tinyMCE.activeEditor.setContent(text, {format : 'html'});
Run Code Online (Sandbox Code Playgroud)

之后,如何将光标放到文本的末尾?

Hen*_* H. 32

ed.selection.select(ed.getBody(), true); // ed is the editor instance
ed.selection.collapse(false);
Run Code Online (Sandbox Code Playgroud)

这似乎是由Peter Wooster 在文本区域中的线程jQuery设置光标位置中回答的

编辑TINYMCE使用:

tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.getBody(), true);
tinyMCE.activeEditor.selection.collapse(false);
Run Code Online (Sandbox Code Playgroud)