# Copy and Paste

> Editor42 paste options — plain text mode, paste preprocessing, WebKit style handling, and smart paste.

Source: https://editor42.com/api/configuration/paste  
Section: Configuration Options > Copy and Paste  
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

These options control how content is handled when pasted or dropped into the editor, including format stripping, style retention, and preprocessing callbacks.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `paste_as_text` | boolean | `false` | Paste all content as plain text by default, stripping all formatting. |
| `paste_block_drop` | boolean | `false` | Block content from being dropped into the editor via drag-and-drop. |
| `paste_data_images` | boolean | `true` | Allow images pasted from the clipboard (as data URIs) to be inserted into the editor. |
| `paste_preprocess` | function | — | Callback invoked before pasted content is inserted. Receives the plugin instance and an object with a `content` property that can be modified. |
| `paste_postprocess` | function | — | Callback invoked after pasted content has been parsed into a DOM node but before insertion. Receives the plugin instance and an object with a `node` property. |
| `paste_webkit_styles` | string | `none` | Which WebKit-specific inline styles to retain when pasting. Set to `all` to keep everything, or a comma-separated list of style names. |
| `paste_remove_styles_if_webkit` | boolean | `true` | Remove inline styles from content pasted in WebKit-based browsers (Chrome, Safari). |
| `paste_merge_formats` | boolean | `true` | Merge the format of pasted content with adjacent content that has the same formatting. |
| `smart_paste` | boolean | `true` | Enable intelligent paste behavior, such as automatically converting URLs to links or images. |
| `paste_tab_spaces` | number | `4` | Number of spaces to use when converting tab characters to spaces in pasted content. |

## Example

```js
editor42.init({
  selector: 'textarea',
  paste_as_text: false,
  paste_data_images: true,
  smart_paste: true,
  paste_preprocess: (plugin, args) => {
    // Strip all bold tags from pasted content
    args.content = args.content.replace(/<\/?strong>/gi, '');
  },
  paste_postprocess: (plugin, args) => {
    // Add a class to all pasted paragraphs
    const paragraphs = args.node.querySelectorAll('p');
    paragraphs.forEach(p => p.classList.add('pasted'));
  }
});
```
