vectorsize / substance-text

Substance Text
substance.github.com/text
MIT License
282 stars 26 forks source link

Proper 0.5.0 API #18

Closed michael closed 12 years ago

michael commented 12 years ago

Just did some initial sketches on the new Proper API. See the README. I think we shouldn't do any UI stuff in the core, instead just provide an API for adding/manipulating and deleting annotations (that trigger the UI to update).

Next to the core we should have a folder examples for concrete integration examples, e.g. for our em+strong+link+comment use-case. And another one for color markers. The Substance Composer can then just be built on top of the Core Interface.

I think we should not expose any CodeMirror details on our API, and instead interfacing everything. E.g. we could hide the line concept from our users, if we find a way to internally project it to the CodeMirror foundation. By introducing our own interface we also free to use something else then CodeMirror in the future, without breaking the API.

However, this are just some early thoughts, all open for discussion :). I will do some UI sketches on the Composer next, so we get a better sense what we need.

vectorsize commented 12 years ago

It makes a lot of sense. The rewrite I started yesterday was going towards what you describe. At the moment I'm digging deeper in the Codemirror API in order to leverage it's power to the max, which goes away from what you say about being able to replace it with other libraries, but this can be later on separated from the core in order keep the proper API free from the codemirror implementation.

vectorsize commented 12 years ago

I just pushed a new version with some of the suggested ideas implemented. No UI at all so far.

michael commented 12 years ago

Nice. Looks very good. I will try refine the API a bit.. I just realized that we actually wanna use operations to transform the document + annotations. While not a priority, this will allow us to do realtime stuff, by integrating Tim's OT lib https://github.com/timjb/javascript-operational-transformation.

Also We can use a set of operations for specifying different testsuites... and just let them run in the browser and see if something breaks... (in conjunction with some assertions).

Trying to sketch some code for this today or tomorrow. Will be in the chat later.. See you :)