The problem is that when you start the CKEDITOR instance, this time target is hidden, so if you create an editor instance after showing the target, it will wok:
So you just put:
CKEDITOR.disableAutoInline = true; $('#myModal').on('shown.bs.modal', function () { CKEDITOR.inline('myModalLabel'); CKEDITOR.inline('bodyModal'); });
But after closing and reopening the modal code, you may receive an error message:
Missed Instance of the editor "myModalLabel" is already attached to the provided item
Update:
To do this, we can have a function:
function ckCreate(name) { if(CKEDITOR.instances[name] === undefined) { CKEDITOR.inline(name); } }
create an instance only if it does not exist;
Finally, your code will look like this:
CKEDITOR.disableAutoInline = true; $('#myModal').on('shown.bs.modal', function () { ckCreate('myModalLabel'); ckCreate('bodyModal'); });
Final Fiddle: http://jsfiddle.net/0vLs3fku/4/
Update: need to destroy instances
function ckCreate(name) { if (CKEDITOR.instances[name]) { CKEDITOR.instances[name].destroy(); } CKEDITOR.inline(name); }
source share