Compose: spelling and grammar check with LanguageTool

A self-hosted LanguageTool (dev: docker/docker-compose.yml, started by
`make up`) checks what the user writes in the compose window, through
POST /api/spellcheck — the browser never talks to the engine directly.

- Marks are CSS highlights over the text, never written into the message: red
  wavy for spelling, blue for grammar/style. Clicking one shows the message,
  up to five suggestions (applied as typed, so Ctrl+Z undoes them) and Ignore.
  The popup, like the link popup, opens above its anchor when there is no
  room below.
- Checked after a pause in typing; the signature and quoted original are
  skipped; marks on words just edited drop at once; a check overtaken by a
  newer one, by turning checking off, or by closing the window is discarded.
- With "auto", text is checked in chunks of lines, each in its own detected
  language — LanguageTool settles on one language per request, so a mixed
  Polish/English message had every English word flagged as a Polish typo.
- Settings > Appearance: on/off and language (Auto-detect or any of the
  engine's languages); the compose window's More menu overrides it for one
  message. The browser's own spellcheck steps aside while ours runs, and comes
  back when it is off or the server has no engine (503 from the endpoint).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 23:51:31 +02:00
co-authored by Claude Opus 5.5
parent b157c5c9bb
commit 1f2e539eb2
16 changed files with 1000 additions and 9 deletions
+17
View File
@@ -118,6 +118,23 @@ services:
retries: 10
# Test mail servers (integration tests + manual dev against a throwaway mailbox)
# Spelling and grammar checking for the compose window (POST /api/spellcheck
# forwards to it; the browser never talks to it directly). No n-gram data:
# it would add several GB per language for a modest gain in grammar checks.
languagetool:
image: erikvl87/languagetool:6.8
environment:
Java_Xms: 256m
Java_Xmx: 1g
ports:
- "127.0.0.1:8010:8010"
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8010/v2/languages || exit 1"]
interval: 10s
timeout: 5s
retries: 12
restart: unless-stopped
greenmail:
image: greenmail/standalone:2.0.1
environment: