WYSIWYG: The version of TinyMCE could not be detected
February 21st, 2010 | by admin |
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!
Home
HYGEN Web Design

December 23rd, 2010 at 8:18 pm
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
March 5th, 2010 at 5:57 pm
This worked a treat, thanks!