Skip to content

Commit

Permalink
[#66130] use once option for addEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
Trzcin committed Sep 25, 2024
1 parent 931ce89 commit dad8dd8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/extensions/syncDualPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,9 @@ export function handlePreviewClickToScroll(/** @type {{ target: HTMLElement }} *
selection: EditorSelection.create([EditorSelection.range(line.to, line.to)]),
});
window.myst_editor.main_editor.focus();
if (canScroll) {
editor.removeEventListener("scrollend", setCursor);
}
}
if (canScroll) {
editor.addEventListener("scrollend", setCursor);
editor.addEventListener("scrollend", setCursor, { once: true });
} else {
setCursor();
}
Expand Down

0 comments on commit dad8dd8

Please sign in to comment.