-
Notifications
You must be signed in to change notification settings - Fork 13k
feat: Add clipboard image paste support for macOS #1580
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
Merged
scottdensmore
merged 15 commits into
google-gemini:main
from
jaysondasher:feature/clipboard-image-paste
Jul 12, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7d153e0
feat: Add clipboard image paste support for macOS
jaysondasher f29ac16
refactor: simplify clipboard image paste implementation
jaysondasher cb65919
feat: improve clipboard image paste with multi-format support and tests
jaysondasher 7840839
test: add InputPrompt clipboard paste tests per review feedback
jaysondasher eb059c5
test: remove timeouts and unnecessary comments from clipboard tests
jaysondasher db57457
rebased / reformatted.
jaysondasher f1a4a15
Merge remote-tracking branch 'upstream/main' into feature/clipboard-i…
jaysondasher 2611b07
style: remove trailing newlines from InputPrompt files
jaysondasher 1bfdb69
Merge branch 'main' into feature/clipboard-image-paste
jaysondasher 4e8b293
Merge branch 'main' into feature/clipboard-image-paste
jaysondasher ef302b9
Merge branch 'main' into feature/clipboard-image-paste
jaysondasher 7497533
Merge branch 'main' into feature/clipboard-image-paste
jacob314 2182c37
Merge branch 'main' into feature/clipboard-image-paste
jaysondasher fe899ec
Merge branch 'main' into feature/clipboard-image-paste
jacob314 ddcc0c3
Merge branch 'main' into feature/clipboard-image-paste
scottdensmore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 Google LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { describe, it, expect } from 'vitest'; | ||
| import { | ||
| clipboardHasImage, | ||
| saveClipboardImage, | ||
| cleanupOldClipboardImages, | ||
| } from './clipboardUtils.js'; | ||
|
|
||
| describe('clipboardUtils', () => { | ||
| describe('clipboardHasImage', () => { | ||
| it('should return false on non-macOS platforms', async () => { | ||
| if (process.platform !== 'darwin') { | ||
| const result = await clipboardHasImage(); | ||
| expect(result).toBe(false); | ||
| } else { | ||
| // Skip on macOS as it would require actual clipboard state | ||
| expect(true).toBe(true); | ||
| } | ||
| }); | ||
|
|
||
| it('should return boolean on macOS', async () => { | ||
| if (process.platform === 'darwin') { | ||
| const result = await clipboardHasImage(); | ||
| expect(typeof result).toBe('boolean'); | ||
| } else { | ||
| // Skip on non-macOS | ||
| expect(true).toBe(true); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('saveClipboardImage', () => { | ||
| it('should return null on non-macOS platforms', async () => { | ||
| if (process.platform !== 'darwin') { | ||
| const result = await saveClipboardImage(); | ||
| expect(result).toBe(null); | ||
| } else { | ||
| // Skip on macOS | ||
| expect(true).toBe(true); | ||
| } | ||
| }); | ||
|
|
||
| it('should handle errors gracefully', async () => { | ||
| // Test with invalid directory (should not throw) | ||
| const result = await saveClipboardImage( | ||
| '/invalid/path/that/does/not/exist', | ||
| ); | ||
|
|
||
| if (process.platform === 'darwin') { | ||
| // On macOS, might return null due to various errors | ||
| expect(result === null || typeof result === 'string').toBe(true); | ||
|
||
| } else { | ||
| // On other platforms, should always return null | ||
| expect(result).toBe(null); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('cleanupOldClipboardImages', () => { | ||
| it('should not throw errors', async () => { | ||
| // Should handle missing directories gracefully | ||
| await expect( | ||
| cleanupOldClipboardImages('/path/that/does/not/exist'), | ||
| ).resolves.not.toThrow(); | ||
| }); | ||
|
|
||
| it('should complete without errors on valid directory', async () => { | ||
| await expect(cleanupOldClipboardImages('.')).resolves.not.toThrow(); | ||
| }); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry to be clear, please add tests for this logic added to InputPrompt then LGTM.