[annotator-dev] Word not highlighted after using HTTP Storage plugin

Leena Bahulekar leena_bahulekar at persistent.com
Sun Jun 23 19:00:19 UTC 2019


Hi,

I am trying to setup my own storage of annotations while using the AnnotatorJS. For this POC, initially I added the annotator to the html and included the storage.debug.
$(document).ready(function() {
                                var elem = document.querySelector('body');
                                var app = new annotator.App();
                                app.include(annotator.ui.main,{element: elem,
                                                editorExtensions: [annotator.ui.tags.editorExtension],
                                                viewerExtensions: [
                                  annotator.ui.tags.viewerExtension]
                                                });
                                app.include(annotator.ui.filter.standalone);

                                app.include(annotator.storage.debug);
                                .......
                                app.start().then(function () {
                               app.annotations.load();
                                });
                                });
The annotator is working fine in this case - I select a text and on the annotation pop-up add some text and click save. This rightly highlights the text - and logs the annotation to the console. Now I wanted to store the annotation in my own database. So added the HTTP Storage plugin.
                                app.include(annotator.storage.debug);

                                app.include(annotator.storage.http, {
                                                prefix:'http://localhost:3000/api',
                                                urls: {
                                                                 create:'/annotations'
                                                }
                                });
I also implemented an express node server with the required api. When I select the text and enter some text and click save, I can see the request correctly submitted and received in the API exposed by the server. For now I am not running any insertion into DB. I just populate a model and return the response. However after the entire call stack is complete the selected text does not appear highlighted.

Can someone guide me in what I could be doing wrong. I would like to see the text highlighted and then on mouseover the same should be shown - similar to the storage.debug.

Thanks and regards,
Leena.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20190623/9a57ebe8/attachment.html>


More information about the annotator-dev mailing list