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

File drag-and-drop upload #715

Open
justicecurcian opened this issue Apr 29, 2024 · 2 comments
Open

File drag-and-drop upload #715

justicecurcian opened this issue Apr 29, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@justicecurcian
Copy link

justicecurcian commented Apr 29, 2024

Is your feature request related to a problem? Please describe.
I want to build an extension to drop files in the editor (images/videos/pdf), upload them to my server and create a block where the file was dropped. There is no way of doing this on the blocknote level as i can see, tiptap extension with this functionality is behind a paywall, and doing this in prosemirror is kinda tricky: you need to replace dropcursor with the new block, and so you need a specific dropcursor for files because dropcursor works inside blocks too.

Describe the solution you'd like
It would be perfect is there was a file drop plugin in blocknote that would handle the file drop itself and the editor would accept a function like

{ // BlockNoteEditorOptions
    fileDropHandler: (file: File) => {
        // User creates the node he needs, or a notification that
        // the editor can't handle a file of that type, handles upload, etc.
    }
}

Describe alternatives you've considered
enableBlockNoteExtensions is kinda useless right now and to make it useful it needs to disable specific extensions. If I can disable dropcursor extension without disabling all other extensions, I will be able to create my own tiptap extension that will handle dropcursor and file upload.

@justicecurcian justicecurcian added the enhancement New feature or request label Apr 29, 2024
@justicecurcian
Copy link
Author

justicecurcian commented Apr 29, 2024

I just remembered that blocks have dropcursor only between blocks, but from what i can see block drag-and-drop is tied to sidemenu drag and drop, so i don't see how can i create a workaround.

@YousefED
Copy link
Collaborator

YousefED commented May 1, 2024

Hi! Would welcome a PR that makes enableBlockNoteExtensions more useful for your scenario. Meanwhile, we'll also be working on better file uploads so that might also address your requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants