feat(context-menu): add "Copy Image to Clipboard" functionality to image context menu #470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this PR
This PR adds a new "Copy Image to Clipboard" feature to the context menu for images in our Electron app. This enhancement complements the existing functionality that allows users to save images or copy image URLs by providing a more direct way to capture image content for pasting elsewhere.
The feature was requested as an enhancement to improve user workflow when working with images, particularly for users who need to quickly transfer image content between applications without saving files to disk first.
Fixes: #200
How does it work
The implementation uses Electron's native APIs to fetch and process images:
fetch()
to retrieve the image data from the source URLnativeImage.createFromBuffer()
clipboard.writeImage()
This approach ensures compatibility with various image types and sources while maintaining the existing menu structure and user experience.
Test instructions
Setup:
Testing the feature:
Verifying functionality:
Regression testing: