<p>I checked this again and I could not reproduce my problem / topic -&gt; close this thread.</p>

CC BY-SA 4.0
2024-03-27T08:22:29.037Z
2024-03-27T08:22:29.037Z
Marc 
<p>To answer this question:</p>
<blockquote>
<p>How do you deal with the consequences of unwanted styles when
copy&amp;paste text into CKEditor?</p>
</blockquote>
<p>I'm still looking for a way to do this in CkEditor, because Redactor had some pretty sophisticated paste options. But you can also do this with an <a href="https://github.com/craftcms/ckeditor?tab=readme-ov-file#html-purifier-configs" rel="nofollow noreferrer">HTML Purifier configuration</a> that is run when the entry is saved. Our default HTML Purifier config strips out all span tags and undesired style attributes on any allowed tags, it's quite effective.</p>

CC BY-SA 4.0
2024-10-23T20:06:49.990Z
2024-10-23T20:06:49.990Z
Dalton Rooney
<blockquote>
<p>Do you have an idea or hint, how to solve my problem?</p>
</blockquote>
<p>Create an issue describing the problem at <a href="https://github.com/craftcms/ckeditor/issues" rel="nofollow noreferrer">https://github.com/craftcms/ckeditor/issues</a> and hope that it is updated, or even better, create a pull request with your proposed changes.</p>
<p>If neither results in the change you want, fork it, change it, and install your forked version instead. It's open source and GPL licensed, so you are free to chnage it however you want!</p>

CC BY-SA 4.0
2024-03-06T12:41:52.043Z
2024-03-06T12:41:52.043Z
Seth Warburton
<p>I'm testing the new CKEditor: <a href="https://craftcms.com/blog/ckeditor-revamped" rel="nofollow noreferrer">https://craftcms.com/blog/ckeditor-revamped</a></p>
<p>One of my very first check is &quot;copy &amp; paste&quot; into the RTE, because my editors WILL do this. (I know my editors ...)<br />
And after pasting some words, this is the resulting source code:</p>
<pre><code>&lt;p&gt;
    &lt;span style=&quot;background-color:rgb(251,252,254);color:rgb(63,77,90);&quot;&gt;normaler Text&lt;/span&gt;
&lt;/p&gt;
</code></pre>
<p>Unfortunally, this is a blocker for me to use this plugin, because within a very short time, I'll see a lot of formatted (= dirty) text in my projects. And if so, it's very hard to clean the database (rte fields).</p>
<p>I've done some research:<br />
This seems to be a solution <a href="https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-plain-text.html" rel="nofollow noreferrer">https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-plain-text.html</a></p>
<blockquote>
<p>To add this feature to your rich-text editor, install the @ckeditor/ckeditor5-clipboard package.</p>
</blockquote>
<p>This is the config of the CKEditor in Craft: <a href="https://github.com/craftcms/ckeditor/blob/main/package.json" rel="nofollow noreferrer">https://github.com/craftcms/ckeditor/blob/main/package.json</a><br />
-&gt; @ckeditor/ckeditor5-clipboard is not installed</p>
<p>Do you have an idea or hint, how to solve my problem?</p>
<h2>Edit 2024-03-22</h2>
<p>Just tried a copy&amp;paste on the CKEditor demo website (see link above):<br />
It fails -&gt; the unwanted stylings are still in the code.</p>
<p>How do you deal with the consequences of unwanted styles when copy&amp;paste text into CKEditor?</p>
<p>I'm asking, because I'm wandering that I'm not the only one to have this issue???</p>

<ckeditor5>
CKEditor 5: Paste plain text
# CKEditor 5: Paste plain text

(Asked by: username_0 on 2024-03-06)

I'm testing the new CKEditor: https://craftcms.com/blog/ckeditor-revamped
One of my very first check is "copy & paste" into the RTE, because my editors WILL do this. (I know my editors ...)
And after pasting some words, this is the resulting source code:

    normaler Text


Unfortunally, this is a blocker for me to use this plugin, because within a very short time, I'll see a lot of formatted (= dirty) text in my projects. And if so, it's very hard to clean the database (rte fields).
I've done some research:
This seems to be a solution https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-plain-text.html

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

This is the config of the CKEditor in Craft: https://github.com/craftcms/ckeditor/blob/main/package.json
-> @ckeditor/ckeditor5-clipboard is not installed
Do you have an idea or hint, how to solve my problem?
Edit 2024-03-22
Just tried a copy&paste on the CKEditor demo website (see link above):
It fails -> the unwanted stylings are still in the code.
How do you deal with the consequences of unwanted styles when copy&paste text into CKEditor?
I'm asking, because I'm wandering that I'm not the only one to have this issue???

**Tags:** ckeditor5


---

## 3 answers

### Answer by username_0 on 2024-03-27. Score: 0 | Accepted answer

I checked this again and I could not reproduce my problem / topic -> close this thread.


---

### Answer by username_1 on 2024-10-23. Score: 0

To answer this question:

> How do you deal with the consequences of unwanted styles when
> copy&paste text into CKEditor?

I'm still looking for a way to do this in CkEditor, because Redactor had some pretty sophisticated paste options. But you can also do this with an [HTML Purifier configuration](https://github.com/craftcms/ckeditor?tab=readme-ov-file#html-purifier-configs) that is run when the entry is saved. Our default HTML Purifier config strips out all span tags and undesired style attributes on any allowed tags, it's quite effective.


---

### Answer by username_2 on 2024-03-06. Score: 0

> Do you have an idea or hint, how to solve my problem?

Create an issue describing the problem at <https://github.com/craftcms/ckeditor/issues> and hope that it is updated, or even better, create a pull request with your proposed changes.

If neither results in the change you want, fork it, change it, and install your forked version instead. It's open source and GPL licensed, so you are free to chnage it however you want!


---

