mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-14 23:09:46 -04:00
Fixed single file loading
Former-commit-id: 8f691a57b9aae2b6fe19c82e2b96ce0f6a6524b5 [formerly 0c1238e9c261dc3c13b9e7a30066d8b2573ea54b] Former-commit-id: 04c95f7c798d15814d382dd7afc3883577875ef2
This commit is contained in:
parent
58f3457281
commit
64da1cfa58
@ -911,9 +911,18 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'cook
|
||||
}
|
||||
if (typeof window.chooseFileSystemEntries !== 'undefined') {
|
||||
getNativeFSHandle(function(handle) {
|
||||
if (handle.isFile) params.pickedFile = handle;
|
||||
if (handle.isDirectory) params.pickedFolder = handle;
|
||||
setLocalArchiveFromArchiveList(selected);
|
||||
if (handle.isDirectory) {
|
||||
params.pickedFolder = handle;
|
||||
setLocalArchiveFromArchiveList(selected);
|
||||
} else if (handle.isFile) {
|
||||
handle.getFile().then(function(file) {
|
||||
params.pickedFile = file;
|
||||
params.pickedFile.handle = handle;
|
||||
setLocalArchiveFromArchiveList(selected);
|
||||
}).catch(function(err) {
|
||||
console.error('Unable to read previously picked file!', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setLocalArchiveFromArchiveList(selected);
|
||||
@ -1923,6 +1932,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'cook
|
||||
} else if (params.pickedFile && typeof window.chooseFileSystemEntries !== 'undefined') {
|
||||
// Native FS API for single file
|
||||
setLocalArchiveFromFileList([params.pickedFile]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//There was no picked file or folder, so we'll try setting the default localStorage
|
||||
|
Loading…
x
Reference in New Issue
Block a user