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 #10199: Rich text editor: Include "ctrl-click to open" in link tooltips #10547

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Jun 5, 2024

Summary

This pull request adds a "ctrl+click to open" prompt to the beginning of tooltips shown in the rich text editor. This prefix is removed before saving. On MacOS, the prompt reads "cmd+click to open". This pull request has not yet been tested on MacOS.

See this commit for an alternate fix.

Resolves #10199.

Screenshots

Hovering over a web link shows "ctrl+click to open: http://URL here" or "ctrl+click to open: title here" if the link has a user-set title.

Hovering over a note link shows "Ctrl-click to open: joplin://some-note-id-here":

Hovering over a resource link shows "Ctrl-click to open", then the path to the item in Joplin's resource directory:

Titles are also changed in HTML notes:

Possible improvements

  • Show filenames or titles instead of resource and/or note IDs.

Testing plan

  1. Create a new note in the rich text editor with several web links (created with ctrl+k).
  2. Create a note link with drag-and-drop.
  3. Attach a file with the attach button.
  4. Verify that all links show a tooltip that starts with "ctrl+click to open" when hovered over.
  5. Switch to the markdown editor, then back to the rich text editor.
  6. Again, verify that all links show a tooltip that starts with "ctrl+click to open" when hovered over.

This has been tested successfully on Ubuntu 24.04.

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.
Comment on lines 37 to 39
element.title = _('cmd+click to open: %s', element.title || element.href);
} else {
element.title = _('ctrl+click to open: %s', element.title || element.href);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It might not be necessary to have a special case for when the link is a resource. We currently show the full file URL for resource links in the Rich Text Editor:

Not showing the full URL could be considered a regression and thus may be outside of the scope of this pull request.

@personalizedrefrigerator personalizedrefrigerator marked this pull request as draft June 6, 2024 14:23
@personalizedrefrigerator personalizedrefrigerator marked this pull request as ready for review June 10, 2024 20:28
@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Fixes #10199: Rich text editor: Include "ctrl+click to open" in link tooltips Desktop: Fixes #10199: Rich text editor: Include "ctrl-click to open" in link tooltips Jun 10, 2024
@laurent22 laurent22 merged commit 940739c into laurent22:dev Jun 11, 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.

Unable to click any hyperlinks
2 participants