change back
parent
ac01c351d5
commit
77d364dfed
|
@ -37,7 +37,7 @@ const App = ({ store }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export let sce
|
export let sce
|
||||||
export let fs
|
// export let fs
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
ReactDOM.render(<App store={store} />, document.getElementById('react'));
|
ReactDOM.render(<App store={store} />, document.getElementById('react'));
|
||||||
|
|
||||||
fs = await import ('../../node_modules/browser-fs-access/dist/index')
|
// fs = await import ('../../node_modules/browser-fs-access/dist/index')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
// fileSave,
|
// fileSave,
|
||||||
// } from '../../extlib/fs/index';
|
// } from '../../extlib/fs/index';
|
||||||
|
|
||||||
// import {
|
import {
|
||||||
// fileOpen,
|
fileOpen,
|
||||||
// fileSave,
|
fileSave,
|
||||||
// } from 'browser-fs-access';
|
} from 'browser-fs-access';
|
||||||
|
|
||||||
import {sce, fs} from './app'
|
import {sce, fs} from './app'
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ export async function saveFile(fileHandle, file, dispatch) {
|
||||||
return await saveFileAs(file, dispatch);
|
return await saveFileAs(file, dispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
await fs.fileSave(new Blob([file], { type: 'application/json' }), undefined, fileHandle, true)
|
await fileSave(new Blob([file], { type: 'application/json' }), undefined, fileHandle, true)
|
||||||
|
|
||||||
dispatch({ type: 'set-modified', status: false })
|
dispatch({ type: 'set-modified', status: false })
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -51,7 +51,7 @@ export async function saveFile(fileHandle, file, dispatch) {
|
||||||
export async function saveFileAs(file, dispatch) {
|
export async function saveFileAs(file, dispatch) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const fileHandle = await fs.fileSave(new Blob([file], { type: 'application/json' }), {
|
const fileHandle = await fileSave(new Blob([file], { type: 'application/json' }), {
|
||||||
extensions: ['.json'],
|
extensions: ['.json'],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ export async function openFile(dispatch) {
|
||||||
description: 'Part files',
|
description: 'Part files',
|
||||||
};
|
};
|
||||||
|
|
||||||
file = await fs.fileOpen(options);
|
file = await fileOpen(options);
|
||||||
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.name === 'AbortError') {
|
if (ex.name === 'AbortError') {
|
||||||
|
|
Loading…
Reference in New Issue