# Save

> Editor42 Save plugin: a Save button that submits the form or calls your callback, and a Cancel button that restores the content. Save waits for a change.

Source: https://editor42.com/plugins/save  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

Plugin alias: `save`

```js
editor42.init({
  plugins: 'save'
});
```

Adds save and cancel functionality to the editor. Save either calls a custom callback or submits the parent HTML form. Cancel either calls a custom callback or resets content to the initial state. The save button is disabled when content is not dirty.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `save_enablewhendirty` | boolean | `true` | Buttons only enabled when content is modified. |
| `save_onsavecallback` | function | — | Custom save callback. |
| `save_oncancelcallback` | function | — | Custom cancel callback. |

## Commands

| Command | Description |
|---|---|
| `editor42Save` | Triggers save action. |
| `editor42Cancel` | Triggers cancel action. |

## Toolbar buttons

| Button | Type | Description |
|---|---|---|
| `save` | Button | Triggers save action. |
| `cancel` | Button | Triggers cancel action. |

## Keyboard shortcuts

| Shortcut | Action |
|---|---|
| `Ctrl+S` / `Cmd+S` | Triggers save action. |
