-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotation classes #57
Conversation
6d7601a
to
0cd05bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sooooorry for the massive delay on reviewing this - tbh, I thought I'd already approved, but clearly not. 🙃 😢
This is great, and looking forward to moving the change behaviour to Annotations so that we can move some of the conditional logic that's creeping into Document & offset out to Annotations.
* In the future, we want to return a set of changes that | ||
* are applied to the document including annotations. | ||
*/ | ||
handleChange(change: Change) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to also abstract adding/removing/changing annotations as Change
s? High-level, that feels the right approach, but it might be impractical at the moment.
The JS objects in the opening line is tripping me up. How do you feel about something more along the lines of: "This branch is a culmination of a deep rewrite of AtJSON to represent Annotation objects using class instances instead of object literals." |
|
||
export { Annotation, Schema, Display }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few places still try to import Display; want I should make a PR against this to fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@foobarrio thanks, but it's ok for now! there's still a bunch more to be done with this rewrite. If you'd like to help, I am happy to have you bring you up to speed and help you contribute ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh! I think you could help create our base annotation package! That would be very helpful :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to tsc
build and it balks on being unable to import Display is all.
Happy to help w/ whatever--point me in the right direction!
60aa15e
to
9770623
Compare
9770623
to
193a9c1
Compare
This casts any annotations not identified in the schema list into an UnknownAnnotation. Unknown Annotations are AtJSON's form of Ruby's `method_missing`, with the added benefit that these annotations will be stored and updated in a document even after being updated.
🚨 Render hooks now take annotations instead of props
This defines a subset of the HTML spec as annotations. In the future, we'd like these to be automatically generated from the HTML spec.
8a89c82
to
b3cf26d
Compare
This allows casting to subclasses of annotations in `update`, `join`, and other clauses.
This branch is a culmination of a deep rewrite of AtJSON, making Annotations classes instead of object literals.
Previously, annotations were ephemeral, and were loosely defined in sources and renderers. With changes made here, annotations will have an explicit class where they can be documented, altered, and define extension points.
Bold annotations are one of the most basic for text editing. Creating a bold annotation looked like:
Now, adding a bold annotation is done using a class + a vendor prefixed version of it. To add support for Bold annotations in our rich text editor, Offset, the following class would be made:
And we would add it to our document by adding the following JSON:
Note that the vendor prefix is prepended (like a CSS vendor prefix) to the beginning of the type of the annotation. This is to help to be clear with distinguishing between various types of annotations that exist on multiple sources, and stop them from clobbering one another. In addition,
attributes
is now a required field on the Annotation JSON.