TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.
https://www.blocknotejs.org/
Mozilla Public License 2.0
5.89k stars 381 forks source link

I hope I can have different state for advance Block like Image/File #869

Open wenerme opened 6 days ago

wenerme commented 6 days ago

Is your feature request related to a problem? Please describe.

When pasting or uploading a file, I hope I can return the dataurl/URL.createObjectUrl to user after they paste, then uploading to server in the background, after uploaded I can give the real url to image/file.

This may introduce the pending state to editor, e.g. notify user there are background running process, they should not just submit the form & exit.

Describe the solution you'd like

Maybe expose current ImageBlock to extension, I don't want to build this from ground, but this require the builtin blocks has the extendibility.

Describe alternatives you've considered

Replace the block ?

Additional context

Bonus [ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

matthewlipski commented 5 days ago

I think this is already partially documented with the resolveFileUrl editor option, which lets you use the string that you have stored on the file block's url prop as an identifier to fetch the file URL async from a backend on render. However, the documentation for this is missing atm so we definitely need to fix that.

wenerme commented 3 days ago

resolveFileUrl solve the paste url problem, but seems unable to solve the pending load problem. e.g. the upload need seconds, the image block is unable to notify the user they already pasted the image.

matthewlipski commented 4 hours ago

I see, that makes sense - I suppose this is more of a UX issue in that case since the work is mostly just in showing a loader or placeholder when the image is being uploaded on paste.