artursapek / mondrian

Web-based vector graphics editor
MIT License
1.24k stars 104 forks source link

Use contentEditable to implement SVG text tool #12

Open jarek-foksa opened 10 years ago

jarek-foksa commented 10 years ago

geometry/text-editable.coffee is implementing on-canvas text editing by overlying SVG <text> element with editable HTML <div> element and applying similar styles on it. I have figured out an easier way to have editable SVG text:

In the near future this hack won't be needed at all since SVG 2 SVGTextElement would be inheriting from HTMLElement interface which implements contentEditable functionality [1].

[1] http://dev.w3.org/SVG/proposals/improving-svg-dom/#interface-hierarchy

artursapek commented 10 years ago

I was unaware of the future changes to inheritance. That's awesome to know.

This sounds like a good idea. I'd love to see this implemented on a branch so I've labeled this as an enhancement for people who are looking to contirbute.

The text tool is probably the one I'm least confident in right now to be honest. Thanks for the suggestion.