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
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
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
Re: FCKeditor and Pebble
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.
Simon is a hands-on software architect and a senior consultant at 

