Getting the WYSIWYG module to work in Drupal 6
August 13, 2008
Drupal | Javascript | Web Building

I had a lot of trouble getting TinyMCE text editor to work consistently in Drupal 5.9, so when I installed Drupal 6 and was scanning through the available modules, I was very glad to see that the WYSIWYG editor module could function as a replacement.


Although the easy-to-use WYSIWYG editor is popular with our site's users, sometimes I find it gets in the way, and want to turn it off.

Ads by Google

Posted by ellen at August 13, 2008 10:48 PM

However after installing it, I found there was no way to turn it off on a case by case basis, because the "Disable rich-text" link was not working. The javascript error shown was "tinyMCE.getEditorId is not a function"

Some tips on the Drupal forums which led to the solution. First, I had not noticed that the current version of WYSIWYG editor is only compatible with version 2.1.x of TinyMCE. I had installed a later version. So I removed the later version and replaced it with the older one. When I looked at the readme.txt file that comes with the module, it indeed has a note that it is compatible with 2.1x, but of course I hadn't read it while installing!

Error: tinyMCE.getEditorId is not a function

Once the downgrade was in place, there was a NEW javascript error: "editorTemplate is undefined."

Another message on the drupal forums contained a patch which helped fix this issue.
Editor Base Path is being set incorrectly

Go into WYSIWYG-editor.module and patch it:

Index: wysiwyg_editor.module
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg_editor.module,v
retrieving revision 1.16
diff -u -p -r1.16 wysiwyg_editor.module
--- wysiwyg_editor.module 8 Jul 2008 02:54:21 -0000 1.16
+++ wysiwyg_editor.module 29 Jul 2008 15:23:03 -0000
@@ -139,7 +139,7 @@ function wysiwyg_editor_load() {
       'status' => $status,
       // If JS compression is enabled, at least TinyMCE is unable to determine
       // its own base path and exec mode since it can't find the script name.
-      'editorBasePath' => $GLOBALS['base_url'] . base_path() . $path_editor,
+      'editorBasePath' => base_path() . $path_editor,
       'execMode' => $exec_mode,
     )), 'setting');
     // Add our stylesheet to stack editor buttons into one row.

In other words, open wysiwyg_editor.module, and search for 'editorBasePath'

Replace the lines from 'editorBasePath' down to "//Add our stylesheet" as shown below:

'editorBasePath' => base_path() . $path_editor,
'execMode' => $exec_mode,
)), 'setting');
// Add our stylesheet to stack editor buttons into one row.

Save and upload.

Ads by Google

1 Comment

Just now i have installed TinyMCE on CMS drupal successfully but when i want to create a page the buttons not shown, i have checked permission and profile already in correct state.

Ads by Google

 RSS   |   Contact Me

Ads by Google