From bb58472a5cb40498a9664edcc534d70b72c34b9a Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 6 Feb 2024 15:55:43 +0100 Subject: [PATCH] Cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need for besEditors to be a dictionary any more. This also makes us id-agnostic with
. 😎 --- index.html | 14 +++++++------- online-editor.js | 10 ++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index fb6a08e..0118fe5 100644 --- a/index.html +++ b/index.html @@ -9,15 +9,15 @@ - - + +
-
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
+
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
diff --git a/online-editor.js b/online-editor.js index 4323265..269eafd 100644 --- a/online-editor.js +++ b/online-editor.js @@ -298,18 +298,16 @@ window.onload = () => { // Search and prepare all our editors found in the document. document.querySelectorAll('.bes-online-editor').forEach(edit => { let editor = new BesEditor(edit) - besEditors[edit.id] = editor + besEditors.push(editor) }) } window.onresize = () => { - Object.keys(besEditors).forEach(key => { - let editor = besEditors[key] + besEditors.forEach(editor => { editor.children.forEach(child => { - editor.clearAllMistakes(child?.elements) + editor.clearAllMistakes(child.elements) child.matches.forEach(match => { - const clientRect = BesEditor.addMistake(match.range, match) - match.rects = clientRect + match.rects = BesEditor.addMistake(match.range, match) }) }) })