Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoveBlobs command #22

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

ticruz38
Copy link
Contributor

Add a command that will clean up all blobs from the editor content.

It could also be used automatically once a file upload failed, or leave that command up to the user.

@cesardeazevedo
Copy link
Owner

Thanks, wouldn't a editor.commands.clearContent(true) just be enough to cleanup the whole thing?

@ticruz38
Copy link
Contributor Author

Thanks, wouldn't a editor.commands.clearContent(true) just be enough to cleanup the whole thing?

Yes I can rename it to clearContent, but the idea is really to remove blobs from the editor for failed or incomplete uploads, which is not the case at the moment.
Not to clean up the whole content. Cleaning up the whole content for a failed upload would be annoying.

@cesardeazevedo
Copy link
Owner

I actually meant the existing tiptap command clearContent, just curious from a UX perspective to delete failed uploads, usually the user would try to submit again or delete individual ones, but I understand, I would rename it to removeFiles so it matches the other commands in the extension

@staab
Copy link
Collaborator

staab commented Jan 31, 2025

usually the user would try to submit again or delete individual ones, but I understand, I would rename it to removeFiles so it matches the other commands in the extension

Remove files would imply all files, including successful uploads. The idea here is to remove only failed uploads. But maybe a removeFile would be better, so that we're better targeting which specific upload failed, since the current approach could result in removing pending rather than failed uploads if there are multiple concurrent uploads.

Copy link
Owner

@cesardeazevedo cesardeazevedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree now and makes sense

@ticruz38
Copy link
Contributor Author

There is a case, at least in coracle, where we do need to remove all pending uploads, ie when closing a reply and saving a draft.
But for failure handling yes, it might be nice to remove files based on their url or other attributes

@staab
Copy link
Collaborator

staab commented Jan 31, 2025

Maybe removeFile and removePendingFiles then

@cesardeazevedo
Copy link
Owner

I think removeBlobs are fine

@cesardeazevedo cesardeazevedo merged commit 7fc279e into cesardeazevedo:main Feb 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants