[annotator-dev] issues working against master

Steph Skardal steph at endpoint.com
Fri Apr 11 18:04:32 UTC 2014


Hi Randall,

On 04/11/2014 01:48 PM, Randall Leeds wrote:
>
>     * I can't for the life of me get the Store plugin to work against
>     the master branch. I've tried passing it in as an option to the
>     annotator instantiation, and via the addPlugin method. Debugging
>     shows that the Factory.setStore method is perhaps not behaving as
>     I expect it to. Are there any updated docs / working examples of
>     the Store plugin against the master branch?
>
>
> The dev.html file should provide a working example.
> Except right now it seems to be making the search request twice. I'm 
> looking into it.

Thanks - I'll take a look.


>
>
>     * The beforeAnnotationCreated event is a little confusing.
>     beforeAnnotationCreated happens after text is highlighted and the
>     pencil adder button is clicked, but before the user makes any
>     changes to the annotation data. The documentation on the github
>     project page says, "called immediately before an annotation is
>     created. If you need to modify the annotation before it is saved
>     to the server by the Store plugin, use this event." Am I incorrect
>     in saying this is happening before the annotation is created in
>     the DOM? annotationCreated is called after the annotation is
>     saved, which is just fine. What I specifically am lacking here
>     that wouldn't require me to hack on the core is a
>     "beforeAnnotationStored" event, that happens in between those
>     events, perhaps right as the "Save" button is clicked and before
>     the annotation is created via whatever store is being used. I need
>     a means to update the annotation object before it is sent to the
>     store, but after a user has made whatever edits to the Editor
>     content. This is a limitation in both 1.2.* and 2.0, AFAIK. I can
>     probably come up with a kludge here, or hack on the core, but I'm
>     trying to minimize core hacking going forward.
>
>
> That's great feedback and we know this is not final and correct yet. 
> Thanks for the feedback.
>
> I think there's value in the beforeAnnotationCreated event happening 
> before the editor pops up, because it allows code to fill in default 
> permissions, tags, etc, before the editor is displayed.
>
> But I hear you about wanting to make modifications after that.
>
> How should we proceed?

I totally agree - I'm not proposing to get rid of the 
beforeAnnotationCreated event, I still plan to use that event, too. If 
it doesn't muck up the core code too much, I'd just like to see an 
"in-between" event, such as beforeAnnotationStored. Maybe it would make 
sense for this event to be called from the store (Store, NullStore, 
WhateverStore) class itself instead of the core, as it might be 
something more specific to the store? Not sure.

In my use case, I present the UI based on the annotation, but then I 
need to retrieve / format data entered in the UI to formatted annotation 
data after the user has modified the UI. My UI doesn't directly 
translate to the annotation object, so I have to have hooks to convert 
data to the UI and convert values in the UI to data before the 
annotation is stored. Sorry if that's not clear, maybe a diagram would 
be better :)

Steph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140411/1d94cf7c/attachment-0004.html>


More information about the annotator-dev mailing list