mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-31 19:52:48 +08:00
1 parent
63849508d3
commit
6a30e0d840
1 file changed
+5
-2
@@ -824,11 +824,14 @@ class NativeHost {
|
||||
event.preventDefault();
|
||||
try {
|
||||
const files = (await this.call("open", {multiple:input.multiple, directory:input.webkitdirectory, accept:input.accept})).map(value => new NativeFile(value));
|
||||
if (!files.length) return;
|
||||
if (!files.length) { input.dispatchEvent(new Event("cancel", {bubbles:true})); return; }
|
||||
setInputFiles(input, files);
|
||||
input.dispatchEvent(new Event("input", {bubbles:true}));
|
||||
input.dispatchEvent(new Event("change", {bubbles:true}));
|
||||
} catch (error) { if (error.name !== "AbortError") onError(error); }
|
||||
} catch (error) {
|
||||
if (error.name === "AbortError") input.dispatchEvent(new Event("cancel", {bubbles:true}));
|
||||
else onError(error);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user