feat(spellcheck): save new words to custom dictionary

This commit is contained in:
Elian Doran
2026-04-06 20:28:22 +03:00
parent ef72d89172
commit 3ed7d48d42
2 changed files with 6 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ function setupContextMenu() {
items.push({
title: t("electron_context_menu.add-term-to-dictionary", { term: params.misspelledWord }),
uiIcon: "bx bx-plus",
handler: () => webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)
handler: () => electron.ipcRenderer.send("add-word-to-dictionary", params.misspelledWord)
});
items.push({ kind: "separator" });

View File

@@ -383,6 +383,11 @@ async function configureWebContents(webContents: WebContents, spellcheckEnabled:
webContents.session.setSpellCheckerLanguages(languageCodes);
customDictionary.loadForSession(webContents.session);
ipcMain.on("add-word-to-dictionary", (_event, word: string) => {
webContents.session.addWordToSpellCheckerDictionary(word);
customDictionary.addWord(word);
});
}
}