Answers.Body: <p><strong>Edit:</strong></p>
  
  <p>There's other problems / bugs with the Redactor API going on that lead to unexpected behavior on formatting the inserted HTML. The solution provided below does allow to insert HTML with DIV tags only if inserted in a new paragraph, otherwise it strips the tags. Another issue I came across is that I get empty SPAN tags added and I don't know where these come from?!</p>
  
  <p><strong>--</strong></p>
  
  <p>The plugin uses Redactor API's <a href="http://imperavi.com/redactor/docs/api/insert/" rel="nofollow"><code>insert.html</code></a> function. Which by default cleans the HTML before inserting it. But there's a parameter to prevent it from doing so.</p>
  
  <p>You can hack / fork the plugin and set the parameter in redactorclips/resources/clips.js (line 63):</p>
  
  <pre><code>this.insert.html(html, false);
  </code></pre>
  
  <p><s>I will create a Github issue for this, because it definitely makes sense to have HTML cleaning disabled by default or at least have a setting for it.</s> <em>(Edit: makes no sense as long as there's all the other issues with the API!)</em></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T17:21:57.827Z
Answers.Text: This still seems to be an issue with the clips plugin, as Redactor was insisting on stripping `<br>` tags in a clip that I created. The API seems to have changed slightly now - you need to change `this.insert.html()` to `this.insert.raw()` if you want the clip markup to be added unmolested.
Answers.UserDisplayName: Dom Stubbs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-17T09:55:12.893Z
Answers.LastActivityDate: 2014-12-17T10:25:32.123Z
Answers.LastEditDate: 2014-12-17T10:25:32.123Z
Answers.UserDisplayName: carlcs
Body: <p>I'm trying to insert a clip <code>&lt;div class="my-class"&gt;my text&lt;/div&gt;</code>. But when I insert the clip, the DIV tags are removed.</p>
  
  <p>I have this setting in my Redactor config json: <code>replaceDivs: false</code></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-17T04:10:58.787Z
Comments.Text: That is really cryptic question. Can you clarify?
Comments.UserDisplayName: Douglas McDonald
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-12-17T09:14:20.990Z
Comments.Text: I write in plugin <div class="my-class">my text</div>, but when I insert the clip div tags are cut enter code here
Comments.UserDisplayName: Vitaliy  Badalov
Tags: <plugins><redactor><plugin-redactorclips>
Title: Redactor clips plugin removes DIV tags from inserted HTML?
ThreadText: # Redactor clips plugin removes DIV tags from inserted HTML?
  
  (Asked by: username_0 on 2014-12-16)
  
  I'm trying to insert a clip `<div class="my-class">my text</div>`. But when I insert the clip, the DIV tags are removed.
  
  I have this setting in my Redactor config json: `replaceDivs: false`
  
  **Tags:** plugins, redactor, plugin-redactorclips
  
  > **Comments:**
  > **username_1**: That is really cryptic question. Can you clarify?  
  > **username_0**: I write in plugin <div class="my-class">my text</div>, but when I insert the clip div tags are cut enter code here  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2014-12-17. Score: 3
  
  **Edit:**
  
  There's other problems / bugs with the Redactor API going on that lead to unexpected behavior on formatting the inserted HTML. The solution provided below does allow to insert HTML with DIV tags only if inserted in a new paragraph, otherwise it strips the tags. Another issue I came across is that I get empty SPAN tags added and I don't know where these come from?!
  
  **--**
  
  The plugin uses Redactor API's [`insert.html`](http://imperavi.com/redactor/docs/api/insert/) function. Which by default cleans the HTML before inserting it. But there's a parameter to prevent it from doing so.
  
  You can hack / fork the plugin and set the parameter in redactorclips/resources/clips.js (line 63):
  
  ```
  this.insert.html(html, false);
  
  ```
  
  ~~I will create a Github issue for this, because it definitely makes sense to have HTML cleaning disabled by default or at least have a setting for it.~~ *(Edit: makes no sense as long as there's all the other issues with the API!)*
  
  > **Comments:**
  > **username_3**: This still seems to be an issue with the clips plugin, as Redactor was insisting on stripping `<br>` tags in a clip that I created. The API seems to have changed slightly now - you need to change `this.insert.html()` to `this.insert.raw()` if you want the clip markup to be added unmolested.  
  
  ---
  
  