[annotator-dev] How to bypass AnnotateIt and use local storage
Randall Leeds
tilgovi at hypothes.is
Fri Aug 22 00:07:45 UTC 2014
I think the issue is that `setupPlugins`, which comes from the kitchensink
plugin, is setting up a group of default plugins and options. The Store
plugin is already loaded by the time you try to load it explicitly, with
the default settings for annotateit.
These are the defaults:
```
pluginConfig
=
Tags:
{}
Filter:
filters:
[
{label: Annotator._t('User'), property:
'user'}
{label: Annotator._t('Tags'), property:
'tags'}
]
Auth:
tokenUrl: config.tokenUrl or 'http://annotateit.org/api/token'
Store:
prefix: config.storeUrl or 'http://annotateit.org/api'
annotationData:
uri: uri
loadFromSearch:
uri: uri
```
You can pass an additional argument to that `setupPlugins` call with a
`storeUrl` property, or you could override the entire set of Store options
by specifying a third argument, an options object that will get merged with
this config, where you could set prefix directly in a `Store` property.
On Thu, Aug 21, 2014 at 1:41 PM, David Fox <dvdfox at gmail.com> wrote:
> Hello all,
>
> I'm having trouble getting the Store plugin up and running. Here's what
> I've managed to do so far:
>
> - Downloaded annotator-full.1.2.7
> - Installed annotator-store and pointed it at my local Elasticsearch
> - Verified that all of the Storage API endpoints are working, e.g.
> http://localhost:5000/search
> - Added the plugin to the page with the following javascript
>
> jQuery(function ($) {
> var content =
> $('#content').annotator().annotator('setupPlugins').data('annotator');
> content.annotator('addPlugin', 'Store', {
> prefix: 'http://localhost:5000',
> annotationData: {
> 'uri': 'http://localhost/test'
> },
> loadFromSearch: {
> 'limit': 20,
> 'uri': 'http://localhost/test'
> },
> urls: {
> create: '/annotations',
> update: '/annotations/:id',
> destroy: '/annotations/:id',
> search: '/search'
> }
> });
> });
>
> And here's what works:
>
> - I can make annotations to my content
> - The navigate and filter menus appear on my page
> - If I'm logged into my AnnotateIt account my annotations are saved
> with my AnnotateIt account and can be retrieved
>
> It's this last point that I'm struggling with - I'm not sure why it is
> defaulting to AnnotateIt storage. If I log out of my AnnotateIt account it
> will no longer allow me to create annotations. I thought all I needed to do
> was to point the Plugin at my Search API via the prefix property, but
> evidently I missed a step. Any ideas what I'm missing?
>
> Please forgive me if the Javascript is way off; it's not something I'm
> totally comfortable with yet.
>
> Thanks for the help!
> David Fox
>
> _______________________________________________
> annotator-dev mailing list
> annotator-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/annotator-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140821/f195230b/attachment-0004.html>
More information about the annotator-dev
mailing list