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

fix(link): Do not convert link href to number or boolean #5391

Merged
merged 2 commits into from
Aug 11, 2024

Conversation

yurtsiv
Copy link
Contributor

@yurtsiv yurtsiv commented Jul 24, 2024

Changes Overview

Link href attribute doesn't have parseHTML provided, so TipTap uses a default implementation that converts strings to numbers/booleans. This leads to crashes in cases like:

editor.commands.setContent('<a href="123">...</a>')
editor.commands.setContent('<a href="true">...</a>')

// TypeError: uri.replace is not a function
//   at isAllowedUri

Render function assumes href is string | null.

Implementation Approach

Provide a custom parseHTML implementation.

Testing Done

Verification Steps

Additional Notes

Checklist

  • I have created a changeset for this PR if necessary.
  • My changes do not break the library.
  • I have added tests where applicable.
  • I have followed the project guidelines.
  • I have fixed any lint issues.

Related Issues

#4929

@yurtsiv yurtsiv requested review from bdbch and svenadlung as code owners July 24, 2024 16:04
Copy link

changeset-bot bot commented Jul 24, 2024

🦋 Changeset detected

Latest commit: c00fa5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Jul 24, 2024

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit c00fa5c
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/66b8f7ca54389f0008dc6b7d
😎 Deploy Preview https://deploy-preview-5391--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, thanks for your contribution

@nperez0111 nperez0111 merged commit 08b4319 into ueberdosis:develop Aug 11, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants