manogi / nova-tiptap

Laravel Nova Tiptap Field
MIT License
172 stars 57 forks source link

editHtml is not working properly #53

Closed bcoelhodev closed 2 years ago

bcoelhodev commented 2 years ago

Hi,

When i activated the edit html option and add some html (<iframe> or <div>) and change to normal mode, the html is removed. If i insert something like <p> or <h6> works nice.

I'm using v2.7.3 and laravel nova v3.20.0.

manogi commented 2 years ago

Hi @bcoelhodev - that is expected behavior. Only the nodes that are allowed in Tiptap can be saved. Iframes and divs are not part of theses nodes.

bcoelhodev commented 2 years ago

So it is not possible to add iframe at all?! Right?

manogi commented 2 years ago

Iframe and Divs are not part of the default nodes in Tiptap (https://tiptap.dev/api/nodes), so it's kinda hard to implement this. It is not impossible, but also not easy.

I personally use Nova Tiptap as a text editor in Nova - not an HTML Editor or a "content editor". I normally don't even have use for the image button. For advanced use cases I usually use the package "Nova Flexible Content" (https://whitecube.github.io/nova-flexible-content) by @whitecube, where I then can have a block for an "iframe" and another block for a "text editor" (and another one for example for an image, or an image gallery, and so on). So I personally never had the need to extend Tiptap like that. But I am open to PRs in this direction, if you want to give it a shot.

bcoelhodev commented 2 years ago

Thanks @manogi