Feature Request: more secure way to get image URL and deleteFile callback #2515
Replies: 12 comments
-
|
I recently used the library and felt the same blocker. Requirement of |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. Both What's tricky with |
Beta Was this translation helpful? Give feedback.
-
|
Hey, any updates on |
Beta Was this translation helpful? Give feedback.
-
|
Not at the moment unfortunately:/ the updates to file blocks were done as part of a client request so most likely |
Beta Was this translation helpful? Give feedback.
-
|
I think the most direct approach to the undo problem is to provide a message to the user if a file is not successfully loaded indicating that the file is not available, and that the block should be removed and a new one added. A more sophisticated approach would be to provide a reload option, which would replace an existing file or supply a missing file. This would require a fileDelete trigger for any replaced file. How do you handle duplicate file names? |
Beta Was this translation helpful? Give feedback.
-
|
In the meantime, is there a way to extend the editor specs for useCreateBlockNote to include a |
Beta Was this translation helpful? Give feedback.
-
|
Here's what I'm doing in the meantime (using firebase): When uploading a file, I record the filename in an array, saved to the same firestore document as the editor content Deletions in edit mode before save make no change to the file list, or the storage files (which takes care of the Ctrl-Z problem). On save, I do this (function tucked away in a class) On cancel I do something similar, but with the cancelled uploadedFiles list compared to the previous media editor blocks Here is the common Still needs a recovery routine in case an internet break scrambles things, but I think this will do. |
Beta Was this translation helpful? Give feedback.
-
|
Getting the editor media file names is of course trivial |
Beta Was this translation helpful? Give feedback.
-
|
There's a wrinkle to this. It turns out that an image can be saved to the editor using I plan to search for these on editor save and save the image to a separate file, naming it by microsecond time. |
Beta Was this translation helpful? Give feedback.
-
|
FWIW here is the code for saving data urls to files. The idea is to save database space (firestore "documents" have a hard limit of ~1MB) Comments are welcome. So before doing other save processing, I check for data urls with and here's the function... |
Beta Was this translation helpful? Give feedback.
-
|
Hey @YousefED , is there any update on this? Ideally we should still expose something like onDeleteBlock or similar. +1 to the getFile method for signed urls. How are you currently dealing with the signed url issue? The only workarounds that I can currently think of are to use a proxy service that returns the signed url or to add a custom image block that handles this. |
Beta Was this translation helpful? Give feedback.
-
|
Hi everyone. I too would love a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I love the image block feature and the
uploadFilemethod in the editor that allows you to define a custom function for uploading images to your server. To improve on this, I wish there would be an equivalentdeleteFilecallback invoked when the image block is deleted so we can delete the image from our database to save resources. I also think that defining the image as just a public URL is not the most secure, and we could also define agetFilemethod that will allow developers to define a custom function to retrieve a signed URL that expires after a certain duration.Beta Was this translation helpful? Give feedback.
All reactions