Closed Drilio closed 7 months ago
This bug is present on mirador-annotations upstream and you can trigger it on : https://mirador-annotations.netlify.app/ :
The problem is double.
The export function don't export the adapter (a function) --> first problem The missing value is config -> annotation -> adapter. So when the retrieve annotation function try to use the adapter, a TypeError error is thrown
The import don't check if the value is set --> second problem In retrieve function in externalStorageAnnotationplugin, I add the following checks. It can be improved
if (typeof config.annotation.adapter === 'string' && config.annotation.adapter === AnnotationAdapter.LOCAL_STORAGE) {
config.annotation.adapter = (canvasId) => new LocalStorageAdapter(`localStorage://?canvasId=${canvasId}`);
}
if(typeof config.annotation.adapter === 'string' && config.annotation.adapter === AnnotationAdapter.ANNOTOT) {
const endpointUrl = 'http://127.0.0.1:3000/annotations';
config.annotation.adapter = (canvasId) => new AnnototAdapter(canvasId, endpointUrl);
}
if (!config.annotation.adapter) {
// Default adapter set to LocalStorageAdapter
config.annotation.adapter = (canvasId) => new LocalStorageAdapter(`localStorage://?canvasId=${canvasId}`);
}
import workspace leads into this error :