diff --git a/service2.js b/service2.js index d1bc28a..3e4a50d 100644 --- a/service2.js +++ b/service2.js @@ -31,6 +31,17 @@ class BesService { this.originalSpellcheck = this.hostElement.spellcheck this.hostElement.spellcheck = false + // This is coppied from https://stackoverflow.com/questions/37444906/how-to-stop-extensions-add-ons-like-grammarly-on-contenteditable-editors + this.originalDataGramm = this.hostElement.getAttribute('data-gramm') + this.originalDataGrammEditor = + this.hostElement.getAttribute('data-gramm_editor') + this.originalEnableGrammarly = this.hostElement.getAttribute( + 'data-enable-grammarly' + ) + this.hostElement.setAttribute('data-gramm', 'false') + this.hostElement.setAttribute('data-gramm_editor', 'false') + this.hostElement.setAttribute('data-enable-grammarly', 'false') + this.onScroll = this.onScroll.bind(this) this.hostElement.addEventListener('scroll', this.onScroll) @@ -48,6 +59,12 @@ class BesService { besServices = besServices.filter(item => item !== this) this.resizeObserver.disconnect() this.hostElement.removeEventListener('scroll', this.onScroll) + this.hostElement.setAttribute('spellcheck', this.originalSpellcheck) + this.hostElement.setAttribute('data-gramm', this.originalDataGramm) + this.hostElement.setAttribute( + 'data-gramm_editor', + this.originalDataGrammEditor + ) this.hostElement.spellcheck = this.originalSpellcheck this.clearCorrectionPanel() }