Monday, 26 November 2018

TinyMCE: Programmatically select word at caret position

How can I modify the current selection from tinyMCE 4 so that it can be extended to the current word's boundary?

Say the caret is at the position represented below. How can I force tinyMCE to select the 'test' word?

This is a t|est

I suspect that may to use the browser's Range object, but I'm not sure how to do this

My end goal is that when I trigger a custom action from a button, it applies to either the selection (if there is one), or to the word containing the caret position. Basically, same behaviour at when you click the Bold button



from TinyMCE: Programmatically select word at caret position

No comments:

Post a Comment