-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Support uploading SVG images #674
Comments
Great idea. Thanks for reporting! On CKEditor 5 side:
But in order to make SVGs work with Easy Image we'll also need to add support for them in CKEditor Cloud Services. |
Is here any progress? |
No, we didn't look into this. But it seems to be a trivial change assuming that the backend that you're using will support SVGs. Easy Image doesn't support them AFAIK. CKFinder should work fine (may require some configuration). If you use your own backend then it's basically up to you. So, anyway, I think we could try to add SVGs to https://github.com/ckeditor/ckeditor5-image/blob/42ad41bea2e406233c17ce8a319fdd66b1ba495d/src/imageupload/utils.js#L18 and see what happens. It may be a quick win. |
It looks like adding this will work but it is a potential security risk if image backend does not properly filter SVG files. Also when thinking about any future or existing image format that might or might not be supported on the backend I think that the best way is to provide a configuration option for image upload for extending supported image types. ClassicEditor
.create( document.querySelector( '#editor' ), {
image: {
toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ],
upload: {
types: [ 'jpeg', 'png', 'gif', 'bmp', 'svg+xml' ]
}
}
} ); Underneath it will create the current RegExp: The default value will be: [ 'jpeg', 'png', 'gif', 'bmp', 'webp', 'tiff' ] I'm not sure is the ps.: Here is a full list of possible |
I think we can go this way if it will also affect this place: https://github.com/ckeditor/ckeditor5-image/blob/42ad41bea2e406233c17ce8a319fdd66b1ba495d/src/imageupload/imageuploadui.js#L38 Otherwise, this configuration is a bit redundant because the backend will need to do the same check and should throw if it doesn't want to support for example SVGs. So, the backend gives you the final confirmation (once it receives the file). The config option will affect the UI, so will give you immediate result (which files are available in the native file browser). |
Yeah... this should go there as well: ps.: I'm for the configuration option to make CKEditor not upload
|
Feature: Introduced `config.image.upload.types` configuration option for setting allowed image mime-types. Closes #295. Closes ckeditor/ckeditor5#674. BREAKING CHANGE: Removed `isImageType()` util.
π Is this a bug report or feature request? (choose one)
π» Version of CKEditor
v1.0.0-alpha.2
π Steps to reproduce
β Expected result
The uploaded image should be properly displayed.
β Actual result
Nothing happens, or only the textual file URL appears.
π Other details that might be useful
CKEditor 4 does not appear to support SVG files either. However, SVG's growing popularity may make it an attractive format to support.
The text was updated successfully, but these errors were encountered: