From cee4cb90a8949c0d2a233c54f6cdd3107ef6b30a Mon Sep 17 00:00:00 2001 From: Aljaz Grilc Date: Wed, 21 Feb 2024 13:48:50 +0100 Subject: [PATCH] Set spellcheck attribute to false via JS --- index.html | 15 +++++++-------- online-editor.js | 8 +++++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 3d29d50..6392ccb 100644 --- a/index.html +++ b/index.html @@ -9,10 +9,10 @@
-
-
Popravite kar želite.
+
+ @@ -21,10 +21,10 @@ -
-
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite. Na mizo nisem položil knjigo.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
Popravite kar želite.
Na mizo nisem položil knjigo. Popravite kar želite.
+ + --> @@ -43,5 +43,4 @@ font-family: Arial, Helvetica, sans-serif; z-index: 2; } - - \ No newline at end of file + diff --git a/online-editor.js b/online-editor.js index 89645f6..337e2e4 100644 --- a/online-editor.js +++ b/online-editor.js @@ -11,6 +11,7 @@ class BesEditor { this.correctionPanel = correctionPanel this.scrollPanel = scrollPanel this.offsetTop = null + this.disableSpellcheck(edit) this.proof(edit) edit.addEventListener('beforeinput', e => this.handleBeforeInput(e), false) edit.addEventListener('click', e => this.handleClick(e)) @@ -26,11 +27,16 @@ class BesEditor { return editor } + // Set spellcheck to false + disableSpellcheck(edit) { + edit.spellcheck = false + } + // TODO: add support for textarea elements // Recursively grammar-proofs one node. async proof(el) { // If first child is not a block element, add a dummy
...
around it. - // This is solution is still not fully tested and might need some improvements. + // This solution is still not fully tested and might need some improvements. if (el.classList?.contains('bes-online-editor')) { const firstChild = el.firstChild if (