hello,

I noticed that for some of the text-areas with TinyMCE enabled, what happens is that there are thick grey areas on both left and right sides, which makes the writing area really small.

How can I get rid of this?

thanks

Comments

stephthegeek’s picture

I'm not in front of a TinyMCE installation right now, but I seem to remember this might happen when you have a lot of buttons enabled on the TinyMCE toolbar, so that it pushes out the width. You can reduce the number of buttons by eliminating those you don't need in the TinyMCE settings.

drupalina’s picture

I have 22 buttons in a single row. But removing the buttons only makes the box narrower and therefor smaller. Without TinyMCE that text-area (for instance freelisting in profiles) would display as 100% width. And that's what I want to achieve, but with TinyMCE enabled.

jwolf’s picture

Add the following function to your theme's template.php file:

/**
* Customize a TinyMCE theme.
*
* @param init
*   An array of settings TinyMCE should invoke a theme. You may override any
*   of the TinyMCE settings. Details here:
*
*    http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
*
* @param textarea_name
*   The name of the textarea TinyMCE wants to enable.
*
* @param theme_name
*   The default tinymce theme name to be enabled for this textarea. The
*   sitewide default is 'simple', but the user may also override this.
*
* @param is_running
*   A boolean flag that identifies id TinyMCE is currently running for this
*   request life cycle. It can be ignored.
*/
function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {

  switch ($textarea_name) {
    // Disable tinymce for these textareas
    case 'log': // book and page log
    case 'img_assist_pages':
    case 'caption': // signature
    case 'pages':
    case 'access_pages': //TinyMCE profile settings.
    case 'user_mail_welcome_body': // user config settings
    case 'user_mail_approval_body': // user config settings
    case 'user_mail_pass_body': // user config settings
    case 'synonyms': // taxonomy terms
    case 'description': // taxonomy terms
      unset($init);
      break;

    // Force the 'simple' theme for some of the smaller textareas.
    case 'signature':
    case 'site_mission':
    case 'site_footer':
    case 'site_offline_message':
    case 'page_help':
    case 'user_registration_help':
    case 'user_picture_guidelines':
      $init['theme'] = 'simple';
      foreach ($init as $k => $v) {
        if (strstr($k, 'theme_advanced_')) unset($init[$k]);
      }
      break;
  }

  // Add some extra features when using the advanced theme. 
  // If $init is available, we can extend it
  if (isset($init)) {
    switch ($theme_name) {
     case 'advanced':
   $init['width'] = '100%';
       break;
  
    }
  }

  // Always return $init
  return $init;
}
drupalina’s picture

Worked like a charm. Thank you so much!!!

I don't know if it had implications elsewhere... but from what I see it works perfectly.

Am I the first one to use this code or was it tested before by other people?

Thanks again

sharique’s picture

Thanks,
----
Sharique uddin Ahmed Farooqui
Web Developer
http://it.Managefolio.com

Sharique Ahmed Farooqui

makbeta’s picture

Thank you so much, that fixed my biggest issue.
Appreciate your help.

physiotek’s picture

thanks.
exactly what i was looking for!
pht3k

Anonymous’s picture

For those who can't fix the problem even with this snippet, you can also fix the problem using css by overriding the inline rules with something like this:


/* TinyMCE Styles */

table.mceEditor{
	width:98% !important;
}
iframe.mceEditorIframe{
	width:100% !important;
}

The Drupal Agency >> www.raincitystudios.com <<
Me on the Web >> www.couzinhub.com <<