mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-31 19:17:40 +08:00
1 parent
63849508d3
commit
6a30e0d840
1 file changed
+5
-2
@@ -824,11 +824,14 @@ class NativeHost {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
try {
|
try {
|
||||||
const files = (await this.call("open", {multiple:input.multiple, directory:input.webkitdirectory, accept:input.accept})).map(value => new NativeFile(value));
|
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);
|
setInputFiles(input, files);
|
||||||
input.dispatchEvent(new Event("input", {bubbles:true}));
|
input.dispatchEvent(new Event("input", {bubbles:true}));
|
||||||
input.dispatchEvent(new Event("change", {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);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user