1

In one of the Rich Text Fields I'm entering little snippets like this:

<pre>
<code class="language-css">
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility !important;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, .004);
</code>
</pre>

However, each time i edit again it removes the value although when i save it the first time its ok. I think its converting at edit time.

Is there anyway to prevent redactor from doing this?

3

You've probably got "Purify HTML" checked under your Rich Text field's settings and that's stripping code.

You should really only have that checked if you're accepting input from untrusted sources using the Rich Text field on the front-end of your site. Presumably all users using the control panel are trusted enough not to input malicious code into the site.

  • Depends where they're copy-pasting the content from. The amount of times our clients just copy from a website or PDF and ended up with mangled code in the Entry... I could see someone copying a JS worm accidentally. We now have Purify on all the time. Far less issues. – Matt Wilcox Mar 2 '16 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.