replacing space with non breakable space on selecting text via a button in Rich Text Editor in CQ
Hi All,
I have a requirement, In which what should be done is- whenever user selects some text and clicks a button(customized) that button should convert all the white space in Selected text to non breakable space.
Till now I am able to add the button via MiscToolPlugin.js. But after that I do not know how to proceed.
MiscToolPlugin.js uses method execute: function(id, value, options) .
I will call my method from this method. and My thinking is to somehow get the selected Text and replace all white space in this selected Text to non breakable space.
But I do not know How to get the selected Text and how to save the new Text back after replacing.
I searched on internet but couldn't find anything useful.
Please help asap.
Thanks in advance.