CKEditor 4: keep cursor position after manually creating inline instance

When CKEditor 4 is in AutoInline mode, it creates its instances when the page loads. Then the user can click on any editable field and get started. Since I can have many instances on one page, I want to create them on demand (in focus) in order to speed up the loading time using:

CKEDITOR.disableAutoInline = true; $(".editable").focus(function(){ if (!$(this).hasClass("cke_editable_inline")) CKEDITOR.inline(this); }); 

This works, but the cursor moves to the beginning of the text field after creating the instance. Is there any way to avoid this?

I read the topics mentioned in this section: Keep cursor position in CKEditor when changing focus and others regarding choices and ranges, but nobody seems to work. I tried the solutions related to editor.getSelection (), but it was always null.

I would appreciate any hint, thanks!

+4
source share

All Articles