tiptap-php
tiptap-php copied to clipboard
Sanitize removes links (<a>) and underline (<u>)
Hi, I have installed the package just to sanitize the content generated by tiptap in the frontend. And I notice that when sanitizing it removes the links (a tags) and underlines (u tags), how is it possible to avoid this behavior?
@mreduar Hi, it is most probably related with https://github.com/ueberdosis/tiptap-php/issues/20 where Link is not included by default in StarterKit.
@mreduar Hi, it is most probably related with #20 where
Linkis not included by default in StarterKit.
At the time I did not give it much importance, but now that the time has come to solve the problem I had to inquire more about what you mentioned and indeed that was the problem. This should be included by default in my opinion. Solve the problem by adding the Link Mark to the Editor
use Tiptap\Editor;
use Tiptap\Extensions\StarterKit;
use Tiptap\Marks\Link;
(new Editor([
'extensions' => [
new StarterKit(),
new Link(),
],
]))->sanitize($content)
Thank you @davorpeic