Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createAnnotation() forces first annotationPage id #19

Open
martimpassos opened this issue Jan 30, 2024 · 3 comments
Open

createAnnotation() forces first annotationPage id #19

martimpassos opened this issue Jan 30, 2024 · 3 comments

Comments

@martimpassos
Copy link

It seems to be using a hardcoded value instead of the id argument, is this expected behavior?

@stephenwf
Copy link
Member

That was a convenience feature, so you can add Annotation instances directly without having to worry about the AnnotationPage. If there is already an AnnotationPage, it will use that instead, or you can add an AnnotationPage with Annotations manually.

I think you could also go back and change the ID on the annotation page. We could allow you to pass in ID to the createAnnotation() options though.

@martimpassos
Copy link
Author

Correct me if I'm wrong, but the function seems to already have that option, only unused.

How would you go about renaming the annotation page? Accessing the object like manifest.canvas.annotationPage.id = 'new/id'?

@stephenwf
Copy link
Member

You could instead add the page manually:

canvas.createAnnotationPage(`https://example.org/custom-id`, (annotationPage) => {
  annotationPage.createAnnotation(annotation);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants