I am observing that TinyMCE changes the code even if toggled to OFF (by link below the textarea). This can be very annoying, if I want exactly the code I've manually entered (with certain intensions). Example: If I save the empty field, the following code is found as the content after: <p><br mce_bogus="1"></p>

How to prevent that? For me, the best option would be to be able to have TinyMCE enabled for all textfields, so I can enter quickly the code just typing. But, generally I would switch it later (before saving) off, review the code and SAVE IT EXACTLY AS I'VE SEEN IT JUST BEFORE. Can this be achieved by any combination of settings (TinyMCE init scripts)?

As I presume the answer is no, is there a simple way to disable TinyMCE for all fields (textareas) but to enable it for only some (for example 1 textarea in contact form and comments only)? As in this case I prefer to enter site content manually (to have a full control over it) and to provide it for (unskilled) site visitors only. But, it is extremely uncomfortable to search the site all the time for any new (or, renamed) textareas, to include them to the exclude list, in particular as field IDs are displayed for all users (when this option is selected; wouldn't it make sense to show it only to some roles, as site admins?!)... Because, if I miss some in admin section, and save such a page (with an empty textarea, overlooking that TinyMCE is present - even if disabled), TinyMCE "unvisible additions" can easily enter something what can cause a totally different behavior of that module... I've had such experience already, and it can be a hell to track why the site is suddenly broken! In Drupal 5 with TinyMCE module, I've had always /admin path disabled! TinyTinyMCE doesn't support this, unfortunately (by the way, that feature wouldn't make it much less tiny, but much more flexible and useful!).

I've tried to use : mode : "exact" / elements: "edit-submitted-1234567890", but TinyMCE is still present for both contact form textareas, with the only difference that for the one with ID=1234567890 it can not be toggled off anymore. Is this exactly how it is supposed to work at all?! Reading the documentation on TinyMCE wiki, I would say no (but, it works on my site exactly like that).

Another issue I have is that I would sometimes need to see textareas as certain users (roles) do. This means that I shall be able to somehow select which mode is applied to each textarea for a site admin (generally a role having the usage of both modes enabled; probably this would be easy to achieve if there would be a list of textareas for which a simple mode is always forced). This feature would be convenient also for other users (being allowed to use both modes), for instance in case when it is desired to keep some textareas relatively small, but advanced mode with a big toolbar can not fulfill that...

Comments

Steve Lockwood’s picture

I am observing that TinyMCE changes the code even if toggled to OFF (by link below the textarea). This can be very annoying, if I want exactly the code I've manually entered (with certain intensions). Example: If I save the empty field, the following code is found as the content after:


How to prevent that? For me, the best option would be to be able to have TinyMCE enabled for all textfields, so I can enter quickly the code just typing. But, generally I would switch it later (before saving) off, review the code and SAVE IT EXACTLY AS I'VE SEEN IT JUST BEFORE. Can this be achieved by any combination of settings (TinyMCE init scripts)?

As soon as TinyMCE switches on it will convert any plain text (even a blank line) into proper HTML - I don't know how to alter this behaviour. The only control within the tinytinymce module is to disable or switch off TinyMCE for that block using "Exclude these text areas: " or "Exclude these text areas: ". If you don't do this the rich text editor will be switched on for all textareas (unless they are in admin screens).

Are you wanting to enter php code? that's easy: turn off the rich text, enter <?php at the very start of the textarea, then the rest of your code. The rich text editor will stay switched off the next time you edit.

As I presume the answer is no, is there a simple way to disable TinyMCE for all fields (textareas) but to enable it for only some (for example 1 textarea in contact form and comments only)? As in this case I prefer to enter site content manually (to have a full control over it) and to provide it for (unskilled) site visitors only. But, it is extremely uncomfortable to search the site all the time for any new (or, renamed) textareas, to include them to the exclude list, in particular as field IDs are displayed for all users (when this option is selected; wouldn't it make sense to show it only to some roles, as site admins?!)... Because, if I miss some in admin section, and save such a page (with an empty textarea, overlooking that TinyMCE is present - even if disabled), TinyMCE "unvisible additions" can easily enter something what can cause a totally different behavior of that module... I've had such experience already, and it can be a hell to track why the site is suddenly broken! In Drupal 5 with TinyMCE module, I've had always /admin path disabled! TinyTinyMCE doesn't support this, unfortunately (by the way, that feature wouldn't make it much less tiny, but much more flexible and useful!).

At the moment it is on for all textareas unless specifically excluded (or in admin screens). I will think about adding more flexible options.

I've tried to use : mode : "exact" / elements: "edit-submitted-1234567890", but TinyMCE is still present for both contact form textareas, with the only difference that for the one with ID=1234567890 it can not be toggled off anymore. Is this exactly how it is supposed to work at all?! Reading the documentation on TinyMCE wiki, I would say no (but, it works on my site exactly like that).

The elements declaration in the init script is commented out so has no effect - but even if you removed the comments it would be overridden by the module when it starts up.

Another issue I have is that I would sometimes need to see textareas as certain users (roles) do. This means that I shall be able to somehow select which mode is applied to each textarea for a site admin (generally a role having the usage of both modes enabled; probably this would be easy to achieve if there would be a list of textareas for which a simple mode is always forced). This feature would be convenient also for other users (being allowed to use both modes), for instance in case when it is desired to keep some textareas relatively small, but advanced mode with a big toolbar can not fulfill that...

That would be quite tricky - but I'll have think about it.

luti’s picture

Thank you for a prompt feedback, Steve, as well as for your good intensions.

About:

I've tried to use : mode : "exact" / elements: "edit-submitted-1234567890", but TinyMCE is still present for both contact form textareas, with the only difference that for the one with ID=1234567890 it can not be toggled off anymore. Is this exactly how it is supposed to work at all?! Reading the documentation on TinyMCE wiki, I would say no (but, it works on my site exactly like that).

The elements declaration in the init script is commented out so has no effect - but even if you removed the comments it would be overridden by the module when it starts up.

I have removed the comments, of course, as well as entered ID="edit-submitted-1234567890" (instead of the default one).

Why it is overridden? Or, better said, why do we have a chance to enter something that is neglected (overridden later) - without us being even aware of that - at all (it is a bit confusing, isn't it?). And, how to make the module not override it (or, where in the module to make changes to achieve the desired effect)?

In any case, the settings as above do not seem to be 100% neglected, as there is some effect (as described in my original post) - toggle the reach-text editor on/off for such a textarea doesn't work anymore.