? LICENSE.txt
? current.patch
? wysiwyg-DRUPAL-6--1.fckeditor.toolbar.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-4.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-5-alternative.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-5-dataprocessor.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-5.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-alternative.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-dataprocessor.patch
Index: editors/js/fckeditor-2.6.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/fckeditor-2.6.js,v
retrieving revision 1.14
diff -u -p -r1.14 fckeditor-2.6.js
--- editors/js/fckeditor-2.6.js	21 Mar 2009 23:16:15 -0000	1.14
+++ editors/js/fckeditor-2.6.js	23 Mar 2009 19:20:59 -0000
@@ -36,17 +36,18 @@ Drupal.wysiwyg.editor.detach.fckeditor =
   }
 
   for (var instanceName in instances) {
-    // Shut down the instance and give plugins a chance to detach by changing status first.
-    instances[instanceName].SetStatus(FCK_STATUS_NOTLOADED);
-    instances[instanceName].UpdateLinkedField();
-    $('#' + instanceName).show();
+    var instanceName = instances[instanceName].Name;
+    instances[instanceName].UpdateLinkedField(); 
     $('#' + instanceName + '___Config').remove();
     $('#' + instanceName + '___Frame').remove();
-    delete FCKeditorAPI.__Instances[instanceName];
+    $('#' + instanceName).show();
+    delete instances[instanceName];
+    Drupal.wysiwyg.editor.instance.fckeditor.catchingEvents[instanceName] = false;
   }
 };
 
 Drupal.wysiwyg.editor.instance.fckeditor = {
+  catchingEvents : {},
   addPlugin: function(plugin, settings, pluginSettings, instance) {
     if (typeof Drupal.wysiwyg.plugins[plugin] != 'object') {
       return;
@@ -56,6 +57,44 @@ Drupal.wysiwyg.editor.instance.fckeditor
       instance.FCKConfig.EditorAreaCSS += ',' + Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal[plugin].css;
     }
 
+    /**
+     * Create a custom Data Processor to wrap the default one and let the plugins modify the editor contents.
+     * Only do this once!
+     */
+    if (!this.catchingEvents[instance.FCK.Name]) {
+      var pluginsDataProcessor = function() {};
+      pluginsDataProcessor.prototype = new instance.FCKDataProcessor();
+      pluginsDataProcessor.prototype.ConvertToDataFormat = function(rootNode, excludeRoot) {
+        // This is called from GetData() and given the editor area DOM in Wysiwyg Mode.
+        // Use the original Data Processor to convert the DOM into an XHTML string
+        var data = instance.FCKDataProcessor.prototype.ConvertToDataFormat.call(this, rootNode, excludeRoot);
+        for (var plugin in Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal) {
+          if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
+            data = Drupal.wysiwyg.plugins[plugin].detach(data, pluginSettings, instance.FCK.Name);
+          }
+        }
+        return data;
+      }
+
+      pluginsDataProcessor.prototype.ConvertToHtml = function(data) {
+        // This is called from SetData(), but the data has had comments, scripts etc stripped.
+        // Revert the protection and let our plugins process it.
+        var data = instance.FCKConfig.ProtectedSource.Revert(data);
+        for (var plugin in Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal) {
+          if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
+            data = Drupal.wysiwyg.plugins[plugin].attach(data, pluginSettings, instance.FCK.Name);
+            data = Drupal.wysiwyg.editor.instance.fckeditor.prepareContent(data);
+          }
+        }
+        // Protect the source once again and send it off to the original Data Processor for conversion to XHTML.
+        data = instance.FCKConfig.ProtectedSource.Protect(data);
+        return instance.FCKDataProcessor.prototype.ConvertToHtml.call(this, data);
+      }
+
+      instance.FCK.DataProcessor = new pluginsDataProcessor();
+      this.catchingEvents[instance.FCK.Name]  = true;
+    }
+
     // @see fckcommands.js, fck_othercommands.js, fckpastewordcommand.js
     instance.FCKCommands.RegisterCommand(plugin, {
       // Invoke the plugin's button.
