The link you provided was helpful. The CLEditor refresh
method is the right way to update it after it's dragged. It just needs to be done at the correct time, using the sortable stop
event.
stop: function(event, ui) {
$(ui.item).find("textarea").cleditor()[0].refresh();
}
http://jsfiddle.net/mbest/rh8c2/1/
I also worked to integrate this into your cleditor
binding. In the init
function:
jQuery(document).on('sortstop', function(event, ui) {
if (jQuery.contains(ui.item[0], element)) {
jQuery(element).cleditor()[0].refresh();
}
});
I also made a change in the update
function to keep the <textarea>
value in sync, because refresh
updates the editor's value from the <textarea>
:
$editor[0].updateTextArea();