You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless I'm mistaken it seems like manifesto doesn't currently provide methods for directly obtaining embedded annotations in v3 manifests — those that exist in the annotations array at the canvas level.
Here are some example recipes from the cookbook that show the structure I'd like to access:
For my own needs I've been able to use getProperty("annotations") on a canvas to iterate and instantiate annotations with the appropriate manifesto constructors (this only covers something similar to the tagging recipe), like so:
typeRawAnnotationPage={id: string;type: string;items: Array<RawAnnotation>;};typeRawAnnotation={id: string;type: string;motivation: string;body: RawAnnotationBody;target: string;};typeRawAnnotationBody={type: string;value: string;language: string;format: string;};functiongetAnnotationPages(canvases: Canvas[],options: Manifest["options"]): Array<AnnotationPage>{constannotationPages: Array<AnnotationPage>=[];if(canvases.length){canvases.forEach((canvas)=>{// "getProperty" ejects and results in raw JSON// We need to instantiate each level with the appropriate constructorconstrawAnnotationPages: Array<RawAnnotationPage>=canvas.getProperty("annotations")||[];annotationPages.push(
...rawAnnotationPages.map((rawAnnotationPage)=>{constrawAnnotations: Array<RawAnnotation>|undefined=rawAnnotationPage.items;returnnewAnnotationPage({
...rawAnnotationPage,items: rawAnnotations.map((rawAnnotation)=>{returnnewAnnotation(rawAnnotation,options);}),type: rawAnnotationPage.type,},options,);}),);return[];});}returnannotationPages;}
But it would be really cool if there was ways of accessing these annotations with methods directly in manifesto.
The text was updated successfully, but these errors were encountered:
Question / feature request:
Unless I'm mistaken it seems like manifesto doesn't currently provide methods for directly obtaining embedded annotations in v3 manifests — those that exist in the
annotations
array at the canvas level.Here are some example recipes from the cookbook that show the structure I'd like to access:
For my own needs I've been able to use
getProperty("annotations")
on a canvas to iterate and instantiate annotations with the appropriate manifesto constructors (this only covers something similar to the tagging recipe), like so:But it would be really cool if there was ways of accessing these annotations with methods directly in manifesto.
The text was updated successfully, but these errors were encountered: