Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

Fix/slack quill editor linting (#4033)

iuooip2de6ca88ba31
diff --git a/packages/chrome-plugin/src/contentScript/index.ts b/packages/chrome-plugin/src/contentScript/index.ts
index ef66ba665..b70a48647 100644
--- a/packages/chrome-plugin/src/contentScript/index.ts
+++ b/packages/chrome-plugin/src/contentScript/index.ts
@@ -165,12 +165,18 @@ function scan() {
}
const isLexicalEditor = element.getAttribute('data-lexical-editor') === 'true';
+ // Slack's message compose box (Quill-based) sets spellcheck="false" and provides its own
+ // spelling/autocomplete UI, but otherwise behaves like a normal rich-text contenteditable
+ // editor, so treat it the same way we treat Lexical editors: don't skip it purely because
+ // spellcheck is disabled.
+ const isQuillEditor = element.classList.contains('ql-editor');
if (
element.matches('[role="combobox"]') ||
element.getAttribute('data-enable-grammarly') === 'false' ||
(element.getAttribute('spellcheck') === 'false' &&
!isLexicalEditor &&
+ !isQuillEditor &&
element.getAttribute('data-language') !== 'markdown')
) {
return;
diff --git a/packages/lint-framework/src/lint/LintFramework.ts b/packages/lint-framework/src/lint/LintFramework.ts
index b038e08ef..65afd955b 100644
--- a/packages/lint-framework/src/lint/LintFramework.ts
+++ b/packages/lint-framework/src/lint/LintFramework.ts
@@ -240,6 +240,10 @@ export default class LintFramework {
if (caretPosition != null) {
const closestIdx = closestBox(caretPosition, this.lastBoxes);
+ if (closestIdx < 0) {
+ return;
+ }
+
const previousBox = this.lastBoxes[closestIdx];
const suggestions = previousBox.lint.suggestions;
if (suggestions.length > 0) {