Rendering no longer breaks when single annotation is broken
This commit is contained in:
parent
e823d5a506
commit
0bf9f37549
|
@ -41,6 +41,7 @@ export default class Highlighter {
|
|||
})
|
||||
|
||||
_addAnnotation = annotation => {
|
||||
try {
|
||||
const [ domStart, domEnd ] = this.charOffsetsToDOMPosition([ annotation.start, annotation.end ]);
|
||||
|
||||
const range = document.createRange();
|
||||
|
@ -50,6 +51,11 @@ export default class Highlighter {
|
|||
const spans = this.wrapRange(range);
|
||||
this.applyStyles(annotation, spans);
|
||||
this.bindAnnotation(annotation, spans);
|
||||
} catch (error) {
|
||||
console.warn('Could not render annotation')
|
||||
console.warn(error);
|
||||
console.warn(annotation.underlying);
|
||||
}
|
||||
}
|
||||
|
||||
_findAnnotationSpans = annotation => {
|
||||
|
|
Loading…
Reference in New Issue