? LICENSE.txt
? current.patch
? wysiwyg-DRUPAL-6--1.fckeditor.toolbar.patch
? wysiwyg-HEAD.fckeditor-drupal-plugins-4.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	22 Mar 2009 16:35:45 -0000
@@ -37,7 +37,7 @@ 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].SetStatus(Drupal.wysiwyg.editor.instance.fckeditor.FCK_STATUS_WYSIWYG_SHUTDOWN);
     instances[instanceName].UpdateLinkedField();
     $('#' + instanceName).show();
     $('#' + instanceName + '___Config').remove();
@@ -47,6 +47,7 @@ Drupal.wysiwyg.editor.detach.fckeditor =
 };
 
 Drupal.wysiwyg.editor.instance.fckeditor = {
+  FCK_STATUS_WYSIWYG_SHUTDOWN : 42, // Custom shutdown status
   addPlugin: function(plugin, settings, pluginSettings, instance) {
     if (typeof Drupal.wysiwyg.plugins[plugin] != 'object') {
       return;
@@ -56,6 +57,45 @@ Drupal.wysiwyg.editor.instance.fckeditor
       instance.FCKConfig.EditorAreaCSS += ',' + Drupal.settings.wysiwyg.plugins[instance.wysiwygFormat].drupal[plugin].css;
     }
 
+    // Register event listerners for attaching/detaching the plugin
+    instance.FCK.Events.AttachEvent('OnStatusChange', function(editorInstance, newStatus) {
+      switch (newStatus) {
+        case FCK_STATUS_COMPLETE:
+          if (typeof Drupal.wysiwyg.plugins[plugin].attach == 'function') {
+            var currentContent = editorInstance.GetData();
+            var oldContent = currentContent;
+            currentContent = Drupal.wysiwyg.plugins[plugin].attach(currentContent, pluginSettings, editorInstance.Name);
+            currentContent = Drupal.wysiwyg.editor.instance.fckeditor.prepareContent(currentContent)
+            /*
+             * Should use SetData so FCKeditor can preserve comments, scripts etc
+             * But doing so rapidly leaves the original contents unaltered, except for when stepping
+             * through it using a debugger. Timing issue because of SetData rebuilding the iframe.
+             * SetData also causes the content to update/flicker once for each plugin.
+             * Checking if anything was actually modified to minimize this for now.
+             */
+             if(currentContent != oldContent) {
+              editorInstance.EditorDocument.body.innerHTML=currentContent;
+            }
+          }
+          break;
+        case Drupal.wysiwyg.editor.instance.fckeditor.FCK_STATUS_WYSIWYG_SHUTDOWN:
+          // Nothing in FCKeditor triggers this after it has been loaded, so we know what to do
+          if (typeof Drupal.wysiwyg.plugins[plugin].detach == 'function') {
+            var currentContent = editorInstance.GetData();
+            var oldContent = currentContent;
+            currentContent = Drupal.wysiwyg.plugins[plugin].detach(currentContent, pluginSettings, editorInstance.Name);
+            /*
+             * Should use SetData here too. Using .innerHTML here *should* be fine since everything will
+             * be moved to the textare just after this.
+             */
+            if (currentContent != oldContent) {
+              editorInstance.EditorDocument.body.innerHTML=currentContent;
+            }
+          }
+          break;
+      }
+    });
+
     // @see fckcommands.js, fck_othercommands.js, fckpastewordcommand.js
     instance.FCKCommands.RegisterCommand(plugin, {
       // Invoke the plugin's button.
