Fix/#847 MacOS drag and drop shapes#848
Open
Ivanruii wants to merge 5 commits into
Open
Conversation
296fd64 to
113cd57
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a macOS-specific drag-and-drop bridge for the VS Code extension webview to work around iframe drag event routing issues described in #847.
Changes:
- Adds bridge protocol messages for drag lifecycle and reconstructed gallery drops.
- Adds shell-side drag interception/preview handling and iframe-side drop reconstruction.
- Updates gallery drag behavior, platform detection, CSP, and VS Code bridge filtering for drag messages.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/vscode-extension/src/webview/main.ts |
Registers the drag bridge in the webview shell. |
packages/vscode-extension/src/webview/drag-bridge.ts |
Adds shell-side drag/drop interception and preview forwarding. |
packages/vscode-extension/src/webview/bridge.ts |
Prevents drag bridge messages from being forwarded to the extension host. |
packages/vscode-extension/src/editor/panel.ts |
Allows data URL images for the shell drag preview CSP. |
packages/bridge-protocol/src/model.ts |
Defines drag bridge message payload types. |
packages/bridge-protocol/src/constant.ts |
Adds drag bridge message constants. |
apps/web/src/pods/canvas/canvas.pod.tsx |
Hooks the canvas into the macOS webview drag bridge. |
apps/web/src/core/vscode/use-mac-webview-drag-bridge.hook.ts |
Reconstructs gallery drops inside the iframe. |
apps/web/src/core/vscode/mac-webview-drag-bridge.utils.ts |
Adds bridge utility functions and thumbnail data URL loading. |
apps/web/src/common/utils/vscode-bridge.utils.ts |
Exports the resolved parent origin for bridge messaging. |
apps/web/src/common/helpers/platform.helpers.ts |
Updates macOS detection to prefer userAgentData.platform. |
apps/web/src/common/components/gallery/components/item-component.tsx |
Sends drag lifecycle messages and suppresses native preview on macOS VS Code. |
.changeset/tired-mammals-cough.md |
Adds a patch changeset describing the fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+72
to
+76
| const screenPosition = { x: clientX, y: clientY }; | ||
| const relativeDivPosition = portScreenPositionToDivCoordinates( | ||
| dropDivElement, | ||
| screenPosition | ||
| ); |
Comment on lines
+49
to
+50
| const dataUrl = thumbnailDataUrlRef.current ?? item.thumbnailSrc; | ||
| notifyDragStartToWebviewShell(item.type as ShapeType, dataUrl); |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #847