Hello,

We are using the TinyMCE module with TinyMCE 3.0.5 with Drupal 5.7. When we click the "disable rich-text" link under textareas we receive the following error message in Firebug:

tinyMCE.getEditorId is not a function
mceToggle("edit-code", "wysiwyg4code")
[Break on this error] if (tinyMCE.getEditorId(element.id) == null) {

I'm not sure if this is a bug with the TinyMCE module or with TinyMCE.

Comments

richardjg’s picture

This seems to be a tinyMCE api change between versions 2 and 3.

I fixed this by adding some lines to the top of the mceToggle javascript function (line 139 in tinymce.module) to simulate the old api:

  // paste this just below the line: function mceToggle(id, linkid) {
  if(typeof(tinyMCE.getEditorId) != "function") {

    tinyMCE.getEditorId = tinyMCE.get;
    tinyMCE.removeMCEControl = function(){
      tinyMCE.get(id).remove();
    }
    tinyMCE.addMCEControl = function(){
      tinyMCE.execCommand('mceAddControl', false, id);
    }
  }
edg’s picture

Thanks. That worked for me.

betonarbejder’s picture

Thanks a lot

rfay’s picture

I don't think this is an issue between TinyMCE 2 and TinyMCE 3. I had the problem with version 3, so reverted to TinyMCE 2.1.3 (and uninstalled the Drupal module and reinstalled and reconfigured). Same problem.

Drupal: 5.7
Drupal TinyMCE Module: 5.x-1.9
Tinymce: 2.1.3

erifneerg’s picture

i'm not sure which file needed this change. is the the module files?

tjsheridan’s picture

erifneerg, you change the tinymce.module file located in /modules/tinymce

Also I just wanted to say thanks for this. It works like a charm!

tech_nick’s picture

thanks much, it works for me

1kenthomas’s picture

Solution in #1 works for us.

ibot’s picture

Thanks, your solution ( #1 ) works for me too..

glass.dimly’s picture

(accidental posting--sorry)

glass.dimly’s picture

Disable rich text didn't work for me either, not with tinymce 3.x or 2.1. After pasting the code, it worked for me. This would be a great patch! A lot of drupal newbies depend 100% on Tinymce. tinyMCE's difficulty in configuration and various bugs are Drupal's biggest problems for newcomers.

watbe’s picture

thanks a lot! i've been searching for the solution to this problem for some time now, and this works perfectly!

chirale’s picture

Status: Active » Needs review

Thanks, it works. A patch will be appreciated.

Applying http://drupal.org/node/235972#comment-882611 patch, with Webform module enabled I got a strange behavior on "node/add/webform". One button works, the other works only to enable editor, but this action is performed on the other textarea. I got:

Error: tinyMCE.get(id) has no properties
Line: 63

watbe’s picture

wait a sec, it only works for the first En/disable rich text toggle on a page.

The next ones you click won't work.......

any fix?

watbe’s picture

Status: Needs review » Reviewed & tested by the community

still doesn't work....

watbe’s picture

Status: Reviewed & tested by the community » Needs work

changed issue status

tobiass’s picture

I'm not sure, but it seems that this is a duplicate of http://drupal.org/node/235972

gpk’s picture

Status: Needs work » Active

#1 worked nicely for me with tinymce.module 5.x-1.9, Drupal 5.7 (with default jQuery which I think is 1.1.2) and TinyMCE 3.1.0.1.

There is actually not a proper patch file attached to this issue so resetting Status.

wmostrey’s picture

Status: Active » Closed (duplicate)

I created a patch and added it to http://drupal.org/node/269527.

jenlampton’s picture

fix in #1 worked for me also, thanks so much!!

kenorb’s picture

When I've applied patch #1, I've followed javascript errors:

tinyMCE.addI18n is not a function
[Break on this error] more_colors:"Wi\u0119cej kolor\u00F3w"
pl.js (line 61)
tinyMCE.addI18n is not a function
[Break on this error] desc:"Wstaw lini\u0119."
pl.js (line 153)
r is null

Maybe that's, because I have different language set than English.
So it doesn't work for me.

Tested on TinyMCE 3.2 + TinyMCE 6.x-dev

kenorb’s picture

Ad #31
Sorry, the first error lines was related to different issue: http://drupal.org/node/324099
But the patch still doesn't work.
I've tried this one: http://drupal.org/node/235972#comment-882611
But doesn't work as well, but maybe will work for somebody.

wasilij’s picture

richardjg

Thank you very much

juroon’s picture

Wow, thanks. This worked in Drupal 5.16

I manually added the lines as described in #1, refreshed my page, and the enable/disable links toggle perfectly.

gpk’s picture

As the project page http://drupal.org/project/tinymce says, most users should probably be using the http://drupal.org/project/wysiwyg module since this one is not maintained any more.

Though I'm still running the now rather antiquated setup of #18 on a couple of sites that I've not yet upgraded/migrated.

bookish’s picture

Thanks richardjg,
it worked for me

Michel