The search
As a bonus I thought it’d be nice if the editor made use of Prototype so that I wouldn’t have to worry about the two playing nicely together when the site gets ajaxed-up, but it seems that nobody has done this yet which is a shame.
Anyway, back to the story, a few carefully crafted Google searches and a look at the excellent Genii Software WYSIWYG editor list gave me some potential candidates. However I ended up ruling out a lot of them because they did too much and more often than not the code they produced was a little too late-90’s HTML for my liking (<FONT> tag anyone?)
The story does have a happy ending though: I found widgEditor, an editor that I first tried out 3 years ago for a PHP project (those were the days) and, by coincidence, has just received its first update in about as many years. It fits the bill perfectly: simple, lightweight, and easy to integrate with a Rails project.
Try it yourself
If you want to try it out in your Rails project here’s what you need to do:
Download the widgEditor 1.0.1 zip file and extract the contents to a temporary directory.
Copy the css/widgContent.css and css/widgEditor.css files to your Rails application’s public/stylesheets directory.
Copy all except the header_bg.gif and logo.gif files from images to your public/images directory.
Copy the scripts/widgEditor.js file to your public/javascripts directory.
Open the public/javascripts/widgEditor.js file in your text editor and search for this line:
var widgStylesheet = "css/widgContent.css";Replace it with this:
var widgStylesheet = "/stylesheets/widgContent.css";Edit your layout template (or whichever template you’re using to define the HTML
<head>element for your pages) to include the widgEditor stylesheet and JavaScript like this:<%= stylesheet_link_tag 'widgEditor' %> <%= javascript_include_tag 'widgEditor' %>Note that if you’re using
stylesheet_link_tag :allandjavascript_include_tag :allthen you can skip this step.
You can then have widgEditor applied to textareas by adding the widgEditor CSS class to them, like this:
<%= f.text_area(:description, :size => '60x3', :class => 'widgEditor') %>
I’ve given it a quick test in Internet Explorer 6 and 7, Firefox 2.0 and 3.0 beta, and Safari 3.0 on Windows and all seems to work. My next job will probably be to customise its appearance which looks like it should be fairly easy to do by tweaking the CSS and image files. I’ll also be keeping a lookout for the soon to be released version 2 - although given the gap between the last releases this could be sometime in 2012!


16 comments
Comment on Choosing a simple, lightweight WYSIWYG editor by amy
June 26th, 2008 @ 16:22 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Rob Anderton
July 1st, 2008 @ 14:24 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Mohan
July 19th, 2008 @ 12:05 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Rob Anderton
July 22nd, 2008 @ 14:12 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Don
August 7th, 2008 @ 20:00 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Rob Anderton
August 7th, 2008 @ 20:31 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Don
August 7th, 2008 @ 22:16 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Alex
September 8th, 2008 @ 04:09 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by dingo
October 31st, 2008 @ 12:28 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by تبلیغات
December 21st, 2008 @ 02:04 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Ray Parker
June 29th, 2009 @ 20:24 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Rob Anderton
July 11th, 2009 @ 23:25 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Foton
December 8th, 2009 @ 20:47 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Subodh D. Choure
May 11th, 2010 @ 06:59 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Wout
June 24th, 2010 @ 21:00 – permalink
Comment on Choosing a simple, lightweight WYSIWYG editor by Rob Anderton
July 16th, 2010 @ 23:05 – permalink
Leave a reply
You can use Markdown in your comment as well as plain HTML. You can use
<filter:jscode lang="ruby">and</filter:jscode>tags to surround code blocks (supported languages are css, html, javascript and ruby). Your email address will not be published.If your comment doesn’t appear immediately after posting it could have been marked as spam. Don’t worry: we regularly check for and approve incorrectly filtered comments so you shouldn’t have to wait too long for it to be shown.