Cleanup
No need for besEditors to be a dictionary any more. This also makes us
id-agnostic with <div class="bes-online-editor">. 😎
This commit is contained in:
parent
e33fb6b8fc
commit
bb58472a5c
14
index.html
14
index.html
@ -9,15 +9,15 @@
|
|||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!--<div id="ed1" class="bes-online-editor" contenteditable="true">Tukaj vpišite besedilo ki ga želite popraviti.</div>
|
<!--<div class="bes-online-editor" contenteditable="true">Tukaj vpišite besedilo ki ga želite popraviti.</div>
|
||||||
<div id="ed2" class="bes-online-editor" contenteditable="true"></div>
|
<div class="bes-online-editor" contenteditable="true"></div>
|
||||||
<div id="ed3" class="bes-online-editor" contenteditable="true"><div>Popravite kar želite.</div></div>
|
<div class="bes-online-editor" contenteditable="true"><div>Popravite kar želite.</div></div>
|
||||||
<div id="ed4" class="bes-online-editor" contenteditable="true"><div>Popravite <a href=".">kar želite</a>.</div><div>Na mizo nisem položil knjigo. Popravite kar želite.</div></div>
|
<div class="bes-online-editor" contenteditable="true"><div>Popravite <a href=".">kar želite</a>.</div><div>Na mizo nisem položil knjigo. Popravite kar želite.</div></div>
|
||||||
<div id="ed5" class="bes-online-editor" contenteditable="true">To je preiskus.</div>-->
|
<div class="bes-online-editor" contenteditable="true">To je preiskus.</div>-->
|
||||||
<!-- <div id="ed6" class="bes-online-editor" contenteditable="true"><div class="contextual"><p>Madžarski premier Orban je tako očitno vendarle pristal na nadaljnjo makrofinančno pomoč Ukrajini v okviru revizije dolgoročnega proračuna unije 2021-2027. Ta vključuje 50 milijard evrov za Ukrajino za prihodnja štiri leta, od tega 33 milijard evrov posojil in 17 milijard evrov nepovratnih sredstev.</p></div></div> -->
|
<!-- <div class="bes-online-editor" contenteditable="true"><div class="contextual"><p>Madžarski premier Orban je tako očitno vendarle pristal na nadaljnjo makrofinančno pomoč Ukrajini v okviru revizije dolgoročnega proračuna unije 2021-2027. Ta vključuje 50 milijard evrov za Ukrajino za prihodnja štiri leta, od tega 33 milijard evrov posojil in 17 milijard evrov nepovratnih sredstev.</p></div></div> -->
|
||||||
<!-- TODO: Insert correction-panel in DOM with JavaScript and include editor ID in its ID to support multiple editors. -->
|
<!-- TODO: Insert correction-panel in DOM with JavaScript and include editor ID in its ID to support multiple editors. -->
|
||||||
<div id="correction-panel"></div>
|
<div id="correction-panel"></div>
|
||||||
<div id="ed7" class="bes-online-editor" contenteditable="true"><div>Popravite kar želite.</div><div>Na mizo nisem položil knjigo. Popravite kar želite.</div></div>
|
<div class="bes-online-editor" contenteditable="true"><div>Popravite kar želite.</div><div>Na mizo nisem položil knjigo. Popravite kar želite.</div></div>
|
||||||
<bes-popup-el></bes-popup-el>
|
<bes-popup-el></bes-popup-el>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -298,18 +298,16 @@ window.onload = () => {
|
|||||||
// Search and prepare all our editors found in the document.
|
// Search and prepare all our editors found in the document.
|
||||||
document.querySelectorAll('.bes-online-editor').forEach(edit => {
|
document.querySelectorAll('.bes-online-editor').forEach(edit => {
|
||||||
let editor = new BesEditor(edit)
|
let editor = new BesEditor(edit)
|
||||||
besEditors[edit.id] = editor
|
besEditors.push(editor)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onresize = () => {
|
window.onresize = () => {
|
||||||
Object.keys(besEditors).forEach(key => {
|
besEditors.forEach(editor => {
|
||||||
let editor = besEditors[key]
|
|
||||||
editor.children.forEach(child => {
|
editor.children.forEach(child => {
|
||||||
editor.clearAllMistakes(child?.elements)
|
editor.clearAllMistakes(child.elements)
|
||||||
child.matches.forEach(match => {
|
child.matches.forEach(match => {
|
||||||
const clientRect = BesEditor.addMistake(match.range, match)
|
match.rects = BesEditor.addMistake(match.range, match)
|
||||||
match.rects = clientRect
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user