Skip to content

Commit

Permalink
feat: allow inclusion of SVG images
Browse files Browse the repository at this point in the history
  • Loading branch information
mildred committed Dec 22, 2023
1 parent e7ef99f commit 0a95417
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/Controls/AttachImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ import { defineComponent, PropType } from 'vue';
import FeatherIcon from '../FeatherIcon.vue';
import Base from './Base.vue';
const mime_types: Record<string,string> = {
'png': 'image/png',
'jpg': 'image/jpeg',
'jpeg': 'image/jpeg',
'webp': 'image/webp',
'svg': 'image/svg+xml'
}
export default defineComponent({
name: 'AttachImage',
components: { FeatherIcon },
Expand Down Expand Up @@ -100,7 +108,7 @@ export default defineComponent({
const options = {
title: fyo.t`Select Image`,
filters: [
{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] },
{ name: 'Image', extensions: Object.keys(mime_types) },
],
};
Expand All @@ -110,7 +118,7 @@ export default defineComponent({
return;
}
const extension = name.split('.').at(-1);
const type = 'image/' + extension;
const type = mime_types[extension];
const dataURL = await getDataURL(type, data);
// @ts-ignore
Expand Down

0 comments on commit 0a95417

Please sign in to comment.