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

Annotations without target selector cannot be edited #46

Closed
lutzhelm opened this issue Mar 26, 2021 · 0 comments
Closed

Annotations without target selector cannot be edited #46

lutzhelm opened this issue Mar 26, 2021 · 0 comments

Comments

@lutzhelm
Copy link
Contributor

lutzhelm commented Mar 26, 2021

The plugin currently allows saving annotations without selecting a target region on the Canvas. This would be fine (I think), but the annotation can not be edited because an error occurs in the AnnotationCreation constructor. props.annotation.target.selector` is undefined in the following line:

annoState.svg = props.annotation.target.selector.value;

I'd suggest to just put a check for props.annotation.target.selector around this block:

if (Array.isArray(props.annotation.target.selector)) {
props.annotation.target.selector.forEach((selector) => {
if (selector.type === 'SvgSelector') {
annoState.svg = selector.value;
} else if (selector.type === 'FragmentSelector') {
annoState.xywh = selector.value.replace('xywh=', '');
}
});
} else {
annoState.svg = props.annotation.target.selector.value;
}

Alternatively, saving an annotation without a selector should not be allowed. But if an annotation store provides annotations from a different source than Mirador, the error might still occur.

mejackreed added a commit that referenced this issue Mar 26, 2021
…out-target-selector

Fix #46: expect annotation without target selector
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

1 participant