+44 7881601035 Skype: dangibas

HYGEN Blog

Web Design • Web Development • Project Management • Travel

HYGEN Blog HomeHome » WYSIWYG: The version of TinyMCE could not be detected

Dan Gibas

Dan Gibas, Director, HYGEN HYGEN Web Design
A British expat web monkey living in Malaysia. Hire me!

WYSIWYG: The version of TinyMCE could not be detected

February 21st, 2010 | by admin |

TinyMCE - Bug In WYSIWYG Drupal Module

TinyMCE - Bug In WYSIWYG Drupal Module

There is a bug currently in the WYSIWYG module for Drupal affecting TinyMCE which seems to be in the queue for patching into the stable release.

When trying to add TinyMCE to sites/all/libraries/tinymce and then going to the modules admin page for WYSIWYG you will get an error:

The version of TinyMCE could not be detected.

To temporarily fix this with a quick hack / patch (not much of a difference in this case!) navigate to the following function in modules/wysiwyg/editors/tinymce.inc:

function wysiwyg_tinymce_version($editor) {
  $script = $editor['library path'] . '/tiny_mce.js';
  $script = fopen($script, 'r');
  // Version is contained in the first 80 chars.
  $line = fgets($script, 80);
  // 2.x: this.majorVersion="2";this.minorVersion="1.3"
  // 3.x: majorVersion:'3',minorVersion:'2.0.1'
  if (preg_match('@majorVersion[=:]["\'](\d).+?minorVersion[=:]["\']([\d\.]+)@', $line, $version)) {
    fclose($script);
    return $version[1] . '.' . $version[2];
  }
  fclose($script);
}

Change the line:

$line = fgets($script, 80);

To:

$line = fgets($script, 100);

No reload the WYSIWYG modules page and TinyMCE should be available!

2 Responses to “WYSIWYG: The version of TinyMCE could not be detected”

  1. 2
    Steve Kessler Says:

    I had the same bug but the module already had 100 in the field so I made it 255 and it worked great. Someone could count the characters and figure out what this number needs to be for sure but this works great.

    -Steve

  2. 1
    kevin Says:

    This worked a treat, thanks!

Leave a Reply

Blogging Links

Blog Top List Blog Top List Blog Rankings Blogarama Web Design Blogs - BlogCatalog Blog Directory Web design blogs
BlogMalaysia.com Hygen Web Design at Blogged expat Kuala Lumpur

Games