Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Automatic Configuration of TinyMCE in Drupal

DZone's Guide to

Automatic Configuration of TinyMCE in Drupal

· Web Dev Zone ·
Free Resource

Classify programming languages: Build a model that predicts a code's programming language based on its text.  Content provided by IBM Developer. 

At Drupalcon Boston I was in a session that Boris Mann of Raincity Studios was giving and he made a throwaway comment about how TinyMCE doesn't actually suck - if you know how to configure it correctly.

Well, I always thought it sucked and caused more problems than itsolved, so I contacted Boris and asked him how he configures TinyMCE.He pointed me to a Bryght install profile for Drupal that automaticallysets up various TinyMCE profiles.

While the install profile is great, I wanted to be able to tweak thesettings just a bit and be able to configure TinyMCE on existing sites.I found this GHOP project that automatically configures TinyMCEand I decided to combine Boris's settings with this. The module alsoremoves the default line break filter for the "full HTML" input filterand expands the allowed tags for the "filtered HTML" input filter.

The result is a module that you can add to your site, run it once, thendisable it. I call it the "TinyMCE Automatic Profile Generator". I'mnot planning on making it a full drupal contribution, as I think it's alittle too specialized, but you can download it here if you'd like.

Once you run it, be sure to:
  • Give the proper roles "access TinyMCE" permissions on admin/user/access
  • Assign roles to each profile on admin/settings/tinymce
In addition to three Bryght profiles (Comments, Basic, Advanced), I added the following:
  • the default image button is enabled for the Advanced Profile
  • thefont-style-select box is enabled with a "code" style - to utilizeyou'll need to define a "code" CSS class to format programming code asdesired
One the generator runs, you can always go in and tweak the settingsmanually. If you ever mess things up, run the generator again and itwill regenerate the default module settings.

Feel free to let me know of any additional configurations that you think the module should include.

Start coding something amazing with our library of open source Cloud code patterns. Content provided by IBM.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}