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 27, 2023
1 parent 0da912e commit 77e4e19
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 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 @@ -99,9 +107,7 @@ export default defineComponent({
}
const options = {
title: fyo.t`Select Image`,
filters: [
{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] },
],
filters: [{ name: 'Image', extensions: Object.keys(mime_types) }],
};
const { name, success, data } = await ipc.selectFile(options);
Expand All @@ -110,7 +116,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 77e4e19

Please sign in to comment.