How to prevent escaping & wrapping <iframe> HTML in TipTap Editor?

I'm using TipTap editor and allowing users to paste Bandcamp iframes. The problem is that when saving, the iframe code gets escaped and wrapped inside <p> tags, like this:
<p>&lt;iframe src="...">&lt;/iframe&gt;</p>
<p>&lt;iframe src="...">&lt;/iframe&gt;</p>
This breaks rendering because the HTML is escaped and malformed. On the backend, I'm sanitizing input with HTMLPurifier (Stevebauman\Purify), and on the frontend, using DOMPurify to safely render HTML. Despite this, the iframe ends up escaped and wrapped in unwanted <p> tags. I am accepting iframes on Purify's config so, I've tried allowing it on that end but nothing seems to work.
'HTML.Allowed' => 'iframe[src|width|height|frameborder|allowfullscreen]...',
'HTML.Trusted' => true,
'HTML.SafeIframe' => true,
'HTML.SafeObject' => true,
'HTML.Allowed' => 'iframe[src|width|height|frameborder|allowfullscreen]...',
'HTML.Trusted' => true,
'HTML.SafeIframe' => true,
'HTML.SafeObject' => true,
Is there a way to configure Filament or the editor to save raw iframe HTML without escaping or wrapping it in <p>?
1 Reply
Darnes
Darnes5d ago
any answer

Did you find this page helpful?