Skip to content
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

feat: Pasting & dropping files #852

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

dcadavez66
Copy link
Contributor

Added support to paste images from the clipboard into the editor

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Jun 24, 2024 7:11pm
blocknote-website ✅ Ready (Inspect) Visit Preview Jun 24, 2024 7:11pm

Copy link

vercel bot commented Jun 19, 2024

@dcadavez66 is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

@matthewlipski
Copy link
Collaborator

matthewlipski commented Jun 20, 2024

Awesome, thanks for this! I also extended your code to work with all file block types in the editor based on the pasted file's MIME type, and added the same functionality for dragging and dropping files:)

Besides refactoring, I made one fairly major change in that the files pasted/dropped are uploaded using editor.uploadFile instead of converting them to a URL using the helper function you created. This is just a bit more in line architecturally with how we want file blocks to work, but also means that a backend has to be provided for file pasting/dropping to work. That being said, it's a more robust solution overall and I expect that the vast majority of people using BlockNote will already have some kind of backend for this.

Closes #715
Closes #693

Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

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

nice! small comments

packages/core/src/api/parsers/handleFileInsertion.ts Outdated Show resolved Hide resolved
packages/core/src/api/parsers/handleFileInsertion.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants