Changed underlying directory attribute to webkitdirectory, fixed attribute parsing to properly toggle it.

This commit is contained in:
Kaid committed 2023-06-06 08:06:27 +08:00
1 parent 37a8fb5391
commit 277436f673
5 files changed
+20 -5

No files matched your search

+4 -1
View File
@@ -21,7 +21,10 @@ fn get_file_event_for_folder(request: &FileDiologRequest, dialog: rfd::FileDialo
}
}
fn get_file_event_for_file(request: &FileDiologRequest, mut dialog: rfd::FileDialog) -> Vec<PathBuf> {
fn get_file_event_for_file(
request: &FileDiologRequest,
mut dialog: rfd::FileDialog,
) -> Vec<PathBuf> {
let filters: Vec<_> = request
.accept
.as_deref()
+1 -1
View File
@@ -24,7 +24,7 @@ fn module_loader(root_name: &str) -> String {
let target_id = find_real_id(target);
if (target_id !== null) {
const send = (event_name) => {
const message = serializeIpcMessage("file_diolog", { accept: target.getAttribute("accept"), directory: target.hasAttribute("directory"), multiple: target.hasAttribute("multiple"), target: parseInt(target_id), bubbles: event_bubbles(event_name), event: event_name });
const message = serializeIpcMessage("file_diolog", { accept: target.getAttribute("accept"), directory: target.getAttribute("webkitdirectory") === "true", multiple: target.hasAttribute("multiple"), target: parseInt(target_id), bubbles: event_bubbles(event_name), event: event_name });
window.ipc.postMessage(message);
};
send("change&input");
+1 -1
View File
@@ -1098,7 +1098,7 @@ builder_constructors! {
autofocus: Bool DEFAULT,
capture: String DEFAULT,
checked: Bool DEFAULT,
directory: Bool DEFAULT,
directory: Bool "webkitdirectory",
disabled: Bool DEFAULT,
form: Id DEFAULT,
formaction: Uri DEFAULT,
@@ -143,10 +143,10 @@ mod js {
autofocus: true,
autoplay: true,
checked: true,
directory: true,
controls: true,
default: true,
defer: true,
directory: true,
disabled: true,
formnovalidate: true,
hidden: true,