HACKER Q&A
📣 100-xyz

JavaScript based editor with predefined grammar


Hi,

I am creating a Flash replacement - a web based animation editor. https://its-near.me/flash2/editor

The animation will be controlled by simple text like:

At time 0 cowboy walks to point A.

Then cowboy jumps.

Then cowboy walks to point C.

The grammar is predefined: [time] [object] [verb] [?subject]

Where time can be "At time XX" or "Then"

object can be any of the images in the animation

verb can be any of the movements that the image sprite supports eg: "walk", "run", "slide", "die"

and so on.

The editor should prompt the possible values that the user can enter. eg: in the beginning, the choices would be "At time" and "Then"

I have searched online and in particular github with no luck. Anyone here know of any?

Hopefully, I have explained clearly. If not, please ask for clarification.

Thanks.


  👤 Yotta Accepted Answer ✓
Take a look at Codemirror (https://codemirror.net/). It has support for autocompletion, although I haven't tested this myself.

You can also define syntax highlighting for your grammar.


👤 sprobertson
Customization around Draft.js should support this, tricky to learn but quite powerful once you do.