Browse Source

Use polyfill for the showSaveFilePicker

pull/11085/head
Max Katz 3 years ago
parent
commit
e16cce5545
  1. 5
      src/Browser/Avalonia.Browser/webapp/modules/storage/storageProvider.ts

5
src/Browser/Avalonia.Browser/webapp/modules/storage/storageProvider.ts

@ -1,6 +1,6 @@
import { avaloniaDb, fileBookmarksStore } from "./indexedDb";
import { StorageItem, StorageItems } from "./storageItem";
import { showOpenFilePicker, showDirectoryPicker, FileSystemFileHandle } from "native-file-system-adapter";
import { showOpenFilePicker, showDirectoryPicker, showSaveFilePicker, FileSystemFileHandle } from "native-file-system-adapter";
declare global {
type WellKnownDirectory = "desktop" | "documents" | "downloads" | "music" | "pictures" | "videos";
@ -46,8 +46,7 @@ export class StorageProvider {
types: (types ?? undefined)
};
// Always prefer native save file picker, as polyfill solutions are not reliable.
const handle = await (globalThis as any).showSaveFilePicker(options);
const handle = await showSaveFilePicker(options);
return StorageItem.createFromHandle(handle);
}

Loading…
Cancel
Save