danielearwicker / danielearwicker.github.io

My blog - create an issue if you want to comment!
http://danielearwicker.github.io/
0 stars 0 forks source link

Carota in typescript. #1

Open martin19 opened 8 years ago

martin19 commented 8 years ago

Hi Daniel, I just wanted to let you know I've been working on converting carota to Typescript. I'm planning to use it in an browser image editing App. Right now I'm trying to integrate paragraph formatting (like indents and margins). Its a pity you can't provide support - I could really use it - Anyway - thank you for your great work!

here is the typescript repo: https://github.com/martin19/carota-ts

danielearwicker commented 8 years ago

Awesome stuff! If was starting it now it would of course be TS. Re: advanced features I think I was planning to try things like bullet/numbered lists and even tables, using the "codes" as control characters to indicate the start/end of regions, but i didn't get far enough with it to see if it would work before I had to move on. Basically what you want is for each place that the user could insert text to be indexed by a unique character/code position, as that is what makes it simple to address a plain-text location with an integer.

martin19 commented 8 years ago

Hi Daniel, thank you for getting back to me.

Unfortunately the unfinished "code" control flows I didn't port completely and recently decided to drop them as I was busy understanding the logic of the core stuff. To be honest I didn't understand the idea behind it completely and couldn't anticipate where you were heading to - I just saw it wasn't finished and made it into the codebase as a recent add-on. So i thought it could be left out (at first) Besides that I think the port is rather complete.

For now, I've been trying to implement a "Paragraph" class that can have its own formatting (spaceBefore, spaceAfter, marginleft, marginRight, alignment). There is a 1-n relationship between runs and paragraphs: Every paragraph references n runs. Every run references its paragraph. The document has a list of paragraphs. For the layout part I've added a "PositionedParagraph" class which extends Node. Layout produces: Frame->Paragraph[]->Line[]->PositionedWord[]->PositionedCharacter[] hierarchy. I've come up with this structure after having a look at the structure of some WordProcessingML documents (eg see http://rep.oio.dk/Microsoft.com/officeschemas/wordprocessingml_article.htm) I have no clue how e.g. Word keeps its data, but it made sense for me.

Did you have any "blueprint" for carota or any documentation I could have a look into?

Thank you!