cdglabs / apparatus

A hybrid graphics editor and programming environment for creating interactive diagrams.

Home Page:http://aprt.us/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Text is not directly editable when selected

Azeirah opened this issue · comments

commented

Instead of having to input the desired string into the "text" attribute of a text element, it would be really nice if it was possible to type directly into the text symbol.

It would be especially great if you could edit a text field from a symbol like this, then we'd be able to create forms!

Yes, this would be fantastic. I think it might be a heavy endeavor.

Text, like all the other graphics, is currently rendered by a DOM Canvas. So to make an editor, we need to track the pixel positions of all the letters, render a "fake" blinking text cursor appropriately, and respond appropriately to keyboard input. This is all possible, but a good deal of work.

Marijn Haverbeke, author of CodeMirror, has done a lot of work with making "fake" text editors. There are probably useful ideas on his blog.

https://github.com/danielearwicker/carota is a rich-text editor that runs in the canvas. At first glance, I thought it might be overkill, since it supports all the rich-text niceties rather than just "a line of single-styled text". But come to think of it, supporting rich text in diagrams really seems like a worthy goal to have.

Caveats: The project is not particularly active. I am not sure what integration would look like.