mirror of
https://github.com/Doodle3D/Doodle3D-Transform.git
synced 2024-12-22 19:13:49 +01:00
Use file-dialog
npm package for selecting files
@companje file selecting werkt nu getest op Chrome, Safari, Firefox in MacOS (nog niet getest in IOS)
This commit is contained in:
parent
f4d187efa7
commit
00bc8aacc3
11
package-lock.json
generated
11
package-lock.json
generated
@ -45,6 +45,7 @@
|
||||
"eslint-plugin-react": "^3.15.0",
|
||||
"executive": "^1.5.11",
|
||||
"fastclick": "^1.0.6",
|
||||
"file-dialog": "^0.0.8",
|
||||
"file-loader": "^0.11.2",
|
||||
"file-saver": "^1.3.3",
|
||||
"form-data": "^2.1.1",
|
||||
@ -5069,6 +5070,11 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-dialog": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/file-dialog/-/file-dialog-0.0.8.tgz",
|
||||
"integrity": "sha512-KnYitqNf/rANEhUxWzkINAaMVc7SshejwA5HEd5Wr8lEJQX1Js1LCndectS44SXTnXWK+jbHQYs4R6CaG+7Jkg=="
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-1.3.1.tgz",
|
||||
@ -22409,6 +22415,11 @@
|
||||
"object-assign": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"file-dialog": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/file-dialog/-/file-dialog-0.0.8.tgz",
|
||||
"integrity": "sha512-KnYitqNf/rANEhUxWzkINAaMVc7SshejwA5HEd5Wr8lEJQX1Js1LCndectS44SXTnXWK+jbHQYs4R6CaG+7Jkg=="
|
||||
},
|
||||
"file-entry-cache": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-1.3.1.tgz",
|
||||
|
@ -54,6 +54,7 @@
|
||||
"eslint-plugin-react": "^3.15.0",
|
||||
"executive": "^1.5.11",
|
||||
"fastclick": "^1.0.6",
|
||||
"file-dialog": "^0.0.8",
|
||||
"file-loader": "^0.11.2",
|
||||
"file-saver": "^1.3.3",
|
||||
"form-data": "^2.1.1",
|
||||
|
@ -1,3 +1,4 @@
|
||||
import fileDialog from 'file-dialog';
|
||||
import { createUniqueName, sketchDataToDoc, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT } from 'src/js/utils/saveUtils.js';
|
||||
import sketchDataToJSON from '@doodle3d/doodle3d-core/lib/shape/sketchDataToJSON';
|
||||
import { JSONToBlob } from '@doodle3d/doodle3d-core/lib/utils/binaryUtils';
|
||||
@ -78,9 +79,10 @@ export const downloadAllSketches = () => {
|
||||
|
||||
export const openFileSelector = () => {
|
||||
return async (dispatch, getState) => {
|
||||
const files = await window.showOpenFilePicker({ multiple: true });
|
||||
for (let file of files) {
|
||||
await loadFile(dispatch, file.name, () => file.getFile());
|
||||
const files = await fileDialog({ multiple: true });
|
||||
for (let i = 0; i < files.length; i ++) {
|
||||
const file = files[i];
|
||||
await loadFile(dispatch, file.name, () => Promise.resolve(file))
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user