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

Feature: Cleanup Removed Images #563

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from

Conversation

tanthammar
Copy link
Contributor

@tanthammar tanthammar commented Jan 30, 2025

##Feature: Optionally Cleanup Removed Images

This PR introduces automatic cleanup of images that are removed from the Tiptap editor content. When an image is deleted from the editor, the corresponding file is also removed from the storage disk. This ensures that unused images do not accumulate, saving disk space and maintaining a clean storage environment.

  • This option is off by default ( non-breaking)
  • It can be enabled by: TiptapEditor::make('foo')->cleanUpDeletedImages()

@awcodes
Copy link
Owner

awcodes commented Jan 30, 2025

Should this be on dehydration instead? I'm worried that doing it on stateUpdate will break if the user accidentally deletes the image and then restores it with the undo.

@tanthammar
Copy link
Contributor Author

Good point. Can't see any reason against moving it to dehydration. I guess we have old/new data there also?

@awcodes
Copy link
Owner

awcodes commented Feb 24, 2025

Haven't forgotten about this, I'm just still not sure it's a plug-in responsibility. Just seems more like an app responsibility.

@tanthammar
Copy link
Contributor Author

It might be best, yes.

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.

2 participants