How can I programmatically add words to the dictionary?

What I’m trying to do

Programmatically add a word to the user’s custom dictionary - just as they would if selecting a misspelled word, opening the editor context menu, and choosing “Add to dictionary”.

If file manipulation is the only way to do this, is there a way to programmatically confirm the directory (which I’m sure differs on Windows/MacOS) containing the dictionary file(s)?

Things I have tried

I have searched the plugin development docs but see no mention of any way to trigger this without simply just manipulating the user’s files (which could be problematic).

I thought that maybe this functionality was managed at the Electron level, and found session.addWordToSpellCheckDictionary(word), but when I try to import the session module through Electron, it is undefined.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.