I've ran into an issue with CKEditor 4 and jQuery UI's sortable method where if I sort a container that has a CKEditor instance, it removes the value and throws an error "Uncaught TypeError: Cannot call method 'getSelection' of undefined". It also makes the editor uneditable. I was able to get around this in CKEditor 3 with one of the following hacks found here: CKEditor freezes on jQuery UI Reorder
In looking at the Chrome DOM inspector, it appears that the contents of the iframe are removed.
Below is crude test code:
<html> <head> <title>test</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js"></script> <script src="ckeditor.js"></script> <script type="text/javascript"> $(function(){ var tmpStore = {}; $('#sortable').sortable({ cursor: 'move', // Hack that use to work on V3 but not on V4: // https://stackguides.com/questions/3379653/ckeditor-freezes-on-jquery-ui-reorder start:function (event,ui) { $('textarea').each(function(){ var id = $(this).attr('id'); tmpStore[id] = CKEDITOR.instances[id].getData(); }) }, stop: function(event, ui) { $('textarea').each(function(){ var id = $(this).attr('id'); CKEDITOR.instances[id].setData(tmpStore[id]); }) } }); $('textarea').each(function(){ var ckId = $(this).attr('id'); config = {}; CKEDITOR.replace(ckId, config); }) }) li { padding: 10px; width: 800px; height: 300px; } </head> <body> <ul id="sortable"> <li><textarea id="test1" name="test1">test1</textarea></li> <li><textarea id="test2" name="test1">test2</textarea></li> <li><textarea id="test3" name="test1">test3</textarea></li> </ul> </body> </html>