Skip to content

feat(vscode): add drag and drop support for image uploads - #64

Merged
wsxiaoys merged 23 commits into
mainfrom
Feat-Add-drag-and-drop-support
Aug 26, 2025
Merged

feat(vscode): add drag and drop support for image uploads#64
wsxiaoys merged 23 commits into
mainfrom
Feat-Add-drag-and-drop-support

Conversation

@ZHallen122

@ZHallen122 ZHallen122 commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Integrating @tiptap/extension-file-handler to manage file drop and paste events within the chat's text editor.
  • Implementing a visual overlay that appears when users drag files over the input area, providing clear feedback that it is a drop target.
  • Reusing the existing useImageUpload hook's validation and file handling logic to process the dropped images, ensuring consistency with the existing file upload functionality.

Test plan

  • Verify Drag-and-Drop Functionality
  • UI/UX Feedback
  • Verify Paste Functionality
  • Regression Testing: Use the existing "attach file" button to select an image.

🤖 Generated with Pochi

Implement validateAndAddFiles method in useImageUpload hook and integrate it with ChatToolbar component to handle drag and drop image uploads
- Add onImageUpload prop to ChatInputForm and FormEditor components
- Implement file handling with FileHandler extension for TipTap editor
- Add drag and drop UI with visual feedback for file uploads
- Support image file filtering and upload callback handling
Remove window-level drag handlers and consolidate drag state management
Use Tiptap's built-in DOM event handlers for better integration
Simplify drag overlay UI to only show when dragging over editor
…ogic

- Remove console logs from file drop/paste handlers
- Consolidate file handling into single callback
- Clean up drag event handlers
…dlers

- Standardize quote usage and arrow function parentheses
- Reformat long lines for better readability
- Update drag overlay styling classes to match tailwind conventions
Add new dependency to support file handling functionality in the editor
@ZHallen122
ZHallen122 requested a review from wsxiaoys August 25, 2025 02:51
@ZHallen122 ZHallen122 added the good first issue Good for newcomers label Aug 25, 2025
@ZHallen122
ZHallen122 marked this pull request as draft August 25, 2025 02:51
@wsxiaoys
wsxiaoys requested review from liangfung and removed request for wsxiaoys August 25, 2025 02:53
@wsxiaoys
wsxiaoys marked this pull request as ready for review August 25, 2025 02:55
…ge upload logic

Directly call onImageUpload instead of using intermediate handler to simplify code
@ZHallen122
ZHallen122 requested review from wsxiaoys and removed request for liangfung August 25, 2025 03:02
@ZHallen122
ZHallen122 marked this pull request as draft August 25, 2025 03:03
@wsxiaoys
wsxiaoys requested review from liangfung and removed request for wsxiaoys August 25, 2025 03:12
@ZHallen122
ZHallen122 marked this pull request as ready for review August 25, 2025 03:17

@liangfung liangfung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG, two points to note

  1. It may be beneficial to apply the previous limits on the number for images and checks for image size
  2. Adding a tooltip to the 'upload image' button could help users learn that the can hold shift to drop in images
    cc @wsxiaoys

Add console logs to track Enter key submission and file drop events
…irectly

Simplify image upload handling by removing the FileHandler extension and implementing drop handling directly in the editor props. This provides more control over the file upload process and removes unnecessary dependencies.
Clean up unused code related to drag and drop image upload validation that was no longer needed
Implement handleImageUpload callback to process dropped files and log upload events
Comment thread packages/vscode-webui/src/lib/hooks/use-image-upload.ts Outdated
Comment thread packages/vscode-webui/src/components/prompt-form/form-editor.tsx Outdated
… button

Add hover card component to provide users with upload instructions when hovering over the image button. The card explains click, drag-and-drop, and paste functionality for image uploads.
ZHallen122 and others added 8 commits August 25, 2025 21:33
The prop name was changed to better reflect its actual functionality of handling dropped images rather than general uploads. This change improves code clarity and maintains consistent naming across components.
Move drag and drop image upload logic from chat toolbar to use-image-upload hook for better reusability
@wsxiaoys
wsxiaoys enabled auto-merge August 26, 2025 02:30
@wsxiaoys
wsxiaoys added this pull request to the merge queue Aug 26, 2025
Merged via the queue into main with commit 5083802 Aug 26, 2025
3 checks passed
@wsxiaoys
wsxiaoys deleted the Feat-Add-drag-and-drop-support branch August 26, 2025 02:31
@wsxiaoys

Copy link
Copy Markdown
Member

fix #51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants