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

How to call the ok button from a widget? #66

Closed
Apeli opened this issue Jun 29, 2021 · 2 comments
Closed

How to call the ok button from a widget? #66

Apeli opened this issue Jun 29, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@Apeli
Copy link
Contributor

Apeli commented Jun 29, 2021

Is there a way to add an annotation / click the "OK" button programmatically from inside a Widget?

Something like this?
https://recogito.github.io/annotorious/api-docs/annotorious/#saveselected

@rsimon rsimon transferred this issue from recogito/recogito-js Jun 29, 2021
@rsimon
Copy link
Member

rsimon commented Jun 29, 2021

I re-read the code and, no, unfortunately that's also not possible - at least not without loosing annotation bodies like in issue #65. Frankly, the current React implementation of the editor solves as many problems as it causes. I need to re-organize that bit somewhat to provide more possibilites for widget extensions.

However: I'm on the case. Expect updates for this and #65 soon!

@rsimon
Copy link
Member

rsimon commented Jul 3, 2021

For posterity (this will go into the docs later!): all widget callback functions now have an optional additional argument saveImmediately. Set this to true to save the annotation and close the editor immediately after applying the change:

args.onAppendBody(body, true);
args.onRemoveBody(body, true);
args.onUpdateBody(previousBody, updatedBody, true);
args.onUpsertBody(optPrevious, updatedBody, true);
args.onBatchModify(diffs, true);

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

No branches or pull requests

2 participants