backdrop-contrib / tinymce

Integration for the TinyMCE editor in Backdrop CMS
https://backdropcms.org/project/tinymce
GNU General Public License v2.0
2 stars 1 forks source link

Add support for SVG upload via drag-and-drop #94

Closed indigoxela closed 2 months ago

indigoxela commented 2 months ago

The first time this topic has been considered was in #32, but then postponed.

However, with latest movement in core issues, SVG becomes a topic again. Eventually for Backdrop release 1.28, we'll see.

Tiny handles svg as image pretty well, inline svg (as markup) aren't relevant here. But there's some issue with drag-and-drop upload (current validator won't pass) and a similar problem with the images_file_types option passed to Tiny via js settings. (Not sure if it's a good idea to add svg to images_file_types - for all installs, but based on an admin setting for file upload (globally) it seems... OK.)

indigoxela commented 2 months ago

Yay, change is in core! :tada:

If image_get_info() worked with svg, there wouldn't be anything to do here. It doesn't. It's probably better to replace file_validate_is_image with file_validate_extensions. But wait, solely relying on file extension seems like a bad idea.

indigoxela commented 2 months ago

After some forward and back I decided to create a custom replacement for the file_validate_is_image check, so I don't have to wait for core.