It looks like you need to use a bookmark
onclick : function() { ed.focus(); var bookmark = ed.selection.getBookmark(); $('#my-input').toggleClass('with-emoticons'); $('#emoticons').toggleClass('emo-visible'); ed.selection.moveToBookmark(bookmark); }
The type of bookmarks used here is the html bookmark, which represents an invisible range in the html editor. The getBookmark function is also capable of creating non-html bookmarks. To do this, you can call ed.selection.getBookmark(2, true);
. For more information on tinymce bookmarks, see docs .
source share