Lots of additional settings:
- height and width of editor
- use current drupal theme css, tinymce default css, or define path to your own
- set toolbar to top or bottom, left or right aligned
- set 'Cleanup Word HTML' to automatically clean up nasty Word formatting when pasted (in IE)
- verify html on/off (stops clobbering of [head])
- set behavior of enter/return to [p] or [br]
- etc etc...
"swap textareas dynamically" setting adds javascript link below all textareas allowing WYSIWYG to be turned on and off on-the-fly for that particular textarea.
Enjoy!
-jeff
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | tinymce.jjeff_1.patch | 11.92 KB | jjeff |
| #4 | tinymce.jjeff_0.patch | 14.43 KB | jjeff |
| tinymce.jjeff.patch | 11.57 KB | jjeff |
Comments
Comment #1
(not verified) commentedWow!
A definate +1 from me.
Most of my wishlist is taken care of with this patch, and it all works nicely in my tests.
One nice small addition would be to set a minimum editor height (depending on how much room the toolbar takes), so that if wysiwyg is turned on in the small textareas in 'my account'-'edit', there is still room left to write some content.
Comment #2
richardb commentedThat +1 was from me BTW, forgot to login...
Comment #3
richardb commentedI notice setting the width of the editor gives strange results.
Looking with the DOM viewer the element gets the correct size settings, but it actually displays far to large, almost 3 pages wide.
Leaving width blank, and setting height to 500 or so gives a good result, giving a slightly larger editor window.
I tried it with various drupal themes with the same result.
Comment #4
jjeff commentedThanks Richard!
Here's a new version of the patch. I found a bug in the way that the CSS stuff was working (or not working in this case). This should fix it.
Pretty cool: set the CSS setting to 'use drupal theme' and the editor will automagically match page background, fonts, link colors, etc... and the 'styles' dropdown contains classes from the theme.
-Jeff
Comment #5
richardb commentedHi,
i tried the new patch, there are a few issues:
The width setting is not correct yet.
When you click on a textarea you get a javascript error:
Error: instance is not defined
Source File: http://10.0.0.6/drupal-cvs/modules/tinymce/tinymce/jscripts/tiny_mce/tin...
Line: 9
In Firefox.
Also.a nice feature would be that if a user selected the wysiwyg editor for a certain textarea, that this setting would be remembered the next time they use the same textarea.
And... the 'styles' dropdown containing the classes from the theme is nice, but there tend to be a lot of unneeded classes in the list. Nicer stil would be to show all available classes on the admin-settings page, and allow the admin to select which should be used.
Totally cool would be if you use a table showing a checkbox, the classname, and some example text with the class applied...
Just some ideas though... see what you think.
Comment #6
jjeff commentedHere's a new patch that fixes a few bugs including everything getting stuck into a [pre] tag. And (perhaps) some below.
I haven't replicated this in Firefox on my Mac, but I've changed the way the the numbers are displayed (as integers rather than strings). This might solve your problem. Let me know.
Hmmm... Again, I'm not replicating. I'll fire up the Windows machine in the next day or so and see what I can figure out. In the meantime, you can go into the module code and do a search and replace to change "tiny_mce.js" to "tiny_mce_src.js". The tiny_mce.js file has all of the spaces and linebreaks removed, so basically EVERYTHING is on Line 9. The tiny_mce_src.js version will give me a better idea where the problem is really happening.
There's not really an easy way to get this to work. Javascript variables are basically flushed every time you open a new page and there's not a trivial way of getting Drupal to know what textareas the user has enabled the wysiwyg for.
The contents of the styles dropdown can be defined on the settings page for this module. Actually parsing the css to "pull out" the classes is also not trivial. Frankly, I was amazed to see TinyMCE doing that. I'm not about to attempt to recreate it myself in PHP.
The main issue in working with tinyMCE is that there are anomalies (a.k.a. bugs) in the module and there are anomalies (a.k.a. bugs) in the tinyMCE javascript. Sometimes it's hard to tell where the problems are coming from.
Again, I'll fire up the Windows machine and see what I can see. In the meantime, try and be as specific as possible about the problems you are seeing.
Thanks,
Jeff
Comment #7
richardb commentedHi,
It's looking good.
I'm testing this on Linux BTW, so there shouldn't be too many differences with MAC Firefox.
(If people can submit Windows bugs + fixes where needed that would be great)
The width problem is now resolved.
The javascript error was a tinymce bug, which I also had without your patch I found out.
I'm now using tinymce from CVS and the problem is resolved.
Don't worry about the class-selection feature request - I didn't realise the classes dropdown was a built-in tinymce feature.
Mathias, are you OK with commiting this patch version?
Comment #8
matt westgate commentedThis patch offers a lot of functionality I want to see get in but also raises some larger questions.
- I feel like we're starting to abuse the variables table with all the
variable_getcalls. From a performance perspective it would be better if we had our table.- If we have our table table, I could easily see these new options be set on per role basis. For example, 'authenticated user' is assigned the simple theme with options X and site editor is assigned the advanced theme with options Y. This doesn't necessarily have to land with this patch, but it's something to consider for the upcoming release.
- Does the new toggle setting interfere / conflict with the other configure options? What if I want to have toggle capabilities only on certain pages? Personally, I'd like to move the toggle setting from being an option to being the default (e.g., the user can always choose to enable/disable tinymce). Perhaps an option to instead define if the default toggle state is on or off.
- Let's reconsider the way we're building the tinymce initialization options. Instead of string concatenations, use arrays and create an API modeled after
drupal_set_html_head()anddrupal_get_html_head(). These could be set by any function and we can also inspect the state of the tinymce options whenever want during the request lifecycle.Thoughts?
Comment #9
matt westgate commentedCommitted to HEAD. Thanks Jeff!
Comment #10
(not verified) commentedComment #11
shredder315 commentedWhen you click on a textarea you get a javascript error:
Error: instance is not defined
Source File: http://10.0.0.6/drupal-cvs/modules/tinymce/tinymce/jscripts/tiny_mce/tin...
Line: 9
In Firefox.
Hmmm... Again, I'm not replicating. I'll fire up the Windows machine in the next day or so and see what I can figure out. In the meantime, you can go into the module code and do a search and replace to change "tiny_mce.js" to "tiny_mce_src.js". The tiny_mce.js file has all of the spaces and linebreaks removed, so basically EVERYTHING is on Line 9. The tiny_mce_src.js version will give me a better idea where the problem is really happening.
I am having this same problem. I did the search and replace as suggested above. Now the error is that it can't find tiny_mce_src.js.
Any further insight would be great.