Pass file extensions with leading dot after API change (#2149)

This commit is contained in:
Thomas Steiner 2020-09-10 12:00:18 +02:00 committed by GitHub
parent aaddde5dd9
commit 48c2a13c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

6
package-lock.json generated
View File

@ -3541,9 +3541,9 @@
"integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
}, },
"browser-nativefs": { "browser-nativefs": {
"version": "0.10.2", "version": "0.10.3",
"resolved": "https://registry.npmjs.org/browser-nativefs/-/browser-nativefs-0.10.2.tgz", "resolved": "https://registry.npmjs.org/browser-nativefs/-/browser-nativefs-0.10.3.tgz",
"integrity": "sha512-8aLLk6uFAp5QJ2KFwM2Ty1dT361Dt9QOCnOmLascVspwj81A6wj5NmVG3w6gUnvmO4BnWrwdV2U3Q7GUMdFjNA==" "integrity": "sha512-WGcoR1aR+bxLlilaJ9fIzVOgSC4MaV+6phCTDGXV1sm+RElFuQFnJXR4BebBf2wEnjCsmGmTDNDTBE5KvVm2UQ=="
}, },
"browser-process-hrtime": { "browser-process-hrtime": {
"version": "1.0.0", "version": "1.0.0",

View File

@ -28,7 +28,7 @@
"@types/react": "16.9.49", "@types/react": "16.9.49",
"@types/react-dom": "16.9.8", "@types/react-dom": "16.9.8",
"@types/socket.io-client": "1.4.33", "@types/socket.io-client": "1.4.33",
"browser-nativefs": "0.10.2", "browser-nativefs": "0.10.3",
"i18next-browser-languagedetector": "6.0.1", "i18next-browser-languagedetector": "6.0.1",
"lodash.throttle": "4.1.1", "lodash.throttle": "4.1.1",
"nanoid": "2.1.11", "nanoid": "2.1.11",

View File

@ -313,7 +313,7 @@ export const exportCanvas = async (
if (type === "svg") { if (type === "svg") {
await fileSave(new Blob([tempSvg.outerHTML], { type: "image/svg+xml" }), { await fileSave(new Blob([tempSvg.outerHTML], { type: "image/svg+xml" }), {
fileName: `${name}.svg`, fileName: `${name}.svg`,
extensions: ["svg"], extensions: [".svg"],
}); });
return; return;
} else if (type === "clipboard-svg") { } else if (type === "clipboard-svg") {
@ -338,7 +338,7 @@ export const exportCanvas = async (
if (blob) { if (blob) {
await fileSave(blob, { await fileSave(blob, {
fileName: fileName, fileName: fileName,
extensions: ["png"], extensions: [".png"],
}); });
} }
}); });

View File

@ -38,7 +38,7 @@ export const saveAsJSON = async (
{ {
fileName: name, fileName: name,
description: "Excalidraw file", description: "Excalidraw file",
extensions: ["excalidraw"], extensions: [".excalidraw"],
}, },
fileHandle || null, fileHandle || null,
); );
@ -47,7 +47,7 @@ export const saveAsJSON = async (
export const loadFromJSON = async (appState: AppState) => { export const loadFromJSON = async (appState: AppState) => {
const blob = await fileOpen({ const blob = await fileOpen({
description: "Excalidraw files", description: "Excalidraw files",
extensions: ["json", "excalidraw"], extensions: [".json", ".excalidraw"],
mimeTypes: ["application/json"], mimeTypes: ["application/json"],
}); });
return loadFromBlob(blob, appState); return loadFromBlob(blob, appState);
@ -71,14 +71,14 @@ export const saveLibraryAsJSON = async () => {
await fileSave(blob, { await fileSave(blob, {
fileName, fileName,
description: "Excalidraw library file", description: "Excalidraw library file",
extensions: ["excalidrawlib"], extensions: [".excalidrawlib"],
}); });
}; };
export const importLibraryFromJSON = async () => { export const importLibraryFromJSON = async () => {
const blob = await fileOpen({ const blob = await fileOpen({
description: "Excalidraw library files", description: "Excalidraw library files",
extensions: ["json", "excalidrawlib"], extensions: [".json", ".excalidrawlib"],
mimeTypes: ["application/json"], mimeTypes: ["application/json"],
}); });
Library.importLibrary(blob); Library.importLibrary(blob);