This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Description
The quote() method throws an exception if an annotation has no TextQuoteSelector. That is probably fine, but does SelectionUtils.getExactOverlaps have to use the quote really?

/**
* Util function that checks if the given selection is an exact overlap to any
* existing annotations, and returns them, if so
*/
export const getExactOverlaps = (newAnnotation, selectedSpans) => {
// All existing annotations at this point
const existingAnnotations = [];
selectedSpans.forEach(span => {
const enclosingAnnotationSpan = span.closest('.r6o-annotation');
const enclosingAnnotation = enclosingAnnotationSpan?.annotation;
if (enclosingAnnotation && !existingAnnotations.includes(enclosingAnnotation))
existingAnnotations.push(enclosingAnnotation);
});
if (existingAnnotations.length > 0)
return existingAnnotations.filter(anno => {
const isSameAnchor = anno.anchor == newAnnotation.anchor;
const isSameQuote = anno.quote == newAnnotation.quote; // <<<< HERE
return isSameAnchor && isSameQuote;
});
else
return [];
};
This happens when trying to select text which has already been annotated.