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:
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.Sign up to join this community
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):
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!)