Forum

Thread tagged as: Question, Redactor

Strip Word Paste Styles from Redactor fields

Depending on the client, we use Markitup or Redactor.

Now we have a case of word-pasted formatting

 <span style='line-height: 150%; font-family: "Arial","sans-serif"; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-ansi-language: DE-CH; mso-fareast-language: UZ-CYR; mso-bidi-language: AR-SA;' data-redactor-style='line-height: 150%; font-family: "Arial","sans-serif"; font-size: 10pt; mso-fareast-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-ansi-language: DE-CH; mso-fareast-language: UZ-CYR; mso-bidi-language: AR-SA;'>...</span>

If I use striptags https://docs.grabaperch.com/docs/templates/attributes/striptags/, I'll lose the rest of the redactor formatting, as Redactor operates through html.

Is there a hidden option in striptags where you can supply the tags that should be stripped?

Like

<perch:content id="desc" type="textarea" label="Description" escape="true" striptags="span,bold" textile="true" words="30" />

?

Urs Bräm

Urs Bräm 1 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's a fools errand trying to strip the junk from Word. The only solution is to not paste in from Word.

I've now set pastePlainText: true in perch/addons/plugins/editors/redactor/_config.inc. Could you include that setting as default in future versions of the editor addon?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not sure there will be any future versions.