This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Version 1.3.0
Editor plugin API
- The
Editorwas refactored from a React functional component to a class component. This allows attaching follow-up actions to state changes. (Reactthis.setState({...}, callback)- which isn't available in functional components.) The use case for this are widget actions that modify the current annotation (add or remove bodies) and then save & close the editor immediately (#66). - The editor plugin API callback function
.onUpsertBodynow simplifies the use of single-body plugins (i.e. plugins like dropdowns or input fields, which only insert or replace a single body of a givenpurpose).
// Replaces the first existing body of purpose 'my-purpose' or appends, if none
props.onUpsertBody({ value: 'Some value', purpose: 'my-purpose' });- The widget API has a new callback
onBatchModifywhich allows applying any combination of body modifications in one go (append, remove, update, upsert), with or without closing the editor immediately afterwards. (#65)
const changes = [
{ action: 'append', body: bodyToAppend },
{ action: 'update', previous: prevBody, updated: updatedBody }
{ action: 'remove', body: bodyToRemove },
// Normal upsert, previous is optional
{ action: 'upsert', previous: prevBody, updated: updatedBody }
// Auto-upsert based on purpose
{ action: 'upsert', body: bodyToUpser }
];
const saveImmediately = true;
args.onBatchModify(changes, saveImmediately); Behavior improvements/fixes
- When the editor opens, the first widget in the list now automatically gets initial focus
- While RecogitoJS still generates annotations that contain both a
TextPositionSelectorand aQuoteSelectorit will now properly load annotations that only contain a TextPositionSelector.