Fix potential use-before-init

This commit is contained in:
Simon Rozman 2024-02-06 14:33:12 +01:00
parent 2a579b53fd
commit 6342e8c68f

View File

@ -152,13 +152,13 @@ async function besProof(el) {
function besHandleBeforeInput(editorId, event) {
let editor = besEditors[editorId]
if (editor.timer) clearTimeout(editor.timer)
let edit = document.getElementById(editorId)
editor.timer = setTimeout(function () {
besProof(edit)
}, 1000)
// No need to invalidate elements after range.startContainer since they will
// get either deleted or replaced.
let edit = document.getElementById(editorId)
event
.getTargetRanges()
.forEach(range =>