mirror of
https://github.com/zadam/trilium.git
synced 2026-06-26 21:11:42 +02:00
feat(spellcheck): save new words to custom dictionary
This commit is contained in:
@@ -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" });
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user