
nicEdit - a new text editor for Drupal
Submitted by doug on December 22, 2007 - 8:24am
I spent the last two days writing a Drupal module to support a new WYSIWYG editor. A few days ago, Aaron posted a note to our internal list about a new "Micro Inline Editor" called nicEdit. It looked nice (aka, the name), but without some Drupal glue, it wasn't really usable. So I wrote a Drupal module, and I'm using it to write this article!
Some Background
WYSIWYG stands for "what-you-see-is-what-you-get". It's the geek-speak given to most computer editors. Drupal doesn't really support WYSIWYG, even if the editor says that it does. The reason for this is that Drupal input formats strip some of the HTML written by WYSIWYG editor, and so what the editor thinks you'll see, is not what Drupal lets' you see.
I cringe every time I'm asked to put an editor onto the website. They often write bad HTML. Now that we have the htmlcorrector module, that's not as much of an issue as it used to be. But they still can cause problems.
Giving the user too much flexibility over the formatting of their blog posts, can interfere with the theme. and from a look-and-feel perspective can actually degrade from the site. Consider what the site would look like if one user put everything in bold, another user always used Comic SansSerif font, and yet another that always used 32-point font sizes. Browsing such a site would be distracting.
But user's love them. Even more so, it's usually a "deal breaker" to not have one.
TinyMCE and FCKEditor were the two choices. I won't trash either editor, but I'll just say that neither felt satisfactory.
nicEdit Javascript Editor
Along comes nicEdit. It has fewer bells-and-whistles than the other choices, but it appears to have everything we need. Also with fewer features, comes simplicity and less code, which is a good thing. The code is written well. And the editor looks nice.
It's still too soon to tell, but it has potential. Just writing this article with it, has left a short to-do list that needs to be addressed before it's really ready.
nicEdit Drupal Module
It works-out-of-the-box. For testing purposes, you can download the module from Drupal, enable it, and it works. If you decide to keep the module, you'll want to download the nicEdit source and install it, so that you're site is running a stable version, that you control, that your site hosts and serves.
The admin interface is simple. The settings form allows you to define which buttons to display as part of the 'default' configuration. That's it. Nothing else.
If you want to control which fields display the editor, and what buttons are displayed, you acces_s this through the admin links under each textarea. (Who sees these links is controlled by user access permissions).
Short Term Goals
Create a jquery version of nicEdit. I'd like to have this so that the javascript source could be even smaller. The nicEdit code is written well and very similar to how jquery is written, so I don't think it would be a huge effort.
Write a common editor module that can be used by all editors. There are some differences, such as the exact Javascript to write for each editor, and the configuration necessary to support this. But there are a lot of similarities, such as the show/hide link below the editor, and the configuration and settings management forms.
Some Background
WYSIWYG stands for "what-you-see-is-what-you-get". It's the geek-speak given to most computer editors. Drupal doesn't really support WYSIWYG, even if the editor says that it does. The reason for this is that Drupal input formats strip some of the HTML written by WYSIWYG editor, and so what the editor thinks you'll see, is not what Drupal lets' you see.
I cringe every time I'm asked to put an editor onto the website. They often write bad HTML. Now that we have the htmlcorrector module, that's not as much of an issue as it used to be. But they still can cause problems.
Giving the user too much flexibility over the formatting of their blog posts, can interfere with the theme. and from a look-and-feel perspective can actually degrade from the site. Consider what the site would look like if one user put everything in bold, another user always used Comic SansSerif font, and yet another that always used 32-point font sizes. Browsing such a site would be distracting.
But user's love them. Even more so, it's usually a "deal breaker" to not have one.
TinyMCE and FCKEditor were the two choices. I won't trash either editor, but I'll just say that neither felt satisfactory.
nicEdit Javascript Editor
Along comes nicEdit. It has fewer bells-and-whistles than the other choices, but it appears to have everything we need. Also with fewer features, comes simplicity and less code, which is a good thing. The code is written well. And the editor looks nice.
It's still too soon to tell, but it has potential. Just writing this article with it, has left a short to-do list that needs to be addressed before it's really ready.
nicEdit Drupal Module
It works-out-of-the-box. For testing purposes, you can download the module from Drupal, enable it, and it works. If you decide to keep the module, you'll want to download the nicEdit source and install it, so that you're site is running a stable version, that you control, that your site hosts and serves.
The admin interface is simple. The settings form allows you to define which buttons to display as part of the 'default' configuration. That's it. Nothing else.
If you want to control which fields display the editor, and what buttons are displayed, you acces_s this through the admin links under each textarea. (Who sees these links is controlled by user access permissions).
Short Term Goals
- test the editor, patch nicEdit where needed
- fix nicEdit to write HTML that can be controlled via input formats (i.e., bold not working well).
- fix nicEdit to not write some newlines
- fix saving data when switching with hide/show
- expose the floating toolbar feature of nicEdit
- expose the save button of nicEdit
- role based configurations
Create a jquery version of nicEdit. I'd like to have this so that the javascript source could be even smaller. The nicEdit code is written well and very similar to how jquery is written, so I don't think it would be a huge effort.
Write a common editor module that can be used by all editors. There are some differences, such as the exact Javascript to write for each editor, and the configuration necessary to support this. But there are a lot of similarities, such as the show/hide link below the editor, and the configuration and settings management forms.
- doug's blog
- Login or register to post comments
- Delicious
- Digg
- Technorati






I tried out nicedit when I saw you commit it and I agree that it's generally pretty good.
You mentioned TinyMCE and FCKEditor, but really there are a ton of editors (wysiwyg and similar) that have been committed recently. Here are the ones I found in a quick review of contrib - and I'm not even including the "markup filters" like Wiki/Pear/Markdown in this list:
And now nicedit as well. It's quite a list. I hope that we can pick one for Drupal7 core and be done with these.