Wednesday, September 7th, 2005

WikiWYG: Rich Text Widget

Category: Library, RichTextWidget

Casey West has created WikiWYG. Wikiwyg is the simple way to add Wysiwyg editing to your existing social software project.

You attach a WYSIWYG editor to any content area (div) that you wish to allow people to edit.

There are three modes available for a piece of content:

  • Wysiwyg mode – Simple, HTML, Design Mode editing.
  • Wikitext mode – Standard, Wiki, Text Area editing.
  • Preview mode – Display mode without saving changes.

What about code?

// This code enables a div to be a Wikiwyg area
var myDiv = document.getElementById('some_id');
var myConfig = {
	imagesLocation: '../../images/',
	doubleClickToEdit: true
var myWikiwyg = new Wikiwyg.MySubclass();

// Attempt to enable Wikiwyg for some div
myWikiwyg.createWikiwygArea(myDiv, myConfig);

// Change some link(s) to turn on the wikiwyg area
if (myWikiwyg.enabled) {
	Wikiwyg.changeLinksMatching('href', /action=edit/, function() {
		return false;

Check out a standalone demo

Read some documentation


Posted by Dion Almaer at 9:48 am

4 rating from 14 votes


Comments feed

Actually, the lead developer is Brian Ingerson. It’s a Socialtext project, so pretty much all the devs here (including myself) have worked on it, but Brian’s done most of the work.

Comment by Dave Rolsky — September 7, 2005

Doesn’t work all that well in Firefox either – completely hoses the back button.

Comment by misuba — September 8, 2005

It’s very alpha just yet. Obviously, for it to be useful it will have to work on IE. I think ingy fixed the back button problem recently.

Comment by Dave Rolsky — September 11, 2005

The back button issues have been fixed and it works on IE now. The project is (and has been from the get go) an open source project. We released the code as soon as it was usable. Release early, release often! :)

Comment by Brian Ingerson — September 15, 2005

btw, the code sample that you posted doesn’t do anything (i.e. where is the def for MySubclass.

So, implimenting it is not quite as easy as that (it is actually pretty difficult).


Comment by m — January 17, 2006

Leave a comment

You must be logged in to post a comment.