Version 2.5.0
IMPORTANT: v2.5 drops built-in support for Internet Explorer!
If you need IE support: don't worry - it's still available. But from v2.5 onwards, you need to include the file
recogito-polyfills.js in addition to annotorious.min.js.
Features
- New crosshair feature that can optionally replace the mouse cursor, for more precise selection. Enable via a
crosshair:trueinit option - New
.setWidgetsAPI method that allows changing editor widget configuration at runtime
Behavior improvements/fixes
- When the editor opens, the first widget in the list now automatically gets initial focus
- The
mouseEnterAnnotation,mouseLeaveAnnotationandselectAnnotationevents now provide a reference to the SVG shape in addition to the annotation.
anno.on('mouseEnterAnnotation', function(annotation, element) {
console.log(annotation); // W3C annotation as JS object
console.log(element); // SVG <g> annotation shape element
});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 (recogito/recogito-client-core#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); Other
- Separation of IE support reduces the core bundle size by 76kB (now ~260kB)