-
Notifications
You must be signed in to change notification settings - Fork 25
fix: pasting files from local clipboard #1047
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
Conversation
This didn't work before because the event listener for the ctrl/cmd + V shortcut was preventing the default. Adds an option to configure this and disables it for this shortcut.
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.
Pull Request Overview
This PR fixes an issue where pasting files from the local system clipboard wasn't working due to the Ctrl/Cmd + V keyboard shortcut preventing the default browser behavior. The fix adds configurable preventDefault option to keyboard actions and disables it specifically for the paste shortcut when no internal clipboard resources are present.
- Adds optional
preventDefaultparameter to keyboard action binding system - Modifies paste keyboard action to only prevent default when internal clipboard has resources
- Improves safety checks in clipboard store methods
- Refactors paste event handling to use Vue's
useEventListenercomposable
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/web-pkg/src/composables/piniaStores/clipboard.ts |
Adds optional chaining to prevent errors when accessing empty resource arrays |
packages/web-pkg/src/composables/keyboardActions/useKeyboardActions.ts |
Adds configurable preventDefault option to keyboard action binding |
packages/web-app-files/src/composables/keyboardActions/useKeyboardFileSpaceActions.ts |
Modifies paste action to conditionally prevent default based on clipboard state |
packages/web-app-files/src/components/AppBar/CreateAndUpload.vue |
Refactors paste event listener to use Vue composable and removes manual cleanup |
| keys: { primary: Key; modifier?: Modifier }, | ||
| callback: () => void | ||
| callback: (event: KeyboardEvent) => void, | ||
| { preventDefault = true }: { preventDefault?: boolean } = {} |
Copilot
AI
Aug 4, 2025
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.
[nitpick] The destructuring parameter with default value should be extracted to a separate parameter for better readability and consistency with the function signature above.
AlexAndBear
left a comment
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.
🚀 nice
|
@JammingBen or @ScharfViktor is it possible to write an e2e test for this feature ? |
I'll try to create test for that. I hope something like it should work |
This didn't work before because the event listener for the ctrl/cmd + V shortcut was preventing the default. Adds an option to configure this and disables it for this shortcut.
fixes #1037