I am using ckeditor 4.0
I know the getRanges() method ,i referred CKEditor: set cursor/caret positon
But my scenario is
1) Get cursor position in editor
2) Get data of editor
3) Destroy editor and again create new one
4) Set saved data to new editor
5) Set cusrsor position from step 1 and then insert required element.
I have two divs that works as Tabs(Not jquery tab), One tab caters editor and another caters image processing plugin which will deliver processed image to editor.
when user switches the tab, another tab will be animated(I have shown sliding transition).
click on image plugin tab will destroy editor dusring animation,after click on insert will take user to editor tab and then image will be inserted into newly initiated editor.
This is what I tried:
/* this is backup */
sel = editor.getSelection();
ranges = sel.getRanges();
editor_content = editor.getData();
editor.destroy();
Now recreate editor and restore the backup
editor = CKEDITOR.replace("descr", {resize_enabled : false});
Now I want to restore selection and ranges to this editor,so that I can insert new html at restored position