? ckeditor-autosave.patch
Index: autosave.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/autosave/autosave.js,v
retrieving revision 1.10
diff -u -p -r1.10 autosave.js
--- autosave.js	6 Nov 2009 00:41:16 -0000	1.10
+++ autosave.js	7 Dec 2009 12:07:12 -0000
@@ -21,6 +21,14 @@ if (Drupal.jsEnabled) {
               Drupal.wysiwyg.instances[instance].setContent($('#' + instance).val());
             }
           }
+          
+          //CKEditor support
+          if (typeof(CKEDITOR) != 'undefined' ) {
+            for (var instance in CKEDITOR.instances) {
+              CKEDITOR.instances[instance].setData($('#' + instance).val());
+            }
+          }
+          
           $('#' + autosaved_form_id).focus();
           $(this).html('Reset');
           $('#autosave-status #keep').css('display', 'inline').css('visibility', 'visible');
@@ -29,6 +37,14 @@ if (Drupal.jsEnabled) {
         else if ($(this).html() == 'Reset') {
           form = document.getElementById(autosaved_form_id);
           form.reset();
+
+          //CKEditor support
+          if (typeof(CKEDITOR) != 'undefined' ) {
+            for (var instance in CKEDITOR.instances) {
+              CKEDITOR.instances[instance].setData('');
+            }
+          }
+          
           $('#autosave-status #keep').css('display', 'none').css('visibility', 'hidden');
           $(this).html('View');
         }    
@@ -38,6 +54,14 @@ if (Drupal.jsEnabled) {
         $('#autosave-status').fadeOut('slow');
         form = document.getElementById(autosaved_form_id);
         form.reset();
+
+        //CKEditor support
+        if (typeof(CKEDITOR) != 'undefined' ) {
+          for (var instance in CKEDITOR.instances) {
+            CKEDITOR.instances[instance].setData('');
+          }
+        }
+        
         $('#autosave-status #operations').css('display', 'none').css('visibility', 'hidden');
         Drupal.attachAutosave();
         return false;
@@ -70,6 +94,13 @@ Drupal.saveForm = function() {
     }
   }
   
+  //CKEditor support
+  if (typeof(CKEDITOR) != 'undefined') {
+    for (var instance in CKEDITOR.instances) {
+      CKEDITOR.instances[instance].updateElement();
+    }
+  }
+  
   var serialized = $('#node-form').formHash();
   serialized['q'] =  Drupal.settings.autosave.q;
   $.ajax({
