mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-11-01 00:03:53 +08:00
1 parent
5fce4f0a71
commit
d7d3942e1a
6 files changed
+55
-44
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { setInputFiles } from "./ofdgo_util.js";
|
||||
|
||||
let engineModule = null;
|
||||
let engineScheduler = null;
|
||||
let engineSequence = 0;
|
||||
@@ -823,11 +825,7 @@ class NativeHost {
|
||||
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;
|
||||
const transfer = new DataTransfer();
|
||||
for (const file of files) transfer.items.add(new File([], file.name, {type:file.type}));
|
||||
delete input.files;
|
||||
input.files = transfer.files;
|
||||
Object.defineProperty(input, "files", {configurable:true, get:() => input.value ? files : []});
|
||||
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); }
|
||||
|
||||
Reference in new issue
Block a user