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 #10551: Watch resources for changes when opened from the Rich Text Editor #10554

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This pull request causes resources opened from the Rich Text Editor to be watched for changes.

The Rich Text Editor creates file:https:// URLs for resource links. While this should prevent these links from breaking when pasted into other programs, calling openItem with a file:https:// link to a resource would not cause the resource to be watched (while openItem with a joplin:https://resourceidhere-style link would). This pull request converts file:https:// URLs that point to resources into joplin:https://-style URLs before trying to parse them as resource URLs. As a result, these URLs are opened with openItemById and are watched for changes.

Fixes #10551.

Other changes

  • urlUtils.js was modified and thus migrated to TypeScript.
  • A new richTextEditor.spec.ts file was created for this change's automated regression test. The other test for the Rich Text Editor was also moved into this file.

Testing plan

This pull request includes an automated Playwright test, which runs successfully on Ubuntu 24.04 and Windows 11. In addition to this, it has been verified (on Ubuntu 24.04) that:

  1. attaching a markdown file to a note from the Rich Text Editor,
  2. ctrl-clicking on the just-added link,
  3. editing the markdown file in the editor that is shown,
  4. saving, and finally
  5. inspecting the metadata for the markdown file

shows that the blob_updated_time property changed, when compared to its value before saving the resource.

@laurent22 laurent22 merged commit c511fb5 into laurent22:dev Jun 10, 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.

Attachments not watched for changes when opened from the Rich Text Editor
2 participants