Paste plain text in CKEditor
Permalink
Concrete5 8 now uses CKEditor. And this is great except one thing - it formats text on pasting. I've found how to disable it in CKEditor:http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#...
But I have no idea how to do this in Concrete5. I didn't found where it includes CKEditor to add extra option there.
And yea, I know about this button:https://www.concrete5.org/files/6114/8261/4551/acad40a4ef.png...
But this is just so unnecessary feature. Formating on pasting shouldn't be there at all, I want to get rid of it completely. It's bad for your website because people who will work with site don't know nothing about how to paste right. They will paste texts from everywhere and CKEditor will catch their fonts. Like this:
Font's that are no web-fonts and they are not even present on the site. This is terrible. Terrible feature of CKEDitor.
But I have no idea how to do this in Concrete5. I didn't found where it includes CKEditor to add extra option there.
And yea, I know about this button:https://www.concrete5.org/files/6114/8261/4551/acad40a4ef.png...
But this is just so unnecessary feature. Formating on pasting shouldn't be there at all, I want to get rid of it completely. It's bad for your website because people who will work with site don't know nothing about how to paste right. They will paste texts from everywhere and CKEditor will catch their fonts. Like this:
<p style="text-align: left;">professional financial forum</p> <h1 style="text-align: left;">FinProfit</h1> <p style="text-align: left;">new financial marketing</p> <pre style="background-color:#181818;color:#aeb5bd;font-family:'DejaVu LGC Sans Mono';font-size:10,5pt;"> <span style="color:#bababa;">float</span>: <span style="color:#4c84d9;">left</span>;</pre>
I'm using Concrete5 when I'm making a website for people who don't know nothing about HTML. So it's a bad idea to create HTML for them on pasting. It's not something useful, it will give them only difficulties and in the long run they will turn site into ugly looking creature without even uderstanding what they're doing.
/add
Your solution helped, thanks! I was looking CKEditor hook in *.js files before, but it's in PHP...
/add
Another annoying thing that I came up with - images uploads on pasting in editor. For example, you copy image in Photoshop by mistake, you press Ctrl+V in editor intending to paste text and image uploaded... And then you can't even delete it fast because you did it by mistake, you have to go to files manager and delete it from there. To disable this behavior, I commented this line:
Now life should become easier... <3 CKEditor in every other ways though.
/add
Your solution helped, thanks! I was looking CKEditor hook in *.js files before, but it's in PHP...
/add
Another annoying thing that I came up with - images uploads on pasting in editor. For example, you copy image in Photoshop by mistake, you press Ctrl+V in editor intending to paste text and image uploaded... And then you can't even delete it fast because you did it by mistake, you have to go to files manager and delete it from there. To disable this behavior, I commented this line:
'uploadUrl' => (string)URL::to('/ccm/system/file/upload'),
I am finding a different result when pasting directly into CKEditor from Word. As a web developer, I would not choose to paste from Word, but I am training non-developers to edit our website and CKEditor is including all kinds of inline styles and Word formatting when pasting directly Ctrl-V or via the Paste from Word icon.
The previous Paste as Plain text icon was helpful in stripping out formatting and I am seeing that it is not available any more. Is there a way to add it back in? Or, is there another approach that would work to paste in clean text from Word via CKEditor?
It is not realistic to train non-developers how to edit out the formatting via the HTML source code.
The previous Paste as Plain text icon was helpful in stripping out formatting and I am seeing that it is not available any more. Is there a way to add it back in? Or, is there another approach that would work to paste in clean text from Word via CKEditor?
It is not realistic to train non-developers how to edit out the formatting via the HTML source code.
I know this isn't the right answer, but an interim workaround is to get users to copy from Word into Notepad (or equivalent), and then copy from Notepad into c5. Yes, they will complain.
@stjohnscollege
The Paste As Plain Text and Paste from Word CKEditor plugins can be enabled on the Rich Text Editor page.
Dashboard > System & Settings > Basics > Rich Text Editor
The Paste As Plain Text and Paste from Word CKEditor plugins can be enabled on the Rich Text Editor page.
Dashboard > System & Settings > Basics > Rich Text Editor
By default, when you paste text into CKEditor, the original source HTML structure is preserved, but the original source inline styling is not. This creates what appears to be clean HTML markup. I believe this to be the proper default.
Using the "Paste from Word" plugin preserves the original source HTML structure and original source inline styling.
The "Paste as plain text" plugin removes the original source HTML structure and original source inline styling. The result is plain (raw) text.
I have attached screenshots describing these behaviors: default paste, Paste from Word, and Paste as plain text. The example text was copied from the following site:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table...
CkeditorEditor.php (concrete\src\Editor\CkeditorEditor.php) is the file that would accept the forcePasteAsPlainText config option. I tried overriding it without success.