# How to Enable or Disable Spell Check in draw.io Desktop

> Learn how to enable or disable spell check in draw.io Desktop. Control the spell check setting via the Electron store for Windows, macOS, and Linux. Easy steps to customize your diagramming experience.

- Repository: [draw.io/drawio-desktop](https://github.com/jgraph/drawio-desktop)
- Tags: how-to-guide
- Published: 2026-03-05

---

**Spell check in draw.io desktop is controlled by the `enableSpellCheck` Electron store setting, defaults to enabled on macOS and disabled on Windows/Linux, and requires a window reload to take effect.**

The draw.io desktop application implements spell checking through Electron's native `spellcheck` web preference, managed entirely within the main process. This feature persists user preferences across sessions using `electron-store`, allowing developers to customize or programmatically control spelling validation behavior.

## How Spell Check Works in draw.io Desktop

### Main Process Implementation

In [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js), the application initializes the spell check state by reading from the persistent Electron store. The logic evaluates the `enableSpellCheck` key, applying a platform-specific default that enables spell checking automatically on macOS while leaving it disabled on other operating systems unless explicitly configured:

```js
// src/main/electron.js – default value (lines 82-84)
const isMac = process.platform === 'darwin';
let enableSpellCheck = store != null ? store.get('enableSpellCheck') : false;
enableSpellCheck = enableSpellCheck != null ? enableSpellCheck : isMac;

```

### Window Configuration

When the main `BrowserWindow` is instantiated, the boolean value is injected into the `webPreferences` object. This configuration determines whether Chromium's built-in spell checker is active for that window:

```js
// src/main/electron.js – window creation (lines 185-186)
webPreferences: {
    preload: `${__dirname}/electron-preload.js`,
    spellcheck: enableSpellCheck,
    contextIsolation: true,
    // ...
}

```

## Default Behavior by Operating System

The spell check feature exhibits platform-specific defaults according to the jgraph/drawio-desktop source code:

- **macOS**: Enabled by default because `isMac` evaluates to `true`, leveraging native macOS spelling dictionaries
- **Windows and Linux**: Disabled by default unless the user has previously enabled the setting via the menu

This design ensures macOS users receive immediate native spelling validation, while users on other platforms must explicitly opt-in.

## How to Toggle Spell Check

### Via the User Interface

Users can toggle spell checking through the application menu:

1. Select **Edit** → **Spellcheck**
2. The menu sends an IPC message to the main process
3. The application updates the store and recreates the window to apply the new `spellcheck` flag

### Programmatic Toggle Using IPC

Developers can trigger the same toggle from renderer processes by emitting the `'toggleSpellCheck'` channel:

```js
// Renderer process (e.g., custom plugin)
const { ipcRenderer } = require('electron');

function toggleSpellCheck() {
  ipcRenderer.send('toggleSpellCheck');
}

```

The main process handles this message in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) (around lines 991-992), inverting the current state and persisting the change:

```js
// src/main/electron.js – toggle handling
enableSpellCheck = !enableSpellCheck;
store.set('enableSpellCheck', enableSpellCheck);

```

## Reading and Setting Spell Check State

To query the current state programmatically, expose a handler in the main process:

```js
// Main process addition to src/main/electron.js
ipcMain.handle('getSpellCheckState', () => enableSpellCheck);

```

Then invoke from the renderer:

```js
const { ipcRenderer } = require('electron');

ipcRenderer.invoke('getSpellCheckState')
  .then(enabled => console.log('Spell check is', enabled ? 'ON' : 'OFF'));

```

To force a specific default during first-run initialization, manually seed the store:

```js
const Store = require('electron-store');
const store = new Store();

if (store.get('enableSpellCheck') === undefined) {
  // Enable on all platforms regardless of OS
  store.set('enableSpellCheck', true);
}

```

**Important**: Changes to the stored value require an application restart or window reload to take effect, as the `spellcheck` web preference is only evaluated during `BrowserWindow` instantiation.

## Summary

- Spell check in draw.io desktop is implemented in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) using Electron's native `spellcheck` web preference
- The feature defaults to enabled on macOS and disabled on Windows/Linux via the `isMac` platform check
- User preferences persist using `electron-store` under the key `enableSpellCheck`
- Toggling requires sending the `'toggleSpellCheck'` IPC message, which updates the store and recreates the window
- Programmatic control requires IPC communication between renderer and main processes

## Frequently Asked Questions

### Where is the spell check setting stored in draw.io desktop?

The setting is stored in the Electron store (using `electron-store`) under the key `enableSpellCheck`. This persists the boolean value across application restarts and is read during window initialization in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js).

### Why do I need to restart draw.io after toggling spell check?

The `spellcheck` flag is passed to the `BrowserWindow` constructor's `webPreferences` object during window creation. Electron does not support dynamically changing this property on existing windows, so the application must recreate the window or reload to apply the new setting.

### Can I enable spell check by default on Windows or Linux?

Yes. Before the first run or during initialization, set the `enableSpellCheck` key in the Electron store to `true`. This overrides the default `isMac` check that normally disables spell check on non-macOS platforms.

### How does the Edit menu toggle spell check?

The Edit → Spellcheck menu item sends an IPC message on the `'toggleSpellCheck'` channel. The main process handler in [`src/main/electron.js`](https://github.com/jgraph/drawio-desktop/blob/main/src/main/electron.js) inverts the current boolean value, saves it to the store, and triggers a window reload to activate or deactivate the feature.