MODX Community

Fred RTE span tags on copy/paste

When copying and pasting text on the the Rich Text Editor in Fred I get a span tag wrapping around the pasted text, like this:

<p style="text-align: left;">Lots of text.&nbsp;<span style="letter-spacing: 0.32px; font-size: 1rem;">Lots of text.&nbsp;</span><p style="text-align: left;">Lots of text.&nbsp;<span style="letter-spacing: 0.32px; font-size: 1rem;">Lots of text.&nbsp;</span></p>

Any way of preventing the span tag from appearing?

(MODX Revolution 2.7.3-pl, Fred 1.1.1-pl, Fred TinyMCE RTE 1.0.0-pl)

Paste as plain text - cmd/ctrl + shift + v

Is there any way of forcing this? I don’t think my clients will be able to remember it :grimacing:

Try adding the ‘Paste as plain text’ TinyMCE plugin https://www.tiny.cloud/docs/plugins/paste/#paste_as_text

Not sure how or where I would do that :see_no_evil:

Ahh right, sorry I pasted that in haste. So in FRED CMP you can add RTE Configs. Since you are most likely using the FRED TinyMCE5 extra you can customise the richtext editor by adding your own configs.

Here is a config that we created for our FRED installations: https://gist.github.com/NatemcM/21c29df5a9154ef3e34c98ed22594d13. Simply copy and paste that code into a new RTEConfig set and name it TinyMCE. This will automatically be assigned to any element that has the following code:

<div data-fred-name="content" data-fred-rte="true"></div>

If you only certain elements to have different types of editors you can create a new RTE config and then call it in your element with:

<div data-fred-name="content" data-fred-rte="true" data-fred-rte-config="YourRTEconfig"></div>

If you use my RTE Config, then add "paste_as_text": true, above "image_advtab": true,. This should activate the right setting within TinyMCE5.

Hope that helps