ProjectMirador / mirador-annotations

a Mirador 3 plugin that adds annotation creation tools to the user interface
https://mirador-annotations.netlify.app/
38 stars 37 forks source link

Feature request: add configuration option to make existing annotations available in local storage #81

Open D-Groenewegen opened 10 months ago

D-Groenewegen commented 10 months ago

I was interested to see how far I could go using local storage as well as saving annotations server-side, and especially how well those two approaches might play together. What I did was to use local storage for the duration of the browser cache and pull the annotations from local storage if the user creating the annotations decides to save them on the server (in this case, on a wiki). Of course, what happens when your local storage is still intact and you open a manifest that has the previously created annotations merged in or referenced, you'll see duplicates. Interestingly, whichever duplicate you choose, it does appear to be editable.

What I did was to make sure that the relevant items in local storage are cleared and the page is refreshed when the user hits "Save". When a user opens the new manifest (with the annotations referenced), the annotations appear without duplication. So far so good, but there is a problem: they are not editable! In other words, annotations that are referenced, or embedded, do not automatically become available in local storage.

What I am requesting is a config option (but not the new default) to load all existing annotations as local storage items so that they can be edited or removed in a subsequent session, whether by the same user or someone else.

D-Groenewegen commented 10 months ago

P.S. While this would still be a useful feature, I have now tackled it differently. Keeping the manifest and its annotations separate allows me to adopt a flexible approach. If the aim is only to present annotations in Mirador, I use an API service which merges references to annotations into the manifest. In other words, a derivative manifest is created over the API and used in Mirador. If on the other hand, the aim is for a user to work on (create, edit) annotations, the original, 'clean' manifest is served instead and existing annotations previously saved are loaded into localStorage. Of course, that comes with the responsibility of having to manage localStorage, especially in a collaborative environment, but the system seems feasible to me and opens up some interesting possibilities.