feat(desktop): enable native spellcheck in message composer (#1515)

This commit is contained in:
klopez4212
2026-07-06 06:54:30 -07:00
committed by GitHub
parent 6428005487
commit a1b5983e54
2 changed files with 24 additions and 3 deletions
@@ -304,11 +304,22 @@ function addMatchesForPatterns(
decorations.push(
Decoration.inline(from, from + 1, {
class: "agent-mention-at-hidden",
spellcheck: "false",
}),
);
decorations.push(
Decoration.inline(from + 1, to, {
class: className,
spellcheck: "false",
}),
);
decorations.push(Decoration.inline(from + 1, to, { class: className }));
} else {
decorations.push(Decoration.inline(from, to, { class: className }));
decorations.push(
Decoration.inline(from, to, {
class: className,
spellcheck: "false",
}),
);
}
match = pattern.exec(text);
}
@@ -208,6 +208,16 @@ export function useRichTextEditor({
// should keep the literal "#", not convert to a heading node.
// Users type #channel-name and the "#" would get eaten otherwise.
heading: false,
// Suppress spellcheck inside inline code spans — code identifiers
// are not natural language and should not show red squiggles.
code: {
HTMLAttributes: { spellcheck: "false" },
},
// Code blocks already render as <pre><code> which browsers skip
// for spellcheck, but be explicit for consistency.
codeBlock: {
HTMLAttributes: { spellcheck: "false" },
},
// Disable the trailing-node plugin — it forces an empty paragraph
// after block nodes (lists, blockquotes, code blocks) which creates
// a phantom empty line in the compact message composer.
@@ -417,7 +427,7 @@ export function useRichTextEditor({
autocorrect: "off",
class: `${MESSAGE_MARKDOWN_CLASS} min-h-0 resize-none overflow-y-hidden border-0 bg-transparent px-0 py-0 text-sm leading-5 text-foreground shadow-none focus-visible:ring-0 caret-foreground outline-hidden max-w-none`,
"data-testid": "message-input",
spellcheck: "false",
spellcheck: "true",
},
// ArrowUp in an empty composer → edit your last message (Slack
// parity). Handled here in ProseMirror's own DOM `keydown` hook —