A number of modules I'm working with add textareas to the node-forms that TinyMCE breaks. (RelatedLinks.module is my particular problem today.)

hook_form_alter should be able to add a "DisableTinyMCE=TRUE" flag to any textarea, disabling TinyMCE for that textarea.

CommentFileSizeAuthor
#1 tinymce_notinymce.patch857 bytestones

Comments

tones’s picture

Status: Active » Needs review
StatusFileSize
new857 bytes

A simple patch, working on my sandbox and so probably ready to be commited.

I used '#notinymce' instead of 'DisableTinyMCE'.

harry slaughter’s picture

I haven't tested this patch, but wanted to add a ++ for the idea.

We need more ways to turn TinyMCE off :)

It's wonderful for a lot of users, but it gets in the way for the rest of us.

Tobias Maier’s picture

I think it is better to introduce a "wysiwyg" variable
which is an boolean (TRUE or FALSE default is FALSE) or an array which offers more functionality

form['mytextarea']['wysiwyg' = array(
  'enabled' => TRUE, //enable the wysiwyg editor
  'disabled tags' => '<h3> <pre> <foo>' //which tags should be forced to be disabled
  'profile' => 'small', // force any special profile or mode...
  );

we should replace the current behaviour which shows the editor by path with a version which only looks for this variable.

tinymce forms alter adds this to the specific textareas

Benifit:
* other modules (FCKeditor etc.) could use it too
--> we could put the function of adding this variable to a textarea in a seperate module (maybe called "WYSIWYG Helper Module")
so that no module has to code it twice

kreynen’s picture

Assigned: tones » kreynen
Priority: Normal » Critical
kreynen’s picture

Status: Needs review » Closed (duplicate)
nathanraft’s picture

#1 seems like a good short term solution. Can someone send on instructions for using the hook_form_alter for a standard page or cck input form?

nathanraft’s picture

Version: master » 4.7.x-1.x-dev

Using #1 above I did the following for a module that creates its own node type. Not sure how to do this for CCK nodes. While this is not the best approach for long term it works for now.

$form['body'] = array(
    '#type' => 'textarea', '#notinymce' => TRUE, '#title' => t('Description'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE, '#weight' => -20
  );

Has anyone started working on a content type settings approach, a minimum textarea size, or any thing else?