Skip to content

Build your personal knowledge base with Trilium Notes

feat(spellcheck): save new words to custom dictionary

Elian Doran3ed7d48d42fd
diff --git a/apps/client/src/menus/electron_context_menu.ts b/apps/client/src/menus/electron_context_menu.ts
index 547a26d3d8..a894cebfc3 100644
--- a/apps/client/src/menus/electron_context_menu.ts
+++ b/apps/client/src/menus/electron_context_menu.ts
@@ -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" });
diff --git a/apps/server/src/services/window.ts b/apps/server/src/services/window.ts
index 350b39fa2a..eece558aec 100644
--- a/apps/server/src/services/window.ts
+++ b/apps/server/src/services/window.ts
@@ -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);
+ });
}
}