mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
fix: export buttons do not work (#274)
This commit is contained in:
@@ -19,19 +19,29 @@ pub fn fullscreen(app: AppHandle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub fn download(_app: AppHandle, name: String, blob: Vec<u8>) {
|
pub fn download(app: AppHandle, name: String, blob: Vec<u8>) {
|
||||||
|
let win = app.app_handle().get_window("core");
|
||||||
let path = utils::app_root().join(PathBuf::from(name));
|
let path = utils::app_root().join(PathBuf::from(name));
|
||||||
utils::create_file(&path).unwrap();
|
utils::create_file(&path).unwrap();
|
||||||
fs::write(&path, blob).unwrap();
|
fs::write(&path, blob).unwrap();
|
||||||
utils::open_file(path);
|
tauri::api::dialog::message(
|
||||||
|
win.as_ref(),
|
||||||
|
"Save File",
|
||||||
|
format!("PATH: {}", path.display()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub fn save_file(_app: AppHandle, name: String, content: String) {
|
pub fn save_file(app: AppHandle, name: String, content: String) {
|
||||||
|
let win = app.app_handle().get_window("core");
|
||||||
let path = utils::app_root().join(PathBuf::from(name));
|
let path = utils::app_root().join(PathBuf::from(name));
|
||||||
utils::create_file(&path).unwrap();
|
utils::create_file(&path).unwrap();
|
||||||
fs::write(&path, content).unwrap();
|
fs::write(&path, content).unwrap();
|
||||||
utils::open_file(path);
|
tauri::api::dialog::message(
|
||||||
|
win.as_ref(),
|
||||||
|
"Save File",
|
||||||
|
format!("PATH: {}", path.display()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ async fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut builder = tauri::Builder::default()
|
let mut builder = tauri::Builder::default()
|
||||||
// https://github.com/tauri-apps/tauri/pull/2736
|
|
||||||
.plugin(log.build())
|
.plugin(log.build())
|
||||||
.plugin(tauri_plugin_positioner::init())
|
.plugin(tauri_plugin_positioner::init())
|
||||||
.plugin(tauri_plugin_autostart::init(
|
.plugin(tauri_plugin_autostart::init(
|
||||||
@@ -92,19 +91,10 @@ async fn main() {
|
|||||||
.on_menu_event(menu::menu_handler)
|
.on_menu_event(menu::menu_handler)
|
||||||
.on_system_tray_event(menu::tray_handler)
|
.on_system_tray_event(menu::tray_handler)
|
||||||
.on_window_event(|event| {
|
.on_window_event(|event| {
|
||||||
// https://github.com/tauri-apps/tauri/discussions/2684
|
|
||||||
if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() {
|
if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() {
|
||||||
let win = event.window();
|
let win = event.window();
|
||||||
if win.label() == "core" {
|
if win.label() == "core" {
|
||||||
// TODO: https://github.com/tauri-apps/tauri/issues/3084
|
|
||||||
// event.window().hide().unwrap();
|
|
||||||
// https://github.com/tauri-apps/tao/pull/517
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
event.window().minimize().unwrap();
|
event.window().minimize().unwrap();
|
||||||
|
|
||||||
// fix: https://github.com/lencx/ChatGPT/issues/93
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
event.window().hide().unwrap();
|
|
||||||
} else {
|
} else {
|
||||||
win.close().unwrap();
|
win.close().unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
2
src-tauri/src/scripts/export.js
vendored
2
src-tauri/src/scripts/export.js
vendored
@@ -200,7 +200,7 @@ class Elements {
|
|||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
// this.threadWrapper = document.querySelector(".cdfdFe");
|
// this.threadWrapper = document.querySelector(".cdfdFe");
|
||||||
this.spacer = document.querySelector(".w-full.h-48.flex-shrink-0");
|
this.spacer = document.querySelector("[class*='h-48'].w-full.flex-shrink-0");
|
||||||
this.thread = document.querySelector(
|
this.thread = document.querySelector(
|
||||||
"[class*='react-scroll-to-bottom']>[class*='react-scroll-to-bottom']>div"
|
"[class*='react-scroll-to-bottom']>[class*='react-scroll-to-bottom']>div"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user