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

Desktop: Fixes #9950: Link created by LINKIFY in WYSIWYG editor is not underlined until switch to another note #10202

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

danimnunes
Copy link
Contributor

@danimnunes danimnunes commented Mar 25, 2024

Fixes : #9950

The current behavior is such that when adding a link to a note using the WYSIWYG editor, the link is not immediately underlined. However, if you switch to another note and then return to the note created earlier, the link is underlined as expected. The expected behavior is that links should be underlined immediately upon insertion, without the need to leave and return to the note.

I found that the problem was that when I pasted the link it was considered as plainText, so I created a function that checks if the pasted text is a link and added this check to the markdowntags if.

Here is the video without the bug fixed:

Screencast.from.26-03-2024.22.12.17.webm

Here is the video after solving the bug:

Screencast.from.26-03-2024.22.10.57.webm

…underlined until switch to another note

The current behavior is such that when adding a link to a note using the WYSIWYG editor, the link is not immediately underlined.
However, if you switch to another note and then return to the note created earlier, the link is underlined as expected.
The expected behavior is that links should be underlined immediately upon insertion, without the need to leave and return to the note.

I found that the problem was that when I pasted the link it was considered as plainText, so I created a function that checks if the pasted
text is a link and added this check to the markdowntags if.
@danimnunes danimnunes changed the title FIX laurent22#9950: Link created by LINKIFY in WYSIWYG editor is not underlined until switch to another note Desktop: Fixes #9950: Link created by LINKIFY in WYSIWYG editor is not underlined until switch to another note Mar 25, 2024
Comment on lines 970 to 974
public static isLink(text: any) {
if (!text) return false;
const linkRegex = /^https?:\/\/[^)\s]+$/;
return !!text.match(linkRegex);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Please move this to packages/utils/url.ts.

Also no "any" please. The input is a string. Also if should handle a number of protocols: https://, http://, file://, joplin://

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review! I've already made the requested changes

@laurent22 laurent22 merged commit 8630c8e into laurent22:dev Apr 3, 2024
10 checks passed
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.

Link created by LINKIFY in WYSIWYG editor is not underlined until switch to another note
2 participants