javascript - tinymce loses caret position -


I have a tinymce custom button, which toggle an emoticon device near a textteine.

  onclick: function () {ed.focus (); . $ ('#in my input') toggleClass ('with-emoticon'); . $ ('# Emoticon') toggleClass ('emo view'); }   

When I click on the button, the Emoticons Dev has revealed, but the carat goes to the end of my text

Custom How do I keep care of status while clicking on a button?

like you have to use a bookmark

  onclick: function () {Ed.focus (); Var bookmark = ed.selection.getBookmark (); . $ ('#in my input') toggleClass ('with-emoticon'); . $ ('# Emoticon') toggleClass ('emo view'); Ed.selection.moveToBookmark (bookmark); }   

The bookmark-type used here is an html bookmark that represents a non-visible duration in the editor HTML. The GetBookmark function is also capable of creating non-HTML bookmarks. For this, you can call ed.selection.getBookmark (2, true);

For more information about Tinyes Bookmarks

Comments