Skip to content

feat(message): copy and save message images and link actions in the c… - #1967

Open
Th-Underscore wants to merge 1 commit into
SableClient:devfrom
Th-Underscore:feat/message-image-actions
Open

feat(message): copy and save message images and link actions in the c…#1967
Th-Underscore wants to merge 1 commit into
SableClient:devfrom
Th-Underscore:feat/message-image-actions

Conversation

@Th-Underscore

Copy link
Copy Markdown

Description

Context-menu additions for messages:

  • Copy Image / Save Image on right-clicking any image in a message: encrypted attachments use the decrypt-aware media download; other images (avatars, URL-preview thumbnails, inline) use their displayed source with format-aware handling. "Save Image" reuses the zoom-in viewer's save path with smarter filenames - the image's own title/alt is preferred, then the decoded URL basename, then a generic name, always sanitized and given the correct extension from the actual content type. Both close immediately with a busy cursor plus success/failure toast, mimicking Discord. If requested, these flairs can be toned down/removed for the sake of simplicity.
  • Copy URL / Open Link on right-clicking links. "Open Link" mirrors a real target="_blank" anchor click as window.open doesn't route to the system browser from Sable's desktop webview.

The zoom-in viewer's own Save As picks up the same filename/extension improvements, keeping both paths consistent.

Tested on the desktop app, Ubuntu 24.04.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation - .changeset
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).

I designed and directed the features and tested them in the GUI; the code itself was AI-generated.

Copy/Save reuse the existing zoom-in primitives (copyImageToClipboard, downloadMedia, saveFileToDevice) factored into small tested pure helpers (downloadMessageImage, resolveImageSaveFilename). Image detection is closest('[data-message-attachment], img'), so any image works while encrypted attachments keep their decrypt path. Filename resolution lives in $utils/download.ts alongside the existing sanitizer, with MIME-aware extensions derived from the downloaded blob's actual type instead of possibly-absent metadata. Clipboard failures throw so the caller can toast instead of failing silently.

@Th-Underscore
Th-Underscore force-pushed the feat/message-image-actions branch from fd83de7 to 963f1ef Compare August 27, 2026 03:14
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.

1 participant