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

[Help Wanted] Demo project is not working #67

Open Tyrannas opened 2 years ago

Tyrannas commented 2 years ago

Hi,

I tried to reproduce this code https://github.com/ProjectMirador/mirador-annotations/blob/master/demo/src/index.js

Either way, when I run the following snippet, I can open mirador and I can click on "add an annotation", but the moment I try to add it (by clicking on any of the shapes) the app displays a cryptic error : EllipseTool.component.js:110 Uncaught TypeError: Cannot read properties of undefined (reading 'alternate')

NB: I installed mirador-annotations from npm, maybe that's a mistake ? I should only clone the repo ? There is no real install recommandation on the ReadMe.

import Mirador from 'mirador/dist/es/src/index';
import annotationsPlugins from 'mirador-annotations'
// import { miradorImageToolsPlugin } from 'mirador-image-tools';
import LocalStorageAdapter from 'mirador-annotations/lib/LocalStorageAdapter'

const config = {
  id: 'demo',
  windows: [{
    manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
  }],
  annotation: {
    adapter: (canvasId) => new LocalStorageAdapter(`localStorage://?canvasId=${canvasId}`),
    // adapter: (canvasId) => new AnnototAdapter(canvasId, endpointUrl),
    exportLocalStorageAnnotations: true, // display annotation JSON export button
  },
  window: {
    defaultSideBarPanel: 'annotations',
    sideBarOpenByDefault: true,
  },
};

Mirador.viewer(config, [
   ...annotationsPlugins,
]);

Thank you very much

davide-negretti commented 1 year ago

Bumping this, as I have the same problem

davide-negretti commented 1 year ago

I tested it with mirador-annotations 0.4.0 and it's working. The bug is present in version 0.5.0.

davide-negretti commented 1 year ago

@Tyrannas I solved by updating react from version 16 to version 17 in my project's package.json