Skip to content

Commit

Permalink
#4839 - Scrolling to selection does sometimes not work in Apache Anno…
Browse files Browse the repository at this point in the history
…tator Editor

- Normalize DOM after removing markers because Apache Annotator can fail to create marker annotations in a fragemented DOM
  • Loading branch information
reckart committed May 31, 2024
1 parent 837d762 commit 8c2e1c4
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ export class ApacheAnnotatorVisualizer {

window.clearTimeout(this.removeTransientMarkersTimeout)
this.removeTransientMarkers.forEach(remove => remove())
this.root.normalize() // https://github.com/apache/incubator-annotator/issues/120

const removeScrollMarker = highlightText(range, 'mark', { id: 'iaa-scroll-marker' })
this.removeTransientMarkers = [removeScrollMarker]
Expand Down Expand Up @@ -469,6 +470,7 @@ export class ApacheAnnotatorVisualizer {
this.removeTransientMarkersTimeout = window.setTimeout(() => {
this.removeTransientMarkers.forEach(remove => remove())
this.removeTransientMarkers = []
this.root.normalize() // https://github.com/apache/incubator-annotator/issues/120
}, 2000)
}

Expand Down

0 comments on commit 8c2e1c4

Please sign in to comment.