Delete images from storage when deleted in editor
Opened this issue · 2 comments
Schrolli91 commented
How can I auto delete images from the storage disk,
if I delete the image in the text editor?
Is there any config or something to achieve this?
robinmalburn commented
I needed a solution to this as well, but unfortunately, it's not something TinyMCE provides natively itself. What I ended up settling on was namespcing the editor images so they were isolated and easily managed, then adding a model observer and watching for changes to the content. When the content was changed or deleted, extract all img
tags and spin through them to see if any stored images needed cleaning up.
Schrolli91 commented
Can you provide your observer class code or a example for this?
I think your solution is a good choice for this problem here.