diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js index 2b7f38d0a1edb472f76f368e2af3661cfda01f85..193924bc928adbec6e3e0ebe468a477f7a3b040a 100644 --- a/src/AnnotationCreation.js +++ b/src/AnnotationCreation.js @@ -76,6 +76,8 @@ class AnnotationCreation extends Component { } else if (body.type === 'Image') { // annoState.textBody = body.value; // why text body here ??? annoState.image = body; + } else if (body.type === "AnnotationTitle" ) { + annoState.title = body } }); } else if (props.annotation.body.type === 'TextualBody') { @@ -105,6 +107,7 @@ class AnnotationCreation extends Component { annoState.xywh = geomFromAnnoTarget(props.annotation.target); [annoState.tstart, annoState.tend] = timeFromAnnoTarget(props.annotation.target); } + console.log(annoState) } const toolState = { @@ -142,7 +145,7 @@ class AnnotationCreation extends Component { ...annoState, valuetextTime: '', mediaVideo: null, - title: '', + title: 'defaultTitle', }; this.submitForm = this.submitForm.bind(this); @@ -343,7 +346,8 @@ class AnnotationCreation extends Component { svg, tags, }).toJson(); - + console.log(this.state.annotation); + console.log(anno); if (annotation) { storageAdapter.update(anno) .then((annoPage) => { @@ -428,7 +432,6 @@ class AnnotationCreation extends Component { image, valueTime, mediaVideo, - title } = this.state; // TODO : Vérifier ce code, c'est étrange de comprarer un typeof à une chaine de caractère. @@ -440,10 +443,9 @@ class AnnotationCreation extends Component { const isVideoDataLoaded = mediaVideo && mediaVideo.video && !isNaN(mediaVideo.video.duration) && mediaVideo.video.duration > 0; - return ( <CompanionWindow - title={title ? title : 'New Annotation'} + title={annotation ? annotation.title : 'New Annotation'} windowId={windowId} id={id} > diff --git a/src/WebAnnotation.js b/src/WebAnnotation.js index d9911a9f372ac0aa75a0ec9b8eeb3a1ee5fd53b2..8c9dfd95c5160d2c70fa018bfbb8849b3a263122 100644 --- a/src/WebAnnotation.js +++ b/src/WebAnnotation.js @@ -30,8 +30,9 @@ export default class WebAnnotation { /** */ createBody() { let bodies = []; - + console.log('CREATEBODY') if (this.body && this.body.value !== '') { + console.log('TEXT BODY', this.body.value) const textBody = { type: 'TextualBody', value: this.body.value, @@ -40,6 +41,8 @@ export default class WebAnnotation { } if (this.image) { + console.log('IMAGE', this.image.id) + const imgBody = { id: this.image.id, type: 'Image', @@ -48,13 +51,17 @@ export default class WebAnnotation { } if(this.title){ + console.log('TITLE', this.title) const title={ type: 'AnnotationTitle', value: this.title, } + bodies.push(title) } if (this.tags) { + console.log('TAG', this.tags) + bodies = bodies.concat(this.tags.map((tag) => ({ purpose: 'tagging', type: 'TextualBody', @@ -62,8 +69,10 @@ export default class WebAnnotation { }))); } if (bodies.length === 1) { + console.log('bodies',bodies) return bodies[0]; } + console.log('bodies',bodies) return bodies; }