[annotator-dev] Previously created Annotations not getting loaded

Apurva Jalit apurva.jalit at gmail.com
Thu Apr 9 12:25:04 UTC 2015


I tried to step through the annotator javascript file while loading the
search results that are fetched on initialising the annotator. I found that
an *exception is thrown* in the function: *setupAnnotation* when this
statement is executed: normedRanges.push(Range.sniff(r).normalize(root)).
The error message is : "*Couldn't find offset undefined in element /p[1]*".

Can someone help me understand why this is so? Is it because of this
exception that the annotations are not seen as loaded? The page on which
the annotator is initialised has only one element <p> in the body and
annotator is called on body.

Thanks,
Apurva Jalit


On Wed, Apr 8, 2015 at 10:21 PM, Apurva Jalit <apurva.jalit at gmail.com>
wrote:

> Hello All,
> I have implemented my own storage backend. I am not using authentication
> and the permission plugins as of now.
>
> On initialising annotator for a web page, I can see that I receive some
> annotations in the response but they are not getting loaded on the webpage.
>
> When I compare the response that my backend sends with the response
> received on the annotatorjs home page, i can the difference in the format
> presentation of the response: the response sent by my server backend
> appears as a single line with all the correct parameters in json type
> (mentioned in the end of the mail) whereas the one on annotatorjs page, is
> presented as properly indented and well presented json objects. Can this be
> the reason for the difference?
> (I am using chrome dev tools to see the response data on calling APIs)
>
> Please go through the following if I am missing out on something else too.
>
> *Annotator initalise*
> content.annotator();
> content.annotator('addPlugin', 'Tags');
> content.annotator('addPlugin', 'Store', {
>         // The endpoint of the store on your server.
>         prefix: 'http://localhost:5555/api/Annotation',
>         annotationData: {
>             'uri': pageURL,
>             'user': userID
>
>         },
>
>         loadFromSearch: {
>             'count': 20,
>             'uri': pageURL,
>             'user': userID
>
>         }
>     });
>
>
>
> *Response on search called during annotator init*
>
> {"total":1,"rows":[{"ranges":[{"start":"/div[2]/p[1]","startoffset":401,"end":"/div[2]/p[1]","endoffset":404}],"quote":"as","text":"asdasd","tags":[],"uri":"
> http://localhost:5555/Home/TestPopup
> ","user":2,"id":10030,"created":"2011-05-24T18:52:08.036814","updated":"2011-05-24T18:52:08.036814"}]}
>
>
> *Request Data when annotation is created*
>
> {"ranges":[{"start":"/div[2]/p[1]","startoffset":589,"end":"/div[2]/p[1]","endoffset":595}],"quote":"Cicero","text":"place","tags":[],"uri":"
> http://localhost:5555/Home/TestPopup
> ","user":2,"id":10031,"created":"2011-05-24T18:52:08.036814","updated":"2011-05-24T18:52:08.036814"}
>
>
> Thanks,
> Apurva Jalit
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20150409/7b3d7549/attachment-0004.html>


More information about the annotator-dev mailing list