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: do not use window.open for links in readonly mode #4073

Merged
merged 2 commits into from Jul 7, 2023

Conversation

thecodrr
Copy link
Contributor

@thecodrr thecodrr commented May 25, 2023

Please describe your changes

This PR prevents opening of links using window.open on clicking them in readonly mode.

How did you accomplish your changes

When contenteditable is true, the browser doesn't allow direct link opens on clicking the a element. This is why we need to call window.open to open our links.

However, when contenteditable is false, the default browser mechanism for opening links works and there is no need for using window.open.

Without this change, TipTap would open 2 new tabs on clicking a link.

How have you tested your changes

By enabling readonly mode and clicking on links.

How can we verify your changes

By enabling readonly mode and clicking on links.

Remarks

[add any additional remarks here]

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

When `contenteditable` is `true`, the browser doesn't allow
direct link opens on clicking the `a` element. This is why we
need to call `window.open` to open our links.

However, when `contenteditable` is `false`, the default
browser mechanism for opening links works and there is no
need for using `window.open`.
@netlify
Copy link

netlify bot commented May 25, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 9c84cc0
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/646ee684b660db00088ef6af
😎 Deploy Preview https://deploy-preview-4073--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 settings.

@bdbch bdbch merged commit 4bca77e into ueberdosis:develop Jul 7, 2023
15 checks passed
@thecodrr thecodrr deleted the fix/link-in-readonly branch July 7, 2023 13:36
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

Successfully merging this pull request may close these issues.

None yet

2 participants