FCKeditor and Pebble

Integrating a WYSIWYG editor into your favourite blogging tool

I've been looking at WYSIWYG editors recently, with the goal of integrating one into Pebble so that non-techies can easily create and edit blog entries. There are quite a few editors around, some free and some commercial. So far, the one that I like the most is called FCKeditor. It's open source and licensed under the LGPL. As with most of these editors, it works on the majority of browsers except Safari, but hopefully support is coming. Anyway, if you want to integrate FCKeditor into your own Pebble install, here's what you need to do.

1. Download FCKeditor
Download FCKeditor (I'm using version 2.0).

2. Install FCKeditor
Unextract the downloaded file and copy the entire directory into the root of your Pebble web application installation. Rename this directory to FCKeditor.

3. Integrate with Pebble
Add the following code into the /jsp/editBlogEntry.jsp file in your Pebble web application. Anywhere near the top of the file is fine.

<script type="text/javascript" src="<%= request.getContextPath() %>/FCKeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
  var oFCKeditor = new FCKeditor( 'excerpt' ) ;
  oFCKeditor.BasePath = '<%= request.getContextPath() %>/FCKeditor/' ;
  oFCKeditor.ToolbarSet = 'Basic' ;
  oFCKeditor.ReplaceTextarea() ;

  oFCKeditor = new FCKeditor( 'body' ) ;
  oFCKeditor.BasePath = '<%= request.getContextPath() %>/FCKeditor/' ;
  oFCKeditor.ToolbarSet = 'Basic' ;
  oFCKeditor.ReplaceTextarea() ;
}
</script>

Omitting oFCKeditor.ToolbarSet = 'Basic'; will make FCKeditor use the full toolbar, which is pretty big!

4. The end result

WYSIWYG editing in Pebble with FCKeditor

5. Optional steps
You can customize FCKeditor further if you like. For example, I edited the "Basic" toolbar configuration to add some more buttons, by modifying the /FCKeditor/fckconfig.js file as follows.

FCKConfig.ToolbarSets["Basic"] = [
	['Source','-','Bold','Italic','Underline','StrikeThrough','-','OrderedList','UnorderedList','-','Link','Unlink']
] ;

In addition to this, you can prune some of the directories underneath /FCKeditor as detailed here and customize the editor further as detailed on the wiki.

So where do we go from here? Well, I'd like to include a WYSIWYG editor in the standard Pebble distribution and since FCKeditor is licensed under the LGPL, that's possible. I'm slightly hesitant to include one now that doesn't support all browsers, only to find another pops up in the future that does. Of course, behaviour in unsupported browsers isn't affected because you just get the normal HTML textarea. Need to give it some more thought, but I'll certainly add some documentation about how to integrate FCKeditor with Pebble. What do you think?



Re: FCKeditor and Pebble

This looks good, I'll be interested in using this, as the manual tag markup slows me down sometimes and generally I don't have that much time to work on a blog entry, especially at lunch time, so this should come in handy. No support for Safari is a bit of a blow but it's well worth having, even without this, I would have thought.

Re: FCKeditor and Pebble

I say add it. Especially if Safari support is coming. I'm just getting into Pebble, and the more built in features like this, the more attractive it is.

Re: FCKeditor and Pebble

A rich text editor is good idea, which will certainly make Pebble easier to use by non-technical people. If you can find one that easily allows different editors to be slotted in then that would be ideal. I suggest choosing one that does the basics well and preferably outputs simple clean XHTML. FCKeditor is a very sophisticated tool that is being actively developed, is highly regarded, so an obvious candidate. You might like to consider also TinyMCE which looks similar and, at least in my few tests, generated neater output.

Re: FCKeditor and Pebble

That does look pretty good too. Now I'm confused...

Re: FCKeditor and Pebble

If you are looking for Safari support for your WYSIWYG editor there is also the HardCore Web Content Editor. As far as I know it is the only one that supports Safari as well as Internet Explorer and Firefox.

Re: FCKeditor and Pebble

need add oFCKeditor.Create();

Re: FCKeditor and Pebble

For graphical browsers that are Java-enabled (not just IE and Mozilla) a number of tools are available, though generally they're not as lightweight. There's a selection of them listed at http://www.geniisoft.com/showcase.nsf/WebEditors.

Re: FCKeditor and Pebble

Sorry to weigh in so late in the game (too late to affect your decision on 2.0?). I am new to Pebble. To me, FCKeditor looks like a strong candidate. I just plugged it into my instance of Pebble 1.9. With your instructions it was easy to configure.

It is lightweight enough that it doesn't end up dominating the blog entry page. I can understand the concern that none of the freeware editors work with Safari, being a devout Safari user. However, if I want to use the editor I can simply open Firefox or Camino and away I go.


Add a comment Send a TrackBack