I am actually trying to find a way to gather the start and end indexes of the selection object of tinymce. The reason why I want that is that i want to take the selection when a button is clicked, modify it and then render it back exactly where I had taken it.
Indeed, I have already seen tinymce.activeEditor.getRng().startOffset
and tinymce.activeEditor.getRng().endOffset
but it gives the index of the text so if there is an html tag, it fails (ex: if the content is <h2>Test</h2>
and I select the first T, I will get 0 and not 4).
Does someone know a way to achieve ? Cause I have searched a lot but did not find a single viable solution, and really need it to be able to add texte at a specific place after modifications with socket IO !
Thanks in advance ! Regards
I have looked at Getting start and end of selected text from tinyMCE but there was no real solution too.