Sometimes it is necessary to keep TinyMCE completely out of a given textarea.

With this patch, any textarea you define with class="mceNoEditor" will have no TinyMCE dressing added.

Index: tinymce/tinymce.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tinymce/tinymce.module,v
retrieving revision 1.92
diff -u -r1.92 tinymce.module
--- tinymce/tinymce.module	31 Jul 2007 14:40:36 -0000	1.92
+++ tinymce/tinymce.module	29 Oct 2007 19:52:56 -0000
@@ -78,6 +78,10 @@
   global $user;
   static $profile_name;
 
+  // If FAPI element has a class set with mceNoEditor, don't add TinyMCE.
+  if ($element['#attributes']['class'] == 'mceNoEditor') {
+    return $element;
+  }
   //$element is an array of attributes for the textarea but there is no just 'name' value, so we extract this from the #id field
   $textarea_name = substr($element['#id'], strpos($element['#id'], '-') + 1);
 
CommentFileSizeAuthor
mceNoEditor.patch779 bytesamanuel

Comments

amanuel’s picture

An example FAPI definition may be in order here:

The following body definition would have no TinyMCE applied to it.

  $form['body'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($type->body_label),
    '#default_value' => $node->body,
    '#rows' => 3,
    '#cols' => 60,
    '#attributes' => array('class' => 'mceNoEditor'),
    '#required' => TRUE
  );
amanuel’s picture

Status: Needs review » Reviewed & tested by the community

Works as advertised.

geek-merlin’s picture

this would be great so that my "exec php" from devel module does not become wysiwyg.

i would advice to change it to "nowysiwyg" or something like this so other wysiwyg projecs can easier follow ;-)

sun’s picture

Status: Reviewed & tested by the community » Closed (won't fix)
amanuel’s picture

Status: Closed (won't fix) » Needs work

@Sun, wysiwyg module is great but this IMO is still necessary feature for TinyMCE for those that don't use the wysiwyg module.

Thanks for pointing out wysiwyg though....but this has lingered so long now though I wonder if the patch will still apply.

I won't update till I hear from one of the devs.

sun’s picture

Status: Needs work » Fixed

Sorry, you won't hear from the devs. Look at the queue of this project. Some really important issues languish in the queue since more than one year. With important, I'm referring to bug fixes, not feature requests like this issue.

To override the default list of skipped textareas in TinyMCE module, you should implement a theme override function for theme_tinymce_theme() in your theme's template.php.

Implementing a #wysiwyg property for TinyMCE is absolutely out of scope currently.

celstonvml’s picture

Personally, I don't like putting in logic in my theme template.php file. Suppose I want to use an out-of-the-box theme? Suppose I want to create a re-usable module that enables/disables TinyMCE regardless of theme?

I may explore the wysiwyg module but this patch works fine for my current needs. Thank you.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.