Fix error on file save/save-as (#496)

* fix dynamic import

* Remove console log

* Fix other imports too
This commit is contained in:
Faraz Shaikh 2022-01-12 17:37:07 +04:00 committed by GitHub
parent f61c09fb55
commit 36a6026cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,7 +48,8 @@ export async function saveToFileSystem(document: TDDocument, fileHandle: FileSys
// Save to file system
// @ts-ignore
const fileSave = await import('./browser-fs-access').default.fileSave
const browserFS = await import('./browser-fs-access')
const fileSave = browserFS.fileSave
const newFileHandle = await fileSave(
blob,
{
@ -71,7 +72,8 @@ export async function openFromFileSystem(): Promise<null | {
}> {
// Get the blob
// @ts-ignore
const fileOpen = await import('./browser-fs-access').fileOpen
const browserFS = await import('./browser-fs-access')
const fileOpen = browserFS.fileOpen
const blob = await fileOpen({
description: 'Tldraw File',
extensions: [`.tldr`],
@ -106,7 +108,8 @@ export async function openFromFileSystem(): Promise<null | {
export async function openAssetFromFileSystem() {
// @ts-ignore
const fileOpen = await import('./browser-fs-access').fileOpen
const browserFS = await import('./browser-fs-access')
const fileOpen = browserFS.fileOpen
return fileOpen({
description: 'Image or Video',
extensions: [...IMAGE_EXTENSIONS, ...VIDEO_EXTENSIONS],