Description
Is your feature request related to a problem? Please describe.
I'm building a CMS with blocknote. I have a custom image block on which i want to save the width and the height of the uploaded file in the props
In order to do so i wrote a custom uploadFile
function that i pass to the editor.
my uploadFile function does 2 things:
- save the image to my cdn
- get the height/width of the image and save it to my block props
The upload function that i submitted takes 2 argument a file and the blockId as described by the typescript type but if i log the blockId that my function receives it is undefined
.
Describe the solution you'd like
The issue comes from the UploadTab.tsx l.53 where the block.id is not passed to the editor.uploadFile function
I would like to change
let updateData = await editor.uploadFile(file);
to the following
let updateData = await editor.uploadFile(file, block.id);
I tested it and it solved my problem.
More generally speaking, I also think it is kind of the expected behaviour to also pass the id of the block for which the file panel is opened so the function can have access to it and can modify it if needed
Thanks for all your nice work !
PS: I tried to open a PR but i don't have the right to create branches so i couldn't