[annotator-dev] Add ids to annotators
tilgovi at hypothes.is
Fri Jul 20 21:10:17 UTC 2012
On Fri, Jul 20, 2012 at 9:02 AM, Jamie M Folsom <jfolsom at mit.edu> wrote:
> Hi, Randall,
> Great solution. Would you post the one liner you wrote again here too? I left the chat transcript on my office machine...
addHighlightId = (a) => if a.highlights? then a.highlights.id = a.id
annotatorInstance.subscribe 'annotationsLoaded', (annotations) =>
annotatorInstance.subscribe 'annotationUpdated', addHighlightId
> And is it best to listen for those events directly in the page that's loading the Annotator, or in the Annotator class? I'll post an updated gist, or a link to our fork once I have it working.
That's your preference, really. I lean toward doing it in the page or
in a subclass of Annotator if you have more customization you'd like
to do. In general, I consider it a goal that developers should
generally have little need to modify Annotator; it should provide
enough interface to get what you need without modifying its internals.
More information about the annotator-dev