Make it run in wasm

This commit is contained in:
2025-06-12 20:38:33 +02:00
parent 3908e6d913
commit 83ad2068e0
5 changed files with 19 additions and 6 deletions

View File

@ -2,7 +2,6 @@ use std::{
fs,
path::PathBuf,
sync::{Arc, mpsc},
thread,
};
use crate::{file_editor::FileEditor, preferences::Preferences, util::GuiSender};
@ -204,9 +203,10 @@ impl eframe::App for App {
self.open_tab(Tab::File(file));
}
#[cfg(not(target_arch = "wasm32"))]
if ui.button("Open File").clicked() {
let actions_tx = self.actions_tx(ui.ctx());
thread::spawn(move || {
std::thread::spawn(move || {
let file = rfd::FileDialog::new().pick_file();
let Some(file_path) = file else { return };
@ -263,6 +263,7 @@ impl eframe::App for App {
}
}
#[cfg(not(target_arch = "wasm32"))]
if ui
.add_enabled(open_file.is_some(), Button::new("Save As"))
.clicked()