Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize removes links (<a>) and underline (<u>) #26

Closed
mreduar opened this issue Jul 13, 2022 · 2 comments
Closed

Sanitize removes links (<a>) and underline (<u>) #26

mreduar opened this issue Jul 13, 2022 · 2 comments

Comments

@mreduar
Copy link

mreduar commented Jul 13, 2022

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 mreduar changed the title Sanitize removes links and underline Sanitize removes links (<a>) and underline (<u>) Jul 13, 2022
@davorpeic
Copy link

@mreduar Hi, it is most probably related with #20 where Link is not included by default in StarterKit.

@mreduar
Copy link
Author

mreduar commented Jun 1, 2023

@mreduar Hi, it is most probably related with #20 where Link is 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

@mreduar mreduar closed this as completed Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants