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: Resolves #10199: Show "ctrl-click to open" tooltip for links in the rich text editor (markdown notes only) #10359

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Apr 23, 2024

Summary

This pull request shows a "ctrl-click to open link" tooltip by links in the rich text editor.

Resolves #10199.

Notes:

  • This pull request only applies to markdown notes, as modified tooltips are added with Markdown-it and Turndown is used to restore the original tooltip when closing the Rich Text editor.
    • An alternative solution could be to override/update tooltips when loading a note in the Rich Text editor, then restore the tooltips when saving.
  • If the user specifes a different tooltip using the "edit link" dialog or in markdown, that tooltip is shown instead.

This pull request has automated tests.

Screenshots

screenshot: Hovering over a resource link shows "ctrl-click to open link"
screenshot: Hovering over a website URL shows "ctrl-click to open link https://joplinapp.org/"
screenshot: Edit link dialog shows the "ctrl-click to open link" title

@personalizedrefrigerator
Copy link
Collaborator Author

  • This pull request only applies to markdown notes, as Turndown is currently used to restore the original tooltip when closing the Rich Text editor.
    • An alternative solution could be to override/update tooltips when loading a note in the Rich Text editor, then restore the tooltips when saving.

This pull request also applies only to:

  1. Markdown-style links ([example](https://example.com/ and not <a href="https://example.com/">Example</a>),
  2. Links added before the last re-render (e.g. before opening the current note).

As such, I think the alternative solution described above would be better.

@personalizedrefrigerator
Copy link
Collaborator Author

For future reference, I'm linking this to #10215, which takes a similar approach.

personalizedrefrigerator added a commit to personalizedrefrigerator/joplin that referenced this pull request Jun 5, 2024
This is a potential fix for laurent22#10199. This particular fix displays a
custom tooltip, in addition to the OS tooltip. The custom tooltip is
shown above the target element, while the OS tooltip (at least on my
Linux system) is shown below.

After this, I plan to work on a different fix that changes the content
of the OS tooltip, and changes it back before saving. This would be a
similar approach to laurent22#10359, except change the content in the rich text
editor, rather than in `turndown`. This has the advantage of also
working for HTML notes.
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.

Unable to click any hyperlinks
1 participant