diff --git a/demo/src/index.js b/demo/src/index.js index 8799874666bb7c9baa41b4eee9dcdad355cc2658..2284b30718fdf0bcc974e8bdc4863119d78cfdc8 100644 --- a/demo/src/index.js +++ b/demo/src/index.js @@ -11,6 +11,7 @@ const config = { exportLocalStorageAnnotations: false, // display annotation JSON export button }, catalog: [ + { manifestId: 'https://files.tetras-libre.fr/dev/Hakanai/manifest/manifest.json' }, { manifestId: 'https://dzkimgs.l.u-tokyo.ac.jp/videos/iiif_in_japan_2017/manifest.json' }, { manifestId: 'https://iiif.io/api/cookbook/recipe/0219-using-caption-file/manifest.json' }, { manifestId: 'https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/manifest.json' }, diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index d228815f0cf650bca98a045b0cecf2b9d36e7b12..ba4ee96f1f4e8c24f8efd9f0c337ab5b3feb4048 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -53,6 +53,7 @@ function AnnotationCreation(props) { let tend; const annoState = {}; if (props.annotation) { + console.log('props.annotation', props.annotation); // annotation body if (Array.isArray(props.annotation.body)) { annoState.tags = []; @@ -100,6 +101,12 @@ function AnnotationCreation(props) { setDrawingState(JSON.parse(props.annotation.drawingState)); } } + // TODO add a case where no annotation + + + if(!annoState?.textBody) { + annoState.textBody = ''; + } // If we don't have tstart setted, we are creating a new annotation. // If we don't have tend setted, we set it at the end of the video. @@ -114,7 +121,6 @@ function AnnotationCreation(props) { mediaVideo: props.mediaVideo, ...annoState, tend, - textBody: '', textEditorStateBustingKey: 0, tstart, valueTime: [0, 1], diff --git a/src/WebAnnotation.js b/src/WebAnnotation.js index 2267a985f1d1e5c567716789cc3d130dafdeaac4..90acaacee19a4d2416ee29a1894acd9addcffbe7 100644 --- a/src/WebAnnotation.js +++ b/src/WebAnnotation.js @@ -11,7 +11,7 @@ export default class WebAnnotation { this.tags = tags; this.svg = svg; //this.image = image; - this.image = null; + this.image = image; this.manifestId = manifestId; this.drawingState = drawingStateSerialized; @@ -52,11 +52,10 @@ export default class WebAnnotation { }; //bodies.push(imgBody); const testImageBody = { - "id": "http://iiif.tetras-libre.fr/data/Hakanai/media/10_HKN-Garges_A2B4243.JPG", - "type": "Image", - "format": "image/jpg", - "value": "<a href=\"http://iiif.tetras-libre.fr/data/Hakanai/media/10_HKN-Garges_A2B4243.JPG\" target=\"_blank\">Dispositif</a>" - }; + "id": "https://files.tetras-libre.fr/dev/Hakanai/media/10_HKN-Garges_A2B4243.JPG", + "type": "Image", + "format": "image/jpg" + }; bodies.push(testImageBody); }