Strange Strands

12 Aug 2006

Mimulus

On 2nd August I started work on Mimulus, an XHTML editor for Firefox written entirely in Javascript. It lets you edit in the browser window itself, turning the current tab into a malleable document wherein text and new elements can be added. I wrote it primarily so that I can maintain a new notes directory with it, in a similar manner to how /notes/ (now the home for What Planet is This?) had started out: for that I used the W3C's rather broken WYSIWYG editor Amaya. This time I wanted to have all of the benefits of Amaya, but with none of the many disadvantages.

I'd actually started work on a through-the-web-editor back in 2003, but there were a few things that I didn't know how to do in Javascript yet, things that might not even have been possible back then, such as saving to disc. As it was, I was thinking about using it to PUT or POST over the wire to my website, something which wouldn't work now since I maintain inamidst.com as an entirely static website. But after having being shown TiddlyWiki, I found that it was possible, and since I'd moved to OS X and was wanting to make my workflow easier to ease the transition, I figured that writing a decent in browser editor was a good idea.

The main problem that I ran into was that, sensibly, the browser always prompts when running something that requires priviliges such as changing preferences and saving to disc. It was also a bit of a pain to have to embed a link to the Javascript file in every document that I wanted to edit. Still, I published a rudimentary version of Mimulus in the early morning of 5th August, and went to bed.

When I got up, Christopher Schmidt had turned it into an extension, and added some features! Cody Woodard, John Cowan, and Javier Candeira had done some testing too, which let me get it to work a bit better on non-Apple platforms. The cool thing about Firefox extensions is that they automatically have privileges (be careful what you install!), so this was a really neat way of doing it, and it also meant that you could just switch it on in the browser; no need to link to Mimulus from the HTML file that you're editing. Chris set up a subversion repository so that we could both hack on it, and we used SubEthaEdit to work on various things together.

Now it's a week later, and I worked hard for a couple of days solid (the 8th and 9th) on Mimulus, and have let it percolate since. I added a mode to edit the source, as well as fixing some bugs and doing some mass tidying of the code. The reason I stopped working on it was really because I was faced with a very annoying rendering bug in Firefox where if you add a paragraph of text after the current paragraph, it doesn't render properly until the page is refreshed, which would destroy the Mimulus editor state. I tried method after method after method to try to fix it, but nothing worked. The perplexing thing is that if you merely type in the new paragraph, it works, but I even tried to simulate the delay in typing using a timeout, in other words to simulate manual insertion of text, and it still didn't work properly.

So anyway, splitting paragraphs doesn't work because of that, but the extension is otherwise pretty functional. Feel free to install it: mimulus.xpi. There are some bugs (and when this post was originally written it didn't even have a proper homepage and such), but for the time being it should be quite usable. Check out the homepage for a tutorial on how to use it.

Strange Strands, Mimulus, by Sean B. Palmer
Archival URI: http://inamidst.com/strands/mimulus

Feedback?

Your email address:
inamidst.com