Tuesday, March 1, 2005

Cool TextEditor Idea

I've been digging out from under a giant pile of tasks that have been accumulating since my daughter was born four months ago. Recently, I got to the point where I felt like I had the mound of jobs under control, so I started working on my TextEditor control again. Not only is it part of my (seemingly) never-ending quest to complete FlexWikiPad, but I've discovered that I really need an interesting problem to cook in the back of my head. I run and take walks to keep fit, and over the last few months I found myself a bit bored while doing so, because I wasn't hacking in my head. Weird but true.

Anyway, it's been nice to tackle the problem again. Although the control is still completely unusable, I find myself thinking forward to features I'd like to add some day. One of them is support for images, so you can use the control to change :) into a picture of a smiley face for example. The problem is that my model for the control is of a series of styled runs of text. How do you model images in that? Should they be a special Unicode character that means “image”? If so, when someone reads the text, how will they know what to do with it?

Today I came up with what I think is a pretty good idea: images are simply a style property of text, like being bold or being underlined. That is, I can assign “picture of smiley face” to the text “:)”, or assign “picture of my daughter” to the text “http://wangdera.com/baby/XMas2004AtHome/P1100115.JPG.htm”. So when it's shown on screen, you see an image. But when you read the text, you get the original text. It's a lot like the alternate text you can apply to an image in that sense - an analogy that indicates I'm not the first guy to think of this, but that's a good thing.


  1. Your daughter is ADORABLE. But you knew that already.

  2. Thanks. We certainly think so. :)