feat(editor): add experimental onDropOnCanvas option#7911
Merged
steveruizok merged 6 commits intomainfrom Feb 13, 2026
Merged
Conversation
Add an experimental__onDropOnCanvas callback to TldrawOptions that lets consumers intercept drag-and-drop events on the canvas. The callback receives the page-space drop point and the original drag event, and can return true to prevent the default file/URL drop handling. This also refactors the onDrop handler to compute the page point once and reuse it for both file and URL drops.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
2 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 14, 2026
In order to keep the release notes current for the upcoming SDK release, this PR updates `apps/docs/content/releases/next.mdx` with documentation for recently merged changes. ### Changes - Add "What's new" section for the experimental `onDropOnCanvas` canvas drop handler (#7911) - Add API change entry for `TldrawOptions.experimental__onDropOnCanvas` - Update release intro paragraph to mention the new drop handler - Add bug fix entry for CJS compatibility regression from ESM-only rbush (#7905) - Add bug fix entry for zero pen pressure on tablets affecting draw shapes (#5693) ### Change type - [x] `docs` ### Test plan - [ ] Verify the release notes render correctly on the docs site ### Release notes - Update next release notes with experimental canvas drop handler, CJS fix, and tablet pressure fix
huppy-bot bot
pushed a commit
that referenced
this pull request
Feb 14, 2026
In order to keep the release notes current for the upcoming SDK release, this PR updates `apps/docs/content/releases/next.mdx` with documentation for recently merged changes. ### Changes - Add "What's new" section for the experimental `onDropOnCanvas` canvas drop handler (#7911) - Add API change entry for `TldrawOptions.experimental__onDropOnCanvas` - Update release intro paragraph to mention the new drop handler - Add bug fix entry for CJS compatibility regression from ESM-only rbush (#7905) - Add bug fix entry for zero pen pressure on tablets affecting draw shapes (#5693) ### Change type - [x] `docs` ### Test plan - [ ] Verify the release notes render correctly on the docs site ### Release notes - Update next release notes with experimental canvas drop handler, CJS fix, and tablet pressure fix
Closed
1 task
1 task
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 18, 2026
In order to publish the v4.5.0 release notes and record the v4.4.1 patch, this PR archives release notes and resets `next.mdx` for the next cycle. **v4.5.0.mdx** (new file): - Archived from `next.mdx` with full frontmatter, keywords, and GitHub release link - Featured sections: click-through on transparent image pixels (#7942), breaking `EmbedShapeUtil.configure()` change (#8034) - API changes: `Editor.getResizeScaleFactor()` (#8042), `TLImageAsset.pixelRatio` (#8163), `sanitizeSvg` (#7896), `experimental__onDropOnCanvas` (#7911), enum-to-const refactoring (#8084) - 6 improvements and 20 bug fixes from production **v4.4.0.mdx:** - Add v4.4.1 patch release section with tooltip positioning fix (#8171) - Add v4.4.1 to keywords **next.mdx:** - Reset with `last_version: v4.5.0` and empty content ### Change type - [x] `other` ### Code changes | Section | LOC change | | ------------- | ------------- | | Documentation | +128 / -107 |
huppy-bot bot
pushed a commit
that referenced
this pull request
Mar 18, 2026
In order to publish the v4.5.0 release notes and record the v4.4.1 patch, this PR archives release notes and resets `next.mdx` for the next cycle. **v4.5.0.mdx** (new file): - Archived from `next.mdx` with full frontmatter, keywords, and GitHub release link - Featured sections: click-through on transparent image pixels (#7942), breaking `EmbedShapeUtil.configure()` change (#8034) - API changes: `Editor.getResizeScaleFactor()` (#8042), `TLImageAsset.pixelRatio` (#8163), `sanitizeSvg` (#7896), `experimental__onDropOnCanvas` (#7911), enum-to-const refactoring (#8084) - 6 improvements and 20 bug fixes from production **v4.4.0.mdx:** - Add v4.4.1 patch release section with tooltip positioning fix (#8171) - Add v4.4.1 to keywords **next.mdx:** - Reset with `last_version: v4.5.0` and empty content ### Change type - [x] `other` ### Code changes | Section | LOC change | | ------------- | ------------- | | Documentation | +128 / -107 |
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.
In order to let consumers intercept and customize drag-and-drop behavior on the canvas, this PR adds an
experimental__onDropOnCanvascallback toTldrawOptions.The callback receives the page-space drop coordinates and the original drag event. Returning
trueprevents the default file/URL drop handling, giving consumers full control over what happens when content is dropped on the canvas.This also refactors the
onDrophandler to compute the page point once and reuse it for both file and URL drops.Change type
featureTest plan
experimental__onDropOnCanvasset to a function that returnstrueRelease notes
experimental__onDropOnCanvasoption to intercept canvas drop eventsAPI changes
TldrawOptions.experimental__onDropOnCanvascallback for intercepting canvas drop eventsNote
Medium Risk
Touches core drag-and-drop event handling on the canvas; while gated behind an optional callback, it can change how external content drops are processed if misused.
Overview
Adds an experimental
TldrawOptions.experimental__onDropOnCanvascallback that receives the page-space drop point and the originalDragEvent, and can returntrueto stop the editor’s default drop behavior.Updates the canvas
onDrophandler to compute the drop point once, invoke the callback if present, and otherwise continue with existing file/URLputExternalContenthandling. Public API reports anddefaultTldrawOptionsare updated to expose the new option.Written by Cursor Bugbot for commit e16014e. This will update automatically on new commits. Configure here.