[annotator-dev] H2O Core Modifications on Annotator
steph
steph at endpoint.com
Fri May 9 17:41:46 UTC 2014
Hi,
I've been working on upgrading from Annotator 1.2 to the 2.0 / master
branch since the I Annotate Conferece. I was able to pull out many of my
core hacks previously in place, thanks to getting clarification on
available events from Randall, but I still needed a handful of core
hacks. I did the upgrade on an mostly arbitrary master branch as I've
been trying to keep things up to date, and I realize there's been a bit
of movement since the various UI components have been broken down.
Regardless, here are core modifications in place:
* Appended to the Editor.hide method
(https://github.com/openannotation/annotator/blob/master/src/plugin/editor.coffee#L131):
For our use, I needed something custom to be executed when the Editor is
hidden, both after an annotation is saved and when the cancel button is
clicked. Perhaps this is one candidate that could be moved to an event,
so please let me know if I'm missing an event here.
* Add to the Editor.submit method
(https://github.com/openannotation/annotator/blob/master/src/plugin/editor.coffee#L164):
For our use, I needed client-side error validation to happen on the
content of the annotation form before anything else happened. IMO, from
my understanding of the code, error validation of annotation
submissions, both client-side and server-side, is not obvious to me.
* Modifying the ignoreSelector behavior in NormalizeRange.serialize
(https://github.com/openannotation/annotator/blob/master/src/range.coffee#L219):
I had to make a couple of modifications here to ignore additional markup
added to the text in the offset calculation. In our implementation, we
have the ability to hide and show non-annotated text. A link with anchor
"[...]" is shown in place of hidden non-annotated text, and I modified
the serialize method to ignore this markup in the offset count.
* Util.getTextNodes mods
(https://github.com/openannotation/annotator/blob/master/src/util.coffee#L68):
In addition to ignoring the "[...]" markup, our implementation also
shows paragraph numbers for all the text, which needs to be ignored in
calculating annotation Range/offset.
That's it. It's in a much better place than it was prior to the upgrade.
----
In other news, here's a list of all the events we are using in our plugin:
annotationsLoaded
annotationEditorSubmit
beforeAnnotationCreated
beforeAnnotationUpdated
annotationCreated
annotationUpdated
beforeAnnotationDeleted
annotationDeleted
Most of those are all directly related to CRUD actions on a single
annotation.
----
I don't necessarily think the core needs to be modified to accommodate
the customizations I mentioned, but hopefully this gives a bit of
insight as to where our limitations are and how we are using Annotator
Thanks!
Steph
More information about the annotator-dev
mailing list