diff --git a/online-editor.js b/online-editor.js index 0da9713..6d1f3a9 100644 --- a/online-editor.js +++ b/online-editor.js @@ -27,7 +27,7 @@ class BesEditor { if (this.isProofed(el)) { return [{ text: '<' + el.tagName + '/>', el: el, markup: true }] } - this.clearAllMistakes(el) + this.clearMistakeMarkup(el) let data = [] for (const el2 of el.childNodes) { data = data.concat(await this.proof(el2)) @@ -96,7 +96,7 @@ class BesEditor { matches.push({ range: range, - rects: this.addMistake(range, match), + rects: this.addMistakeMarkup(range, match), match: match }) }) @@ -175,7 +175,7 @@ class BesEditor { } // Remove all grammar mistakes markup for given block element. - clearAllMistakes(el) { + clearMistakeMarkup(el) { let filteredChildren = this.children.filter(child => child.elements === el) if (!filteredChildren.length) return @@ -197,7 +197,7 @@ class BesEditor { } // Adds grammar mistake markup - addMistake(range, match) { + addMistakeMarkup(range, match) { const clientRects = range.getClientRects() for (let i = 0, n = clientRects.length; i < n; ++i) { const rect = clientRects[i] @@ -301,9 +301,9 @@ window.onload = () => { window.onresize = () => { besEditors.forEach(editor => { editor.children.forEach(child => { - editor.clearAllMistakes(child.elements) + editor.clearMistakeMarkup(child.elements) child.matches.forEach(match => { - match.rects = editor.addMistake(match.range, match) + match.rects = editor.addMistakeMarkup(match.range, match) }) }) })