Repository navigation
fix(electron): offer spelling suggestions on right-click - #144
Conversation
|
Tell me to re-adapt this if you choose to switch from Electron to Tauri (a move I really like) and I can re-write it. |
Security review: approveReviewed What the change can reachThe new handler runs in the main process and takes the
None of these runs code, opens URLs, navigates, touches files outside Chromium's own dictionary store, or adds IPC. A renderer that could forge these params would already have more power than this menu gives it. Page script cannot forge them: a synthetic What it leaves out matters for security too: no Open/Copy Link, no Save Image, no Inspect Element. So no new Hardening note for later, not this PR: if a link item is ever added, route it through Tests
Nits (not security, take or leave)
|

Problem
In the Electron shell, Chromium underlines misspelled words in the composer
(
spellcheck: true), but right-clicking one offered no way to fix it:Electron shows no context menu at all unless the app builds one, and the
shell never did.
Fix
shells/electron/context-menu.js: builds the right-click menu foreditable fields from the
context-menuevent — the dictionary'ssuggestions (clicking one calls
replaceMisspelling), "Add toDictionary", and undo/redo/cut/copy/paste/select-all, each gated on the
field's
editFlags. A read-only selection gets Copy alone; everywhereelse no native menu opens, so the SPA's own context menus (messages,
channels, users) keep owning the right-click there.
main.jsinstalls it per window; the packaged file list includes thenew module; the shell README documents the behaviour.
Kept strictly to the Electron shell — no client/SPA changes.
Tests
test/tests/electronContextMenu.ts(7 tests): suggestions and theirwiring to
replaceMisspelling/addWordToSpellCheckerDictionary,the no-suggestion case, edit-action gating, read-only Copy, and staying
out of the way of the page's own menus. ESLint + Prettier clean.
teh/tsetunderlined, menu returnedthe, eh, tech, tee, tea, andclicking
thecorrected the field. The shell's--smokerun passes.