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:
parent
02fa3363f5
commit
78688988d6
3 changed files with 4595 additions and 4518 deletions
|
@ -79,8 +79,13 @@ export const useFigma = (): UseFigmaHook => {
|
||||||
setDownloading(true);
|
setDownloading(true);
|
||||||
|
|
||||||
const file = await parse(pluginMessage.data);
|
const file = await parse(pluginMessage.data);
|
||||||
|
const blob = await file.export();
|
||||||
|
|
||||||
|
download(blob, `${pluginMessage.data.name}.zip`);
|
||||||
|
|
||||||
|
setExporting(false);
|
||||||
|
setDownloading(false);
|
||||||
|
|
||||||
file.export();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'CUSTOM_FONTS': {
|
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 = () => {
|
const reload = () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
postMessage('reload');
|
postMessage('reload');
|
||||||
|
|
9094
ui-src/lib/penpot.js
9094
ui-src/lib/penpot.js
File diff suppressed because one or more lines are too long
|
@ -36,5 +36,5 @@ export interface PenpotFile {
|
||||||
getCurrentPageId(): Uuid;
|
getCurrentPageId(): Uuid;
|
||||||
newId(): Uuid;
|
newId(): Uuid;
|
||||||
// asMap(): unknown;
|
// asMap(): unknown;
|
||||||
export(): void;
|
export(): Promise<Blob>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue