-
Notifications
You must be signed in to change notification settings - Fork 12
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: Hyperlink a text selection when pasting a valid URL #435
Conversation
✅ Deploy Preview for doist-typist ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type a Markdown link with title (i.e.
[dolor sit amet](https://example.com "EXAMPLE"
)
Wow, I did not know about that syntax to add a title.
(with
Ctrl/Cmd + Shift + V
)
Pressing this key combination did not paste anything for me. I was using Safari on macOS, which is apparently related because I then tried in Chrome, and it worked. Is this a known issue that this feature is not supported in Safari?
I marked all the related test plan items as checked, because it worked in Chrome. But it did not work in Safari.
Type
vehicula congue
, make sure it's not hyperlinked, select that text, and paste a URL on the selection (try multiple URLs, like valid public ones, localhost ones,message://
ones, simple ones likeexample.com
)
In this part of the test plan, it worked as expected, except when using the message://
url pattern.
CleanShot.2023-09-08.at.09.21.07.mp4
I honestly have no idea, maybe the Safari shortcuts are different: Could you try those?
Hum, well, I guess linkify does not detect these patterns as "valid URLs", based on the docs it seems that only works for URLs and e-mail addresses. We could probably rewrite the validation using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try those?
Option-Shift-Command-V
worked
I'll remove that
message://
URL pattern from the test plan.
With that removed, I can check the plan fully.
Thank you for this review, @gnapse 👍 |
## [1.4.12](v1.4.11...v1.4.12) (2023-09-08) ### Bug Fixes * Hyperlink a text selection when pasting a valid URL ([#435](#435)) ([999455e](999455e))
🎉 This PR is included in version 1.4.12 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Overview
This PR closes #423 with an implementation that does not require an upstream fix, one that increases the priority for our custom "paste extensions", making sure they are above the built-in
Link
extension. This will make sure that our handlers kick-in first, handling Markdown if and when appropriate. On top of that, it will check if the content being pasted is a valid URL, and if it is, let the built-in handlers do their thing (thus fixing #423).This approach will fix most of our issues - but not all - with a more consistent and predicable approach, which will make it easier to debug other issues that we have or might end up having in the future.
PR Checklist
Test plan
Rich-text → Default
story[lorem ipsum](https://example.com)
[dolor sit amet](https://example.com "EXAMPLE")
EXAMPLE
tooltip will show[maximus lobortis](https://example.com)
and paste into the editor (withCtrl/Cmd + Shift + V
)[aliquet mauris](https://example.com "EXAMPLE")
and paste into the editor (withCtrl/Cmd + Shift + V
)EXAMPLE
tooltip will show[pellentesque metus vitae](message://%3cMB4777@DM6PR05.example.com%3e)
and paste into the editor (withCtrl/Cmd + Shift + V
)[interdum ultrices tortor](message://%3cMB4777@DM6PR05.example.com%3e)
and paste into the editor (withCtrl/Cmd + Shift + V
)vehicula congue
, make sure it's not hyperlinked, select that text, and paste a URL on the selection (try multiple URLs, like valid public ones, localhost ones, and simple ones likeexample.com
)It should look something like this: