iframe in rich editor
I created a Youtube Video block in the Rich Editor, which in its view file has an iframe that load the video id. But iframes dont seem to work when i renderRichContent()
When i inspect the code, the wrapping div is just empty.
Anyone have an idea how to fix this?
5 Replies
You need a php version of the extension too. So the renderer can parse it.
I'm sorry, i need what of what now?
I have a YoutubeVideoBlock.php in my Forms directory, with this for example:
Is that what youmean?
no, you need a https://github.com/ueberdosis/tiptap-php class for the extension, see https://github.com/filamentphp/filament/tree/4.x/packages/forms/src/Components/RichEditor/TipTapExtensions for some examples. And then register it in your editor plugin: https://filamentphp.com/docs/4.x/forms/rich-editor#extending-the-rich-editor
GitHub
GitHub - ueberdosis/tiptap-php: A PHP package to work with Tiptap c...
A PHP package to work with Tiptap content. Contribute to ueberdosis/tiptap-php development by creating an account on GitHub.
GitHub
filament/packages/forms/src/Components/RichEditor/TipTapExtensions ...
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire - filamentphp/filament
is this specific for the iframe element?
I dont understand why all my other blocks work, all my other custom blocks just work. I've got an image gallery, a links-block, usps, multi column etc.
They all have php variables etc. They all work. its just the iframe element that doenst render.
What makes this so different? Is this something i should be able to find in the docs?
This is how i defined it:
in my Page class i have this:
Im not trying to register a new plugin, and im not sure why i should?
Didn’t realize it was in a block. Sorry. Ignore my suggestions.
You probably need to override Filaments HtmlSanitizer instance. Or use ->toUnsafeHtml() instead of ->toHtml()
Filament’s sanitizer instance used by Str::sanitizeHtml()
Had a similar issue recently trying to render svg’s