flutter-quill icon indicating copy to clipboard operation
flutter-quill copied to clipboard

onImageRemovedCallback not called when Image is Removed with a keystroke(backspace)

Open Uche01 opened this issue 6 months ago • 3 comments

Is there an existing issue for this?

The question

I am trying to delete an image from file system when an image is removed from the editor. Overriding the callback onImageRemovedCallback appears to work only when image is removed by clicking on the 'Remove' option on the image actions popup. However, when image is removed by clicking backspace key on the keyboard, the callback is not fired. How can I fix this?

Here is the call back code:

QuillEditorImageEmbedConfigurations imageEmbedConfigurations = QuillEditorImageEmbedConfigurations(  
    onImageRemovedCallback: (imageUrl) async {
      final file = File(imageUrl);
      if (await file.exists()) {
        await file.delete();
        print('File deleted successfully');
      } else {
        print('File does not exist');
      }
    },
  );

Uche01 avatar Aug 15 '24 13:08 Uche01