Pasting 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.
On emphasis
In typography, emphasis is the strengthening of words using a font in a different style from the surrounding text. This includes italic, bold, underlined, and strikethrough typefaces.
Italic type
The italic type is a cursive font based on a stylized form of calligraphic handwriting. You can use italics to emphasize important points, write the titles of certain creative works, cite foreign words, or quote a speaker.
Bold type
A bold font weight makes the letters thicker than the surrounding text. It is often used to highlight keywords. For example, entries in printed dictionaries are usually marked in bold.
Underlined type
Professional typesetting rarely underlines words for emphasis. Doing so is considered too distracting. Underlining is, however, often used with typewriters, in handwriting, and with some non-alphabetic scripts.
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
⚠️ New import paths
Starting with version 42.0.0, we changed the format of import paths. This guide uses the new, shorter format. Refer to the Packages in the legacy setup guide if you use an older version of CKEditor 5.
After installing the editor, add the feature to your plugin list and toolbar configuration:
import { Bold, ClassicEditor, Clipboard } from 'ckeditor5';
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!
# Related features
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.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.