CKEditor forcePasteAsPlainTest

Sharon Parry asked on July 6, 2018 00:56

Hi,

According to the CKEditor documentation, you can force paste as plain text with config.forcePasteAsPlainText = true. I've done this in a previous version 7 project, but can't get it to work in version 11.

Paste from Word also doesn't strip out Word's formatting!

What am I missing?

Recent Answers


Brenden Kehren answered on July 6, 2018 01:50

Hey Sharon, have you tried to do a hard clear of your cache in the browser?

0 votesVote for this answer Mark as a Correct answer

Sharon Parry answered on July 6, 2018 01:55

Hi Brenden,

Yes, have cleared the browser cache, tried various other browsers (eg, Firefox, IE, Chrome), cleared the cache via System and restarted the application. Nothing seems to make any difference.

Have read some posts at CKEditor site where others have had problems, but they are all 3 or 4 years old.

0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on July 6, 2018 14:19

Sharon Parry answered on July 6, 2018 22:30

Hi Vasu,

Yes, aware of the paste options on the toolbar, but this isn't what I'm trying to do.

I want to always FORCE paste as plain text.

0 votesVote for this answer Mark as a Correct answer

vasu yerramsetti answered on July 7, 2018 11:51

Hi Sharon,

Please refer this URL for Pasting as plain text ≠ content filtering https://docs.ckeditor.com/ckeditor4/latest/guide/dev_best_practices.html#pasting-as-plain-text-content-filtering

See demo for Advanced Content Filter – Automatic Mode https://sdk.ckeditor.com/samples/acf.html

0 votesVote for this answer Mark as a Correct answer

Sharon Parry answered on July 7, 2018 23:23

Hi Vasu,

Thanks for those links. I had previously experimented by setting config.allowedContent to false, which made no difference. However reading those articles through carefully, can see now how that is used.

Removing the config.allowedContent = true setting altogether from config.js works as expected HOWEVER it only applies to formatting relating to buttons available on the specific WYSIWYG area. eg, if the toolbar set for the editable text area where you are pasting (ie, ctrl-v on a PC keyboard) is either the standard or full toolbar, then content coming from Word where there are different fonts, sizes, colours, or tables etc remain in the pasted content. If you change the toolbar on the text area to be, say, the Basic toolbar, then the content is pasted in correctly - WITHOUT any of the superflous formatting!

But that defeats the purpose of content editors being able to apply specific styling to content they create by using the toolbar buttons.

Interestingly, though, if you paste with the keyboard (ctrl-v) in Internet Explorer, all additional formatting is stripped out - ie, you get the same functionality as if you had clicked the Paste as Plain Text button. That is, actually, what I've been trying to achieve, but using other browsers.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.