flutter-quill
flutter-quill copied to clipboard
Deleting added images or videos leads to "storage leaks"
Deleting an image in the editor only removes the URL, there is no way to delete the corresponding file. Think about adding and deleting a 10M size image 100 times in the editor. If the image is just left there, it will take up 1G storage space, “storage leak? ”
Please submit a PR to fix it.
I think adding a remove callback function should solve the problem, but I don't know where to add it. There are a lot of flutter-quill files and they often import each other, which seems a bit messy (sorry to say that), and I know very little about flutter-quill at the moment, so I can't submit a PR.
You are using keyboard to delete the image/video?
If you are using the button, it is easy to add callback
If you are talking about using keyboard, it is more complicated since we need to update keyboard listener
check out lib/src/widgets/keyboard_listener.dart
Actually no need for all these. You can just track the changes and figure out if the user deletes video/image
Yes, I am using the keyboard to delete. Thank you very much for your reply, your reply was very helpful to me. I'll look into it.
Also it would be perfect if it provided onImagePickCallback like QuillToolbar.basic provides onImagePickCallback? onImageRemoveCallback would be perfect and the video would be similar.
I'm sure others will encounter this problem as well. I found a previous discussion:#600
I think we need more generalized system here. What about add some callback to the Embeddable itself?
I think we need more generalized system here. What about add some callback to the Embeddable itself?
I do agree with you. I think all embedded content that is not directly included in the document needs a remove callback function, just like the dispos() function to clean up unused resources. This is a very essential feature.
Yes, true. But you also want to listen to DELETE key, right?
Yes, true. But you also want to listen to DELETE key, right?
Yes, the DELETE key, unlike other character keys, represents the delete function for all objects in a document, whether they are characters or pictures, videos, etc.
There may be a better way or a central way to deal with this.
Add a new delete rule to subscribe any event you are interested.

This can intercept all delete operation happened
This can intercept all delete operation happened
Yes, this is the best way 👍
The name can be something like: EmbedDeletionCallbackRule. Of course we need to determine if it is embed being deleted.
Depending on how embed is considered, I think all objects displayed in the editor can be considered embed units, just that their characteristics are different.
Characters, images, videos, and so on, are all embeded units inside the editor, so that all the content inside the editor is conceptually unified.
String is the connection of characters, characters belong to connectable objects, images, and videos can not be connected, perhaps Emoji, like characters, belong to connectable units.
If so it can be named DeletionCallbackRule , in which all deletions are handled.
Of course, if you treat characters as general objects, pictures, videos, files, etc. as embedded objects, EmbedDeletionCallbackRule is more appropriate.
In order to clarify Embed, I recorded a video and please check it out https://youtu.be/pI5p5j7cfHc
This should help you.
OK
@abcxcba are you working on a change for this or do you need help?
@abcxcba are you working on a change for this or do you need help?
I recently needed to stop and work on other issues and wasn't sure how soon I could keep coming back to this.
We have added a callback for onRemove in flutter_quill_extensions
This issue has been fixed, if you still facing this issue or any others, feel free to contact us on GitHub