Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
I am constantly faced with the issue where clients would copy-paste text from let's say Word in the input field in CouchCMS and if it is a richtext or nicedit type of input the original formatting remains the same. I know that there is an option to remove formatting manually or to edit HTML, but it more understandable for the user to have their text formatted automatically like it is done in input type text.

So the question is how to automatically remove any formatting on the text pasted from outside of CouchCMS in nicedit and richtext input fields?
Have you checked couch/includes/ckeditor/config.js? There is an option for that. It applies to richtext editor, though.
Does it help?
Is there a way to get it to work for nicedit?

The amount of content user is supposed to input into nicedit field is just one paragraph there is no need for extra features richtext provides (ex. paragraph formatting). The UI for nicedit is cleaner too - only icons.
aleks wrote: Is there a way to get it to work for nicedit?

The amount of content user is supposed to input into nicedit field is just one paragraph there is no need for extra features richtext provides (ex. paragraph formatting). The UI for nicedit is cleaner too - only icons.


Not at the moment. What happens if you use simple textarea? Also, if the only trouble with richtext is the toolbar, it is possible to reduce it to as few icons as you decide - quoting from the docs -

<cms:editable name='desc' label='Description'
desc='Enter description of property here'
toolbar='custom'
custom_toolbar='bold, italic'

type='richtext'/>


I googled and found this nice little javascript function that cleans up the string from ms-word bloat. https://gist.github.com/honza/1122770 It is probably possible to attach it to nicedit, but I doubt it is worth the effort given there are other options. Don't you think so?
I found an article with a probable solution for nicedit - http://archive.billyflaherty.com/blog/2 ... m-ms-word/ - however it would take time to thouroughly merge it with existing file couch/addons/nicedit/nicedit.js Maybe someone else js-literate could step in and get the job done.
Thanks for your input trendoman!

I have enabled the force plain text in ckeditor config.js:
Code: Select all
config.forcePasteAsPlainText = true;

And changed the type to richtext with custom toolbar:
Code: Select all
<cms:editable type='richtext' toolbar="custom" custom_toolbar="bold, italic, underline, numberedlist, bulletedlist, link, unlink, removeformat, pastefromword, source" name='desc' label='description' /> 


It would be great to have pastefromword button in nicedit type though.
The "pastefromword button" is not necessary if the change is made to nicedit.js - because supposed change already tries to remove any kind of formatting from a pasted text.

Also, since you have enabled the option in richtext and switched to it - could you please let us know if the pasting from word still requires a button 'pastefromword' or text already gets pasted as a plain text? I.e. does the option work as intended?
7 posts Page 1 of 1