Skip to content

Conversation

@aadarshkt
Copy link
Contributor

@aadarshkt aadarshkt commented Oct 19, 2025

Description

Removed console log and changed launch configuration

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Fixes image drag-and-drop in the main editor. Drops now work for files and for images dragged from VS Code (vscode-resource URLs), which are read and inserted as data URLs.

  • Bug Fixes

    • Handle drops in a ProseMirror plugin and insert images when the selected model supports images.
    • Resolve images dragged from VS Code (file+.vscode-resource URLs) by reading the file and converting to a data URL.
    • Make the drag overlay non-blocking and hide it reliably on drop/leave.
  • Refactors

    • Added readFileAsDataUrl protocol and VS Code handler (PNG/JPEG) to return data URLs.
    • Added helpers to parse vscode-resource URLs and extract them from dropped HTML.
    • Simplified DragOverlay component and set pointer-events: none.
    • Added a gui:build VS Code task and increased Node memory to avoid OOM during builds.

@aadarshkt aadarshkt requested a review from a team as a code owner October 19, 2025 11:43
@aadarshkt aadarshkt requested review from sestinj and removed request for a team October 19, 2025 11:43
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 19, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts">

<violation number="1" location="gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts:166">
Preventing default before checking the payload swallows non-image drops; plain-text drag-and-drop now does nothing. Only block the event when you actually handle it, or fall back to the default insertion flow.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

model.capabilities,
)
) {
event.preventDefault();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 19, 2025

Choose a reason for hiding this comment

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

Preventing default before checking the payload swallows non-image drops; plain-text drag-and-drop now does nothing. Only block the event when you actually handle it, or fall back to the default insertion flow.

Prompt for AI agents
Address the following comment on gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts at line 166:

<comment>Preventing default before checking the payload swallows non-image drops; plain-text drag-and-drop now does nothing. Only block the event when you actually handle it, or fall back to the default insertion flow.</comment>

<file context>
@@ -147,6 +148,80 @@ export function createEditorConfig(options: {
+                      model.capabilities,
+                    )
+                  ) {
+                    event.preventDefault();
+                    event.stopPropagation();
+                    return true;
</file context>
Fix with Cubic

@RomneyDa
Copy link
Collaborator

RomneyDa commented Nov 5, 2025

@aadarshkt note failing prettier checks!

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

@aadarshkt appreciate the rework, added some comments and could you check on the cubic feedback?

}
]
},
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can leave this build script out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure will make this changes this weekend.

const fileUri = vscode.Uri.file(filepath);
const fileContents = await vscode.workspace.fs.readFile(fileUri);
const fileType =
filepath.split(".").pop() === "png" ? "image/png" : "image/jpeg";
Copy link
Collaborator

Choose a reason for hiding this comment

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

JPEG fallback will cause various types to fail, could we add a few more common fileTypes here?

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants