This is exactly what I have been looking for! Rich text editing in webpages is complicated, and I haven't find a good solution until now. Google doc ends up with thousands of divs and span elements, TinyMCE uses iframe. While both of them seem to work, they are not elegant and sometimes I experience bug with incorrect text cursor location.
Another reason I like about canvas implementation is the flexibility. I have been working on a text rendering engine for Japanese for some time, and found that DOM is simply not good enough for special layout. Here are some examples:
1. Writing direction. CSS does have the writing-mode property, but that doesn't work well in different browsers.
2. Ruby tag support in vertical writing mode sucks.
3. No browser supports hanging-punctuation yet.
More to be listed...
It should be the browsers' job to fix these problems, but anyway, I finally end up with using canvas to calculate the position for every single character, that gives me flexibility that DOM doesn't have.
i have no idea why this doesn't get any attention here
on hacker-news. it looks like a very nice start to me.
(and i'll have higher praise if i can push it hard and
have it do well, but i haven't had time to stress it.)
on the whole, i don't see much value in json, however.
and part of the reason is that you're just storing the
presentational information (font, size, color, styling),
and not the structural (a.k.a. "semantic") information.
(which is the problem with any wysiwyg approach today.)
rethink your philosophical approach on that issue, and
make your save-to-file output some light-markup format,
either restructured-text (blah) or markdown (blah blah)
or my z.m.l. (zen markup language), and i think you'll
be on the way to having a definite winner on your hands.
Another reason I like about canvas implementation is the flexibility. I have been working on a text rendering engine for Japanese for some time, and found that DOM is simply not good enough for special layout. Here are some examples:
1. Writing direction. CSS does have the writing-mode property, but that doesn't work well in different browsers.
2. Ruby tag support in vertical writing mode sucks.
3. No browser supports hanging-punctuation yet.
More to be listed... It should be the browsers' job to fix these problems, but anyway, I finally end up with using canvas to calculate the position for every single character, that gives me flexibility that DOM doesn't have.
Keep up the good work!