The "enable/disable rich text" is unavailable. I've attached a patch that corrects this (1 patch for tinymce 2.x and 1 patch for tinymce 3.x). The code has been adjusted to work with TinyMCE 3.0.

Explanation of what I did to get this to work.
- Add Enable/Disable
-- Add code to include $wysiwyg_link as a suffix to the processed element ($element['#suffix'] .= $wysiwyg_link)
- Adjust to TinyMCE 3.0
-- Change tinyMCE.getEditorId() to tinyMCE.get()
-- Change tinyMCE.addMCEControl(element, element.id) to tinyMCE.execCommand('mceAddControl',false,element.id);
-- Change tinyMCE.removeMCEControl(tinyMCE.getEditorId(element.id)); to tinyMCE.execCommand('mceRemoveControl',false,element.id);

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thecarlhall’s picture

Status: Active » Needs review
yhager’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch for tinyMCE 3.x works fine.

I am not sure this is related:
I select 'disabled' as tinyMCE default state in my user settings page. TinyMCE default state is still enabled when I try to edit a page, but the text below says 'Enable rich text editor'. When I click it, tinyMCE is disabled..

Bundus’s picture

Status: Reviewed & tested by the community » Needs work

I applied the patch but it doesn't take into account the default status. My profile has the box set to disabled by default but when I go to create content the editor appears but the link reads "enable rich-text". If I click on the "enable rich-text" the editor vanishes but the link remains the same (basically getting back in sync).

thecarlhall’s picture

I'll work on getting the patches updated to use the default state setting correctly.

asak’s picture

sub. (coming from here)

keva’s picture

subscribing

esolano’s picture

Status: Needs work » Needs review
FileSize
2.27 KB

Hi all. There seems to be a little bug in tinymce.module (version tinymce-6.x-1.1-dev.tar.gz) that overrides the default status. It is on line 501 (after applying thecarlhall's patch) under the tinymce_config() function; and it says: $status = 'true';. So go ahead and remove that single line, or apply the patch I created, and it should work fine.

Best Regards!

Shark Tek’s picture

Any guide on how to apply the patch for tinymce 3.x?

christefano’s picture

subscribing

asak’s picture

@esolano: nice job! it works perfect now.

raspberryman’s picture

#7 works beautifully. Thank you!

yhager’s picture

Status: Needs review » Reviewed & tested by the community

#7 works for me as well

raspberryman’s picture

Hmm, don't know why yet but:

1) Create a Webform 6.x-2.0-beta5
2) Go to the edit page for that Webform

The screen is white except for:

<html><head></head><body><div><a href="javascript:mceToggle('edit-body', 'wysiwyg4body');" id="wysiwyg4body">disable rich-text</a></div><div><a href="javascript:mceToggle('edit-webform-confirmation', 'wysiwyg4webform-confirmation');" id="wysiwyg4webform-confirmation">disable rich-text</a></div></body></html>

Plus it looks like the page is still trying to load. But nothing else comes up.

Riccardo83’s picture

Works like a charm, thanks mate...

keva’s picture

#13 -
I'm having a very similar issue, but with other pages.
http://drupal.org/node/254396

rmiddle’s picture

That patch didn't work for me. It is kinda late need to check into why tomorrow just might the patch fubar'd the module. Wouldn't be the 1st time.

AD-DA’s picture

For TinyMCE 3.0 I would rather use the recommended form given in the TinyMCE examples:

tinyMCE.getInstanceById(element.id) instead of tinyMCE.get()

The example is available at http://wiki.moxiecode.com/examples/tinymce/installation_example_07.php and the toggle function is:

function toggleEditor(id) {
	if (!tinyMCE.getInstanceById(id))
		tinyMCE.execCommand('mceAddControl', false, id);
	else
		tinyMCE.execCommand('mceRemoveControl', false, id);
}
bell’s picture

I'm new to Drupal. Where/how do I apply the TinyMCE 3.0 patch? Does the patch get added to an existing file? Replace something in an existing file? Get added to a directory?

Thanks!

bell’s picture

I applied the patch as follows:

  1. Downloaded tinymce.module to my PC.
  2. Cut and pasted the lines of code in the patch, deleting the lines marked "-" and adding the lines marked "=".
  3. Saved and uploaded the revised version of tinymice.module.

Works like a charm.

I figure there must be an easier way to do this, however. Is there? What is it?

Thanks.

Murz’s picture

#7 patch works good with Drupal 6.2 and TinyMCE 3.0.8, thanks!
But I can't find method to disable code cleanup in TinyMCE 3.x, all PHP codes TinyMCE removes :(
Maybe anybody know how to disable cleanup?
For example, I have text on body

<p>This is a php test: <?php echo "Hello world!"; ?> Test ended.</p>

When I turn off TinyMCE with "disable rich-text", put this text and saves the node, all works good.
But when I press "Preview" button, TinyMCE loads again and removes all my php codes, the body becomes like this:

<p>This is a php test:  Test ended.</p>

In Drupal 5.x and TinyMCE 2.x this method works good, the code always staying unchanged.

Murz’s picture

#17 Andjety, thanks for info! With your method function mceToggle() must work more quickly:

<script>
  function mceToggle(id, linkid) {
    link = document.getElementById(linkid);
    img_assist = document.getElementById('img_assist-link-'+ id);

    if (!tinyMCE.getInstanceById(id)) {
      tinyMCE.execCommand('mceAddControl',false, id);
      link.innerHTML = '$disable';
      link.href = "javascript:mceToggle('" +id+ "', '" +linkid+ "');";
      if (img_assist)
        img_assist.innerHTML = '';
      link.blur();
    }
    else {
      tinyMCE.execCommand('mceRemoveControl',false,id);
      link.innerHTML = '$enable';
      link.href = "javascript:mceToggle('" +id+ "', '" +linkid+ "');";
      if (img_assist)
        img_assist.innerHTML = img_assist_default_link;
      link.blur();
    }
  }
</script>

On my Drupal 6.3 & TinyMCE 3.0.8 works perfectly!

Murz’s picture

About #20 problem with eating PHP code by TinyMCE i have found a thread on TinyMCE forum:
http://tinymce.moxiecode.com/punbb/viewtopic.php?id=10778
But it have no answer at now. Maybe later..

Murz’s picture

I have found a codeprotect TinyMCE 3.x plugin that protect php code from removing!
http://sourceforge.net/tracker/index.php?func=detail&aid=1901590&group_i...

Murz’s picture

With enabled TinyMCE 'disable rich-text' link module does not work on admin/build/block/* pages. I have found and correct the problem, patch from tinymce-6.x-1.1-dev is attached.

And I have attached a full pached module and TinyMCE 3.0.8 with working codeprotect plugin for protecting remove php areas code (<?php some_text that must not be removed ?>).

pieter333’s picture

Hi Murz,

Thank you very much for your archive file!!! It works perfect.
But I discovered something, if I turn on in "admin/settings/performance" to put all javascript files into one file, I get the following error when a page is trying to load TinyMCE:

Firebug error log:

u is undefined
[Break on this error] ;var tinymce={majorVersion:'3',minorVers....js,v 1.2 2007/11/19 10:05:48 goba Exp $
4ce77cb5...62f498.js (line 2990)
tinyMCE is undefined
[Break on this error] tinyMCE.init({
edit (line 40)
tinyMCE is undefined
[Break on this error] tinyMCE.init({
edit (line 69)

Does anyone know how to fix this?

LUTi’s picture

Drupal 6.3? Murz???

sun’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
abe.lincoln’s picture

thecarlhall & esolano - THANK YOU! works perfectly!

gillianH’s picture

Thanks thecarlhall and esolano - the patch fixed my problems with TinyMCE - or appeared to...

I now have the enable/disable links, but while enable enables, disable doesn't do anything. I can follow PHP and JavaScript a bit, but am just a beginner in these languages, so I'm not really sure where to look.

Here's my configuration:

Drupal 6.2
TinyMCE plugin 6.x-1.1-dev
TinyMCE 3.1.0.1
PHP 5.2.6
Windows XP

I'm adding this bit second in case it turns out to be completely irrelevant, in which case you can stop reading!

If I enable the Error console - I'm using Firefox 2.0.0.15 - I noticed that the following error occurs:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: http://domain-not-yet-registered-so- omitted/sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/tiny_mce.js?v :: anonymous :: line 1" data: no]

I don't know whether this is relevant - other posts have reported errors like this with TinyMCE, but seem to indicate it is not necessarily harmful, or that it is to do with the TinyMCE compressor. I'm not using the compressor at the moment.

Just to be really annoying the JavaScript file complained about seems to consist of one very long line, so the fact that it complains about line 1 is not very helpful. I tried running 'od -c' on it via cygwin to see if there was a CR/LF Unix/windows problem but there's not a single \n nor \r in it anywhere.

Any help welcome!

gillianH

mariagwyn’s picture

Status: Closed (duplicate) » Active

@Murz: this tar file works very well at allowing the enable/disable button to appear. thank you!!!!!

However: it does not seem to attend to the default state (which I have as disabled for both user and overall). So, every time I edit a page with php, it wipes the php out and I have to disable and repaste the code.

I applied the patch listed above (escalano?) and it works fine. Perhaps you can incorporate this into the tar?

@sun: this does not appear to be a duplicate as the issue you reference is for 5.x not 6.x. I am changing the settings since this is the only workable solution I have found so far for the issues mentioned specific to 6.x.

And it is ACTIVE b/c this is still not in the 6.x dev version. I am not sure it is perfect, but it is the easiest fix so far.

spiffyd’s picture

Priority: Normal » Critical

I am using the TinyMCE v3 patch. Whenever a page with the TinyMCE editor loads, I see the page loads then quickly overlayed with white screen with a link that says "disable rich text." The page then doesn't seem to stop loading.

Suggestions? Please advise.

rmiddle’s picture

#31,

I had the same problem. I uninstall TinyMCE delete it database tables and reinstalled and the problem went away.

Thanks
Robert

spiffyd’s picture

@Robert...

I uninstalled TinyMCE, deleted the files, and did a fresh reinstall. The problem still came back right after I applied the patch. Had to reverse it b/c of that... so still no enable/disable funcionality at this moment. I recalled the patch worked for a short period of time before in the past, but I cannot recall what I did. Perhaps this could be a conflict with other modules or something.

rmiddle’s picture

I had to clear the database records. It has something to with the Version 5 database info.

Thanks
Robert

spiffyd’s picture

@ Robert... I thought unchecking the module, then uninstalling it would clear the DB records. Correct me if I'm wrong.

or did you go into PHPMyAdmin to manually clear tables/entries? If so which ones did you clear?

rmiddle’s picture

spiffyd,

I it has been some time since I had to do that. If when you reinstall the settings are still there it means the uninstall didn't work right.

Thanks
Robert

bflora’s picture

I'm having the same problem as spiffyd....and uninstalling and reinstalling tinymce isn't solving it at all.

I think there's some issue with javascript/jquery at play here.

Anyone know how to fix this? My site's more or less become unusable.

spiffyd’s picture

spiffyd’s picture

FileSize
3.14 KB

This bug is fixed with a patch named: ToggleTinyMCE.patch

I found it on another thread... I'll post the link here as soon as I dig it up again! But in the meantime, try the attachment.

bflora’s picture

I ended up fixing this by hacking tinymce to add in the rich-text toggle via jquery. I can't find the link to the explanation but a search should turn it up.

sun’s picture

Please note that the TinyMCE module for Drupal is unmaintained since quite a long time. You might want to consider upgrading to Wysiwyg API, which is continuously improved.

bflora’s picture

Hey sun,

I think I've seen you suggesting the wsywyg api elsewhere.

I'm not going to use it right now and I'll explain why in the hopes that the feedback will lead to a better module. I do not have a technical background. I'm a writer who chose Drupal to build an online magazine on since everyone said it was great. I speak for non-technical people building Drupal sites.

First impressions when I click on that link:

1. I see a big red box with "needs work" written in it. This is a clear sign that I don't want to run this unless I'm a programmer.

2. Instead of a description and a link to download the module, like I see on all other module pages, I see 8 boxes with a bunch of info in each of them. If I want to offer my readers a wysiwig text editor, why are there 8 pieces to it? That seems unnecessarily complicated for a solution.

3. I see a "experimental code" in bold letters. Another red flag. Quite a few modules that say they work don't. Something that claims to probably not work probably won't.

4. The overall goal of the project is to: "Abstract the configuration and integration for any client-side editor in one module, and allow Drupal modules to interact with any client-side editor."

This does not coincide with my goal to "offer my users a rich text editor." In fact I'm not sure how it relates at all.

So that's why I'm sticking with the tinymce. Does it suck? Kind of. yeah. But it more or less works and its just one module, not a whole handful with technical names.

astoltz’s picture

This is the patch that worked for me including the default enable/disable status except for one detail. In tinymce.module change line 246 from:

// Load a TinyMCE init for each textarea.
if ($init) drupal_add_js($tinymce_invoke, 'inline');

to:

// Load a TinyMCE init for each textarea.
if ($init && $status == 'true') drupal_add_js($tinymce_invoke, 'inline');

I don't have access to make a patch at this time.

christefano’s picture

Status: Active » Needs review
FileSize
576 bytes
541 bytes

I haven't tested andyl56's proposed change in #43 yet, but here it is in patch form for both TinyMCE 6.x-dev and 5.x-dev. Please review.

caspercash’s picture

#7 works for me! many thanks bords!

inventfilm’s picture

I read post #19 and wrote some php to do exact what you said (except it's a + sign not an =) and made an easier way:

http://files.inventfilm.com/drupal/patcher.php

I put the text of the patch in the patch box, and the text of the module in the module box and it worked for me.

Feel free to use this for other module, as it should work (in theory).

NOTE: This patch gives me the link to disable/enable the editor, but now when I go to Site Configuration, TinyMCE, and try to edit a profile, it won't load. As per http://drupal.org/node/254396

edit- Post #21 on http://drupal.org/node/235972 fixed the issue replaced the code on line 209 (after applying the first patch on this page).

edit2- Still get "You must select at least one role." error when updating a profile.

docker’s picture

Works fine. Thanks!

pcorbett’s picture

#39 works for me except that if you select that TinyMCE is OFF by default, it still appears ON on pages. The disable/enable toggle is always there, so this isn't a critical issue, and I don't have the time right now to fix this. #43 breaks #39 (doesn't show the toggle) if it is set to be OFF by default.

sun’s picture

Status: Needs review » Closed (won't fix)

@bflora: Thanks for taking the time to provide some feedback. That's very appreciated. I hope that all of the issues you mentioned are fixed now. Please let me know if there still are "unfriendly" things flowing around. Thanks!

@all:

Please have a look at the TinyMCE project page. Marking as won't fix. (actually, it [still] works in Wysiwyg API)

helloari’s picture

i had this same issue and found this page to be confusing. i don't know how to apply a diff file/patch. and i see the note at the top of the TinyMCE page says to stop using it and use the "Wysiwyg API" instead. i assume that advice applies to TinyTinyMCE - which sounds good but i have not tried.

but i found a simpler solution! on the TinyMCE edit page:
admin/settings/tinymce/edit/TinyMCE%2Bprofile%2B1
i went to the "Buttons and plugins" section and enabled the "code" button. this added a "html" button to the tinyMCE menu that gives similar functionality as the "disable rich text" button that wasn't appearing for me.

sun’s picture

I have no idea what made you assume that.

Actually, the notice applies to the Drupal TinyMCE module. That is why it is on this project page and not on tinytinymce's project page.

diseño web palma de Mallorca’s picture

uff, Im not sweating any more,

cheers !!

qasimzee’s picture

The patch worked for me.

It will be better, if you guys add this issue to the project page.

gone404’s picture

The last line:
-- Change tinyMCE.removeMCEControl(tinyMCE.getEditorId(element.id)); to tinyMCE.execCommand('mceRemoveControl',false,element.id);

Doesn't work for me. Changing it to: "tinyMCE.execCommand('mceRemoveControl', false, params.field)" fixed things.

I am guessing that this goes for the other references to element.id.