dimagi/Vellum — pull request #132 by mwhite (2013-10-24 15:51:06+00:00)
Title: switch logic and itext inputs to contenteditable

This allows dragging questions into an "input" and having the question
ref get inserted where your mouse is, not where the cursor was.

(This is impossible to do with inputs because browser security model
disallows simulating a click from actually doing anything, but
contenteditable allows you to get insert nodes at a given X,Y point,
which you can get from the drag mouseup event.)

It also has a side-effect of giving us multi-line inputs that expand
with the size of the current input. Formatting is preserved across
saves and the user never sees a
, including in the advanced logic
editor.

contenteditable is HTML behind the scenes, so we do some hacky parsing
to handle converting values with
newline escapes back and forth,
and make sure it works in Chrome and FF.

For now the styling is slightly off, it was some extra work just to
maintain the itext placeholder when using a contenteditable div. I'll
try to get to the styling soon.