Index: wysiwyg_editor.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg_editor.admin.inc,v
retrieving revision 1.16
diff -u -p -r1.16 wysiwyg_editor.admin.inc
--- wysiwyg_editor.admin.inc	5 Oct 2008 16:27:33 -0000	1.16
+++ wysiwyg_editor.admin.inc	6 Oct 2008 02:51:01 -0000
@@ -166,49 +166,6 @@ function wysiwyg_editor_profile_form($fo
     '#description' => t('The language for the Wysiwyg Editor interface. Language codes are based on the <a href="http://www.loc.gov/standards/iso639-2/englangn.html">ISO-639-2</a> format.'),
   );
 
-  $form['visibility'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Visibility'),
-    '#collapsible' => TRUE,
-    '#collapsed' => TRUE,
-  );
-
-  // If the visibility is set to PHP mode but the user doesn't have this block
-  // permission, don't allow them to edit nor see this PHP code
-  $access = user_access('use PHP for block visibility');
-  if ($profile->settings['access'] == 2 && !$access) {
-    $form['visibility'] = array();
-    $form['visibility']['access'] = array(
-      '#type' => 'value',
-      '#value' => 2,
-    );
-    $form['visibility']['access_pages'] = array(
-      '#type' => 'value',
-      '#value' => $profile->settings['access_pages'],
-    );
-  }
-  else {
-    $options = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'));
-    $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are '%blog' for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
-    if ($access) {
-      $options[] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
-      $description .= ' '. t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
-    }
-    $form['visibility']['access'] = array(
-      '#type' => 'radios',
-      '#title' => t('Show Wysiwyg Editor on specific pages'),
-      '#default_value' => $profile->settings['access'],
-      '#options' => $options,
-    );
-    $form['visibility']['access_pages'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Pages'),
-      '#default_value' => $profile->settings['access_pages'],
-      '#description' => $description,
-      '#wysiwyg' => FALSE,
-    );
-  }
-
   $form['buttons'] = array(
     '#type' => 'fieldset',
     '#title' => t('Buttons and plugins'),
Index: wysiwyg_editor.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg_editor.js,v
retrieving revision 1.7
diff -u -p -r1.7 wysiwyg_editor.js
--- wysiwyg_editor.js	5 Oct 2008 21:01:20 -0000	1.7
+++ wysiwyg_editor.js	9 Oct 2008 00:55:04 -0000
@@ -17,16 +17,44 @@ Drupal.wysiwygEditorInit = function() {
  * This function can be called to process AJAX-loaded content.
  */
 Drupal.behaviors.attachWysiwyg = function(context) {
-  jQuery.each(Drupal.wysiwyg.attach, function(editor) {
-    // Show toggle link if set.
-    if (Drupal.settings.wysiwygEditor.showToggle) {
-      for (var theme in Drupal.settings.wysiwygEditor.configs[editor]) {
-        $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)', context).each(function() {
-          Drupal.wysiwygEditorAttachToggleLink(this, editor, theme);
-        });
+  $('.wysiwyg:not(.wysiwyg-processed)', context).each(function() {
+    var classes = this.className.split(' ');
+    var params = {};
+    for (var i in classes) {
+      if (classes[i].substr(0, 8) == 'wysiwyg-') {
+        var parts = classes[i].split('-');
+        var value = parts.slice(2).join('-');
+        params[parts[1]] = value;
       }
     }
-    this(context, Drupal.settings.wysiwygEditor.configs[editor]);
+    $this = $(this);
+    if (($this.is(':input') && $this.is(':checked')) || $this.is('div')) {
+      Drupal.wysiwygEditorAttachToggleLink(context, params);
+      Drupal.wysiwygAttach(context, params);
+    }
+    if ($this.is(':input')) {
+      $this.change(function() {
+        Drupal.wysiwygDetach(context, params);
+        Drupal.wysiwygAttach(context, params);
+      });
+    }
+    $this.addClass('wysiwyg-processed');
+  });
+}
+
+Drupal.wysiwygAttach = function(context, params) {
+  if (typeof Drupal.wysiwyg.attach[params.editor] == 'function') {
+    Drupal.wysiwyg.attach[params.editor](context, params, Drupal.wysiwyg.clone(Drupal.settings.wysiwygEditor.configs[params.editor]));
+    $('#wysiwyg-toggle-' + params.field).show();
+  }
+  if (params.editor == 'none') {
+    $('#wysiwyg-toggle-' + params.field).hide();
+  }
+}
+
+Drupal.wysiwygDetach = function(context, params) {
+  jQuery.each(Drupal.wysiwyg.detach, function(editor) {
+    this(context, params);
   });
 }
 
@@ -40,44 +68,30 @@ Drupal.behaviors.attachWysiwyg = functio
  * @param theme
  *   The editor theme assigned to the element.
  */
-Drupal.wysiwygEditorAttachToggleLink = function(element, editor, theme) {
+Drupal.wysiwygEditorAttachToggleLink = function(context, params) {
   var text = document.createTextNode(Drupal.settings.wysiwygEditor.status ? Drupal.settings.wysiwygEditor.disable : Drupal.settings.wysiwygEditor.enable);
   var a = document.createElement('a');
   $(a)
-    .click(function() {
-      Drupal.wysiwygEditorToggle(element, editor, theme);
-    })
-    .attr('id', 'wysiwyg4' + element.id)
+    .toggle(
+      function() {
+        Drupal.wysiwygDetach(context, params);
+        $('#wysiwyg-toggle-' + params.field).html(Drupal.settings.wysiwygEditor.enable).blur();
+        console.log(params);
+        Drupal.wysiwyg.attach.none(context, params);
+      },
+      function() {
+        Drupal.wysiwyg.detach.none(context, params);
+        Drupal.wysiwygAttach(context, params);
+        $('#wysiwyg-toggle-' + params.field).html(Drupal.settings.wysiwygEditor.disable).blur();
+      }
+    )
     .css('cursor', 'pointer')
+    .attr('id', 'wysiwyg-toggle-' + params.field)
+    .attr('href', 'javascript:void(0);')
     .append(text);
   var div = document.createElement('div');
   $(div).append(a);
-  $(element).after(div);
-}
-
-/**
- * Enable/disable the editor and change toggle link text accordingly.
- *
- * Toggle implementation functions are expected to return the new state of a
- * toggled editor.
- *
- * @param element
- *   The DOM element to toggle the editor for.
- * @param editor
- *   The editor name assigned to the element.
- * @param theme
- *   The editor theme assigned to the element.
- */
-Drupal.wysiwygEditorToggle = function(element, editor, theme) {
-  if (typeof Drupal.wysiwyg.toggle[editor] == 'function') {
-    var new_state = Drupal.wysiwyg.toggle[editor](element, theme);
-  }
-  if (new_state) {
-    $('#wysiwyg4' + element.id).html(Drupal.settings.wysiwygEditor.disable).blur();
-  }
-  else {
-    $('#wysiwyg4' + element.id).html(Drupal.settings.wysiwygEditor.enable).blur();
-  }
+  $('#' + params.field).after(div);
 }
 
 /**
Index: wysiwyg_editor.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg_editor.module,v
retrieving revision 1.26
diff -u -p -r1.26 wysiwyg_editor.module
--- wysiwyg_editor.module	5 Oct 2008 21:01:20 -0000	1.26
+++ wysiwyg_editor.module	8 Oct 2008 22:21:13 -0000
@@ -67,14 +67,15 @@ function wysiwyg_editor_perm() {
  *   via profiles, when profiles are attached to an input format. It makes no
  *   sense to display TinyMCE's simple GUI/theme for the user signature, when
  *   the input format allows users to use advanced HTML and hence, editor
- *   plugins.  Fix this here, in wysiwyg_editor_process_textarea(), and lastly
+ *   plugins.  Fix this here, in wysiwyg_editor_process_element(), and lastly
  *   in wysiwyg_editor_get_config().
  */
 function wysiwyg_editor_elements() {
   $type = array();
   if (user_access('access wysiwyg editor')) {
-    // Let Wysiwyg Editor potentially process each textarea.
-    $type['textarea'] = array('#process' => array('wysiwyg_editor_process_textarea'), '#wysiwyg' => TRUE, '#wysiwyg_style' => 'advanced');
+    // @todo Derive editor theme from input format.
+    $type['textarea'] = array('#wysiwyg_style' => 'advanced');
+    $type['form'] = array('#after_build' => array('wysiwyg_editor_process_form'));
   }
   return $type;
 }
@@ -91,75 +92,77 @@ function wysiwyg_editor_form_alter(&$for
 }
 
 /**
- * Alter #wysiwyg for certain core textareas.
- *
- * @param $element
- *   The textarea element to be processed.
- */
-function wysiwyg_editor_filter_elements(&$element) {
-  switch ($element['#name']) {
-    // Disable Wysiwyg Editor for these textareas.
-    case 'log': // Node revisions log message.
-    case 'img_assist_pages': // Image Assist visibility settings.
-    case 'caption': // User signature?
-    case 'pages': // (Block) Visibility settings.
-    case 'access_pages': // Wysiwyg Editor profile settings.
-    case 'user_mail_welcome_body': // User settings.
-    case 'user_mail_approval_body': // User settings.
-    case 'user_mail_pass_body': // User settings.
-    case 'synonyms': // Taxonomy terms.
-    case 'description': // Taxonomy terms.
-      $element['#wysiwyg'] = FALSE;
-      break;
-
-    // Force 'simple' theme for some smaller textareas.
-    case 'signature': // User signature.
-    case 'site_mission':
-    case 'site_footer':
-    case 'site_offline_message':
-    case 'page_help': // Page content-type help message?
-    case 'user_registration_help':
-    case 'user_picture_guidelines':
-      $element['#wysiwyg_style'] = 'simple';
-      break;
-  }
-}
-
-/**
  * Process a textarea for Wysiwyg Editor.
  */
-function wysiwyg_editor_process_textarea($element) {
-  wysiwyg_editor_filter_elements($element);
+function wysiwyg_editor_process_form($form) {
+  wysiwyg_search_input_formats($form);
+  return $form;
+}
 
-  if ($element['#wysiwyg']) {
-    $profile = wysiwyg_editor_load_profile(wysiwyg_editor_current_profile());
-    if ($profile && _wysiwyg_editor_page_match($profile)) {
-      if (!wysiwyg_editor_load_editor($profile)) {
-        // Bail out if editor could not be loaded.
-        return $element;
-      }
-      // Check editor theme (and reset if needed).
-      // Default to advanced theme if the requested one is not installed.
-      $element['#wysiwyg_style'] = wysiwyg_editor_get_themes($profile, $element['#wysiwyg_style']);
-
-      wysiwyg_editor_add_settings($profile, $element['#wysiwyg_style']);
-      wysiwyg_editor_add_plugin_settings($profile);
-      if (!isset($element['#attributes'])) {
-        $element['#attributes'] = array();
-      }
-      if (!isset($element['#attributes']['class'])) {
-        $element['#attributes']['class'] = 'wysiwyg wysiwyg-'. $element['#wysiwyg_style'];
-      }
-      else {
-        $element['#attributes']['class'] .= ' wysiwyg wysiwyg-'. $element['#wysiwyg_style'];
+function wysiwyg_search_input_formats(&$form) {
+  if ($children = array_values(element_children($form))) {
+    foreach ($children as $index => $item) {
+      $element = &$form[$item];
+  
+      // filter_form() always uses key 'format' if user has access to one format
+      // only, and most ...
+      if ($item === 'format' && $index > 0) {
+        
+        if ((isset($element['#type']) && $element['#type'] == 'fieldset') || isset($element['format']['guidelines'])) {
+          // Set resizable to false to avoid drupal.js resizable function from
+          // taking control of the textarea
+          $extra_class = '';
+          if (!empty($form[$children[$index - 1]]['#resizable'])) {
+            $extra_class = ' wysiwyg-resizable-1';
+            $form[$children[$index - 1]]['#resizable'] = FALSE;
+            drupal_add_js('misc/textarea.js');
+          }
+
+          $textarea = $form[$children[$index - 1]]['#id'];
+          $formats = element_children($element);
+          array_pop($formats);
+          unset($formats['format']);
+          foreach ($formats as $format) {
+            $editor = 'none';
+            $theme = '';
+            $profile = wysiwyg_get_profile($format);
+            if ($profile) {
+              $editor = $profile->settings['editor'];
+              // Check editor theme (and reset if needed).
+              // Default to advanced theme if the requested one is not installed.
+              $theme = wysiwyg_editor_get_themes($profile, $form[$children[$index - 1]]['#wysiwyg_style']);
+
+              wysiwyg_editor_add_settings($profile, $theme);
+              wysiwyg_editor_add_plugin_settings($profile);
+              $theme = ' wysiwyg-theme-'. $theme;
+            }
+
+            if (isset($element['format']['guidelines'])) {
+              $element[$format]['#prefix'] = '<div class="wysiwyg wysiwyg-editor-'. $editor .' wysiwyg-field-'. $textarea . $theme . $extra_class .'">';
+              $element[$format]['#suffix'] = '</div>';
+            }
+            else {
+              $element[$format]['#attributes']['class'] = isset($element[$format]['#attributes']['class']) ? $element[$format]['#attributes']['class'] .' ' : '';
+              $element[$format]['#attributes']['class'] .= ' wysiwyg wysiwyg-editor-'. $editor .' wysiwyg-field-'. $textarea . $theme . $extra_class;
+            }
+          }
+        }
+        continue;
       }
-      // Set resizable to false to avoid drupal.js resizable function from
-      // taking control of the textarea
-      $element['#resizable'] = FALSE;
+      wysiwyg_search_input_formats($element);
     }
   }
+}
 
-  return $element;
+function wysiwyg_get_profile($format) {
+  if ($format != 3) {
+    if ($profile = wysiwyg_editor_load_profile(wysiwyg_editor_current_profile())) {
+      if (wysiwyg_editor_load_editor($profile)) {
+        return $profile;
+      }
+    }
+  }
+  return FALSE;
 }
 
 /**
@@ -171,7 +174,7 @@ function wysiwyg_editor_process_textarea
  * @return
  *   TRUE if the editor has been loaded, FALSE if not.
  *
- * @see wysiwyg_editor_process_textarea()
+ * @see wysiwyg_get_profile()
  */
 function wysiwyg_editor_load_editor($profile) {
   static $settings_added;
@@ -231,6 +234,8 @@ function wysiwyg_editor_load_editor($pro
       'enable' => t('Enable rich-text'),
     )), 'setting');
 
+    drupal_add_js(wysiwyg_get_path('editors/js/none.js'), 'module', 'footer');
+
     // Add wysiwyg_editor.js to the footer to ensure it's executed after the
     // Drupal.settings array has been rendered and populated. Also, since editor
     // library initialization functions must be loaded first by the browser,
@@ -421,48 +426,6 @@ function wysiwyg_editor_load_profile($na
 }
 
 /**
- * Determine if Wysiwyg Editor has permission to be used on the current page.
- *
- * @return
- *   TRUE if can render, FALSE if not allowed.
- */
-function _wysiwyg_editor_page_match($profile) {
-  $page_match = FALSE;
-  if (!is_object($profile)) {
-    return FALSE;
-  }
-
-  // Kill Wysiwyg Editor if we're editing a textarea with PHP in it!
-  if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'edit') {
-    $node = node_load(arg(1));
-    $filters = filter_list_format($node->format);
-    foreach ($filters as $filter) {
-      if ($filter->module == 'php') {
-        return FALSE;
-      }
-    }
-  }
-
-  if ($profile->settings['access_pages']) {
-    // If the PHP option wasn't selected
-    if ($profile->settings['access'] < 2) {
-      $path = drupal_get_path_alias($_GET['q']);
-      $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($profile->settings['access_pages'], '/')) .')$/';
-      $page_match = !($profile->settings['access'] xor preg_match($regexp, $path));
-    }
-    else {
-      $page_match = drupal_eval($profile->settings['access_pages']);
-    }
-  }
-  // No pages were specified to block so show on all
-  else {
-    $page_match = TRUE;
-  }
-
-  return $page_match;
-}
-
-/**
  * Implementation of hook_user().
  */
 function wysiwyg_editor_user($type, &$edit, &$user, $category = NULL) {
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.1
diff -u -p -r1.1 fckeditor-2.6.js
--- editors/js/fckeditor-2.6.js	5 Oct 2008 22:08:38 -0000	1.1
+++ editors/js/fckeditor-2.6.js	9 Oct 2008 00:52:32 -0000
@@ -8,25 +8,18 @@ Drupal.wysiwyg = Drupal.wysiwyg || { 'in
  * @param editorSettings
  *   An object containing editor settings for each enabled editor theme.
  */
-Drupal.wysiwyg.attach.fckeditor = function(context, editorSettings) {
-  for (var theme in editorSettings) {
-    $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)', context).each(function() {
-      // @todo Convert string into variable name w/o overwriting string?
-      //   workaround: build object via editors[this.id] = new ...
-      var oFCK_1 = new FCKeditor(this.id);
-      // Clone, so original settings are not overwritten.
-      var config = Drupal.wysiwyg.clone(editorSettings[theme]);
-      // Configure settings for this theme.
-      oFCK_1.BasePath = config.BasePath;
-      for (var setting in config) {
-        oFCK_1.Config[setting] = config[setting];
-      }
-      // Attach Wysiwyg Editor control if default is on.
-      if (Drupal.settings.wysiwygEditor.status) {
-        oFCK_1.ReplaceTextarea();
-      }
-      $(this).addClass('wysiwyg-processed');
-    });
+Drupal.wysiwyg.attach.fckeditor = function(context, params, editorSettings) {
+  // @todo Convert string into variable name w/o overwriting string?
+  //   workaround: build object via editors[this.id] = new ...
+  var FCKinstance = new FCKeditor(params.field);
+  // Configure settings for this theme.
+  FCKinstance.BasePath = editorSettings[params.theme].BasePath;
+  for (var setting in editorSettings[params.theme]) {
+    FCKinstance.Config[setting] = editorSettings[params.theme][setting];
+  }
+  // Attach Wysiwyg Editor control if default is on.
+  if (Drupal.settings.wysiwygEditor.status) {
+    FCKinstance.ReplaceTextarea();
   }
 }
 
@@ -35,35 +28,19 @@ Drupal.wysiwyg.attach.fckeditor = functi
  *
  * @todo Context support required to remove only certain editors (think AHAH/AJAX).
  */
-Drupal.wysiwyg.detach.fckeditor = function(context) {
-  if (tinyMCE.activeEditor) {
-    tinyMCE.triggerSave();
-    tinyMCE.activeEditor.remove();
-  }
-}
-
-/**
- * Toggle editor and return new state.
- *
- * @param element
- *   The DOM element to toggle the editor for.
- * @param theme
- *   The editor theme assigned to the element.
- *
- * @return
- *   A boolean value indicating whether the editor has been enabled.
- */
-Drupal.wysiwyg.toggle.fckeditor = function(element, theme) {
-  var instance = FCKeditorAPI.GetInstance(element.id);
-  if ($(element).css('display') != 'none' || instance == null) {
-    instance.SetHTML($(element).hide().val());
-    $('#' + element.id + '___Frame').show();
-    return true;
+Drupal.wysiwyg.detach.fckeditor = function(context, params) {
+  if (typeof params != 'undefined') {
+    var editor = FCKeditorAPI.GetInstance(params.field);
+    if (editor) {
+      $('#' + params.field).val(editor.GetXHTML()).show();
+      $('#' + params.field + '___Config').remove();
+      $('#' + params.field + '___Frame').remove();
+      delete FCKeditorAPI.__Instances[params.field];
+    }
   }
   else {
-    $('#' + element.id).val(instance.GetXHTML()).show();
-    $('#' + element.id + '___Frame').hide();
-    return false;
+    tinyMCE.triggerSave();
+    tinyMCE.activeEditor.remove();
   }
 }
 
Index: editors/js/none.js
===================================================================
RCS file: editors/js/none.js
diff -N editors/js/none.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ editors/js/none.js	8 Oct 2008 22:22:03 -0000
@@ -0,0 +1,30 @@
+// $Id: tinymce-3.js,v 1.1 2008/10/05 21:01:20 sun Exp $
+
+Drupal.wysiwyg = Drupal.wysiwyg || { 'init': {}, 'attach': {}, 'detach': {}, 'toggle': {} };
+
+/**
+ * Attach TinyMCE to textareas, using the theme specified in CSS class names.
+ *
+ * @param editorSettings
+ *   An object containing editor settings for each enabled editor theme.
+ */
+Drupal.wysiwyg.attach.none = function(context, params, editorSettings) {
+  console.log(params);
+  if (params.resizable) {
+    $('#' + params.field).addClass('resizable');
+    Drupal.behaviors.textarea();
+  }
+}
+
+/**
+ * Detach all TinyMCE editors.
+ *
+ * @todo Context support required to remove only certain editors (think AHAH/AJAX).
+ */
+Drupal.wysiwyg.detach.none = function(context, params) {
+  var $textarea = $('#' + params.field).removeClass('textarea-processed');
+  var $div = $textarea.parents('div.resizable-textarea');
+  $div.before($textarea);
+  $div.remove();
+}
+
Index: editors/js/tinymce-2.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/tinymce-2.js,v
retrieving revision 1.1
diff -u -p -r1.1 tinymce-2.js
--- editors/js/tinymce-2.js	5 Oct 2008 21:01:20 -0000	1.1
+++ editors/js/tinymce-2.js	8 Oct 2008 23:02:19 -0000
@@ -36,49 +36,28 @@ Drupal.wysiwyg.init.tinymce = function(e
  * @param editorSettings
  *   An object containing editor settings for each enabled editor theme.
  */
-Drupal.wysiwyg.attach.tinymce = function(context, editorSettings) {
-  for (var theme in editorSettings) {
-    // Clone, so original settings are not overwritten.
-    var config = Drupal.wysiwyg.clone(editorSettings[theme]);
-    // Configure settings for this theme.
-    for (var setting in config) {
-      tinyMCE.settings[setting] = config[setting];
-    }
-    $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)', context).each(function() {
-      // Attach Wysiwyg Editor control if default is on.
-      if (Drupal.settings.wysiwygEditor.status) {
-        tinyMCE.execCommand('mceAddControl', true, this.id);
-      }
-      $(this).addClass('wysiwyg-processed');
-    });
+Drupal.wysiwyg.attach.tinymce = function(context, params, editorSettings) {
+  // Configure settings for this theme.
+  for (var setting in editorSettings[params.theme]) {
+    tinyMCE.settings[setting] = editorSettings[params.theme][setting];
+  }
+  // Attach Wysiwyg Editor control if default is on.
+  if (Drupal.settings.wysiwygEditor.status) {
+    tinyMCE.execCommand('mceAddControl', true, params.field);
   }
 }
 
-/**
- * Toggle editor and return new state.
- *
- * @param element
- *   The DOM element to toggle the editor for.
- * @param theme
- *   The editor theme assigned to the element.
- *
- * @return
- *   A boolean value indicating whether the editor has been enabled.
- */
-Drupal.wysiwyg.toggle.tinymce = function(element, theme) {
-  if (tinyMCE.getEditorId(element.id) == null) {
-    // Clone, so original settings are not overwritten.
-    var config = Drupal.wysiwyg.clone(Drupal.settings.wysiwygEditor.configs.tinymce[theme]);
-    // Set configuration options for this theme.
-    for (var setting in config) {
-      tinyMCE.settings[setting] = config[setting];
+Drupal.wysiwyg.detach.tinymce = function(context, params) {
+  if (typeof params != 'undefined') {
+    var editor = tinyMCE.getEditorId(params.field);
+    if (editor) {
+      editor.save();
+      editor.remove();
     }
-    tinyMCE.addMCEControl(element, element.id);
-    return true;
   }
-  else {
-    tinyMCE.removeMCEControl(tinyMCE.getEditorId(element.id));
-    return false;
+  else if (tinyMCE.activeEditor) {
+    tinyMCE.triggerSave();
+    tinyMCE.activeEditor.remove();
   }
 }
 
Index: editors/js/tinymce-3.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/editors/js/tinymce-3.js,v
retrieving revision 1.1
diff -u -p -r1.1 tinymce-3.js
--- editors/js/tinymce-3.js	5 Oct 2008 21:01:20 -0000	1.1
+++ editors/js/tinymce-3.js	8 Oct 2008 20:50:04 -0000
@@ -38,21 +38,14 @@ Drupal.wysiwyg.init.tinymce = function(e
  * @param editorSettings
  *   An object containing editor settings for each enabled editor theme.
  */
-Drupal.wysiwyg.attach.tinymce = function(context, editorSettings) {
-  for (var theme in editorSettings) {
-    // Clone, so original settings are not overwritten.
-    var config = Drupal.wysiwyg.clone(editorSettings[theme]);
-    // Configure settings for this theme.
-    for (var setting in config) {
-      tinyMCE.settings[setting] = config[setting];
-    }
-    $('textarea.wysiwyg-' + theme + ':not(.wysiwyg-processed)', context).each(function() {
-      // Attach Wysiwyg Editor control if default is on.
-      if (Drupal.settings.wysiwygEditor.status) {
-        tinyMCE.execCommand('mceAddControl', true, this.id);
-      }
-      $(this).addClass('wysiwyg-processed');
-    });
+Drupal.wysiwyg.attach.tinymce = function(context, params, editorSettings) {
+  // Configure settings for this theme.
+  for (var setting in editorSettings[params.theme]) {
+    tinyMCE.settings[setting] = editorSettings[params.theme][setting];
+  }
+  // Attach Wysiwyg Editor control if default is on.
+  if (Drupal.settings.wysiwygEditor.status) {
+    tinyMCE.execCommand('mceAddControl', true, params.field);
   }
 }
 
@@ -61,8 +54,15 @@ Drupal.wysiwyg.attach.tinymce = function
  *
  * @todo Context support required to remove only certain editors (think AHAH/AJAX).
  */
-Drupal.wysiwyg.detach.tinymce = function(context) {
-  if (tinyMCE.activeEditor) {
+Drupal.wysiwyg.detach.tinymce = function(context, params) {
+  if (typeof params != 'undefined') {
+    var editor = tinyMCE.get(params.field);
+    if (editor) {
+      editor.save();
+      editor.remove();
+    }
+  }
+  else if (tinyMCE.activeEditor) {
     tinyMCE.triggerSave();
     tinyMCE.activeEditor.remove();
   }
