Answers.Body: <p>You've probably got "Purify HTML" checked under your Rich Text field's settings and that's stripping code.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-02T11:37:01.923Z
Answers.Text: 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.
Answers.UserDisplayName: Matt Wilcox
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-01T23:36:39.053Z
Answers.LastActivityDate: 2016-03-01T23:36:39.053Z
Answers.UserDisplayName: Brad Bell
Body: <p>In one of the Rich Text Fields I'm entering little snippets like this:</p>
  
  <pre><code>&lt;pre&gt;
  &lt;code class="language-css"&gt;
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility !important;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, .004);
  &lt;/code&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>Is there anyway to prevent redactor from doing this?</p>
  
Tags: <entries><redactor>
Title: Prevent Rich Text editor from removing code tags?
ThreadText: # Prevent Rich Text editor from removing code tags?
  
  (Asked by: username_0 on 2016-03-01)
  
  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?
  
  **Tags:** entries, redactor
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-01. Score: 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.
  
  > **Comments:**
  > **username_2**: 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.  
  
  ---
  
  