[annotator-dev] H2O Core Modifications on Annotator

steph steph at endpoint.com
Fri May 9 17:41:46 UTC 2014


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 
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 
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 
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 
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:

Most of those are all directly related to CRUD actions on a single 


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



More information about the annotator-dev mailing list