Auto-update images on save #2

Closed
opened 2025-04-01 22:04:41 +00:00 by massivebox · 1 comment
Owner

When editing a Markdown image, we should make it so when the changes are saved, the changes are immediately reflected.
This is currently not the case because of SiYuan's caching.

Proposed implementation:

  • On save, search for blocks containing a link to the asset that is currently being edited
  • Edit the URL of the asset to include an useless anti-cache parameter

Examples:

  • ![Image](assets/20250401091113-tsvpfkh.svg) => ![Image](assets/20250401091113-tsvpfkh.svg?antiCache=123)
  • ![Image](assets/20250401091113-tsvpfkh.svg?antiCache=100) => ![Image](assets/20250401091113-tsvpfkh.svg?antiCache=456)

This should theoretically suffice to avoid the caching problem

When editing a Markdown image, we should make it so when the changes are saved, the changes are immediately reflected. This is currently not the case because of SiYuan's caching. Proposed implementation: - On save, search for blocks containing a link to the asset that is currently being edited - Edit the URL of the asset to include an useless anti-cache parameter Examples: - `![Image](assets/20250401091113-tsvpfkh.svg)` => `![Image](assets/20250401091113-tsvpfkh.svg?antiCache=123)` - `![Image](assets/20250401091113-tsvpfkh.svg?antiCache=100)` => `![Image](assets/20250401091113-tsvpfkh.svg?antiCache=456)` This should theoretically suffice to avoid the caching problem
massivebox added this to the SVGs First and Foremost project 2025-04-01 22:05:32 +00:00

To avoid potential performance issues from excessive saving, I'd recommend triggering auto-save only when closing tabs.

To avoid potential performance issues from excessive saving, I'd recommend triggering auto-save only when closing tabs.
Sign in to join this conversation.
No labels
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: massivebox/siyuan-jsdraw-plugin#2
No description provided.