<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>

CC BY-SA 3.0
2018-01-22T17:21:57.827Z
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.
Dom Stubbs
CC BY-SA 3.0
2014-12-17T09:55:12.893Z
2014-12-17T10:25:32.123Z
2014-12-17T10:25:32.123Z
carlcs
<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>

CC BY-SA 3.0
2014-12-17T04:10:58.787Z
That is really cryptic question. Can you clarify?
Douglas McDonald
CC BY-SA 3.0
2014-12-17T09:14:20.990Z
I write in plugin <div class="my-class">my text</div>, but when I insert the clip div tags are cut enter code here
Vitaliy  Badalov
<plugins><redactor><plugin-redactorclips>
Redactor clips plugin removes DIV tags from inserted HTML?
# Redactor clips plugin removes DIV tags from inserted HTML?

(Asked by: username_0 on 2014-12-16)

I'm trying to insert a clip `my text`. 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 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.  

---

