0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00

Remove loader when downloading the file (#144)

This commit is contained in:
Jordi Sala Morales 2024-06-06 15:16:20 +02:00 committed by GitHub
parent 02fa3363f5
commit 78688988d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4595 additions and 4518 deletions

View file

@ -79,8 +79,13 @@ export const useFigma = (): UseFigmaHook => {
setDownloading(true);
const file = await parse(pluginMessage.data);
const blob = await file.export();
download(blob, `${pluginMessage.data.name}.zip`);
setExporting(false);
setDownloading(false);
file.export();
break;
}
case 'CUSTOM_FONTS': {
@ -109,6 +114,16 @@ export const useFigma = (): UseFigmaHook => {
}
};
const download = (blob: Blob, name: string) => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = name;
a.click();
};
const reload = () => {
setLoading(true);
postMessage('reload');

File diff suppressed because one or more lines are too long

View file

@ -36,5 +36,5 @@ export interface PenpotFile {
getCurrentPageId(): Uuid;
newId(): Uuid;
// asMap(): unknown;
export(): void;
export(): Promise<Blob>;
}