GetmeUK / ContentTools

A JS library for building WYSIWYG editors for HTML content.
http://getcontenttools.com
MIT License
3.95k stars 395 forks source link

GetImage() function (of the image upload tutorial) and image garbage collection #506

Closed cyclaero closed 6 years ago

cyclaero commented 6 years ago

I followed your tutorial on Handling image uploads for implementing the respective backend in my cyclaero/ContentCGI project. It does work already quite nice, only image garbage collection is still missing, and this one is next on my list.

The image dialog of the content tools inserts new images always at the top level inside the editors content regions. Sometimes, I need images within <p>...</p> or <li>...</li> tags, and in these cases, I moved the <img ...> manually to where I needed it. However, these moved images are not identified by the GetImage() function as lined out in said tutorial. This would break my scheme of automatic image garbage collection – compare informed images with stored ones, and delete those which are not in the informed list.

I am not a JS wizard, I know enough to get around basic problems, and in hours I was not able to let GetImage() find images which are not at the top level. Please, may I ask for a hint on how to do that? If I can't get GetImage() find all images at any level in an editor region, then I would need to think about another scheme for the image garbage collection.

Many thanks and best regards

Rolf

cyclaero commented 6 years ago

I implemented the image garbage collection completely on the server side in C. Hence for me this is no issue anymore, and therefore I close this one.

Best regards

Rolf