I am looking for a way to ensure that I always get plain text if the user pastes text using ctrl+v.
I have tried adding config.forcePasteAsPlainText = true; to my CKEDITOR.editorConfig function and I still get a large amount of nbsp; etc.
The only way I seem to be able to get true plain text is using the paste as plain text button on the toolbar.
Is there a way to open that window if the user uses ctrl+v to paste and have them paste there.
I know it could be done with fckeditor, but have not been able to figure out how to make it work in ckeditor.
Any help would be greatly appreciated!
Thanks
I checked the latest SVN version (should differ a lot from 3.6.3) and when I set
forcePasteAsPlainText : true(note – you have to do this before initializing editor or ineditor.replace( el, config )– doing this later won’t work.I’m pasting (by ctrl+v) copied part of a website and text is being pasted correctly. No styling, no superfluous and non-plain-text elements.
However, the
entities are fully correct in plain text – they replace multiple spaces and you’ll have the same result for content pasted by pastetext dialog.If you still want to open pastetext dialog on ctrl+v you can use
CKEDITOR.config.keystrokes. There’re couple of defaults in this array, so you shouldn’t override them, but you can add your own keystroke (before initializing editor):If you want to add this keystroke only for one editor (because editing global config affects all) then you’ll have to use custom config file (see http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Using_the_config.js_File) and add your keystroke this way:
This way OFC isn’t convenient, but this will be fixed in the next major release of CKEditor.