Contribute to this guide

guidePasting plain text

With the plain text pasting feature, text pasted using the Ctrl/Cmd + Shift + V keystroke will match the formatting of the content you paste it into.

# Demo

Copy some text from one of the styled paragraphs below and press Ctrl/Cmd + Shift + V to paste it into another paragraph. See how the pasted text matches the paragraph’s style. Next, compare what happens when you paste the text without pressing Shift.

This demo presents a limited set of features. Visit the feature-rich editor example to see more in action.

# Additional feature information

The plain text pasting feature is implemented by the PastePlainText plugin which is a part of the Clipboard plugin.

It detects the Ctrl/Cmd + Shift + V keystroke during the paste and causes the pasted text to inherit the styles of the content it was pasted into. In this sense, the feature can also be described as “pasting without formatting” – the source formatting of the pasted text gets replaced with the target formatting of the text it was pasted into.

Pasting plain text with a double line break will turn the break into a paragraph. A single line break will instead be turned into a soft break upon pasting.

# Installation

This feature is required by the clipboard plugin and is enabled by default in all predefined builds. The installation instructions are for developers interested in building their own custom rich-text editor.

To add this feature to your rich-text editor, install the @ckeditor/ckeditor5-clipboard package:

npm install --save @ckeditor/ckeditor5-clipboard

Then add the Clipboard plugin to your plugin list:

import { Clipboard } from '@ckeditor/ckeditor5-clipboard';

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        plugins: [ Clipboard, Bold, /* ... */ ]
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

The PastePlainText plugin will activate along with the clipboard plugin.

# Support for other applications

You can find more information regarding compatibility with other applications in this ticket.

If you think that support for any of the applications needs improvements, please add 👍 and comments in the following issues:

Feel free to open a new feature request for other similar applications, too!

CKEditor 5 supports a wider range of paste features, including:

  • Paste Markdown – Paste Markdown-formatted content straight into the editor.
  • Paste from Office – Paste content from Microsoft Word and keep the original structure and formatting.
  • Paste from Google Docs – Paste content from Google Docs, maintaining the original formatting and structure.
  • Import from Word – Convert Word files directly into HTML content.

# Contribute

The source code of the feature is available on GitHub at https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-clipboard.