From 8eade8e9b9144bd51f4739a9df8ae639e646af59 Mon Sep 17 00:00:00 2001 From: lencx Date: Wed, 1 Feb 2023 00:23:44 +0800 Subject: [PATCH] chore: optim --- src-tauri/src/app/menu.rs | 5 ++++- src-tauri/src/app/window.rs | 2 ++ src-tauri/src/main.rs | 1 - src-tauri/src/scripts/export.js | 14 +++++++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 0e3aac819..5f4d2c86c 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -81,7 +81,6 @@ pub fn init() -> Menu { CustomMenuItem::new("control_center".to_string(), "Control Center") .accelerator("CmdOrCtrl+Shift+P") .into(), - CustomMenuItem::new("app_website".to_string(), "ChatGPT User's Guide").into(), MenuItem::Separator.into(), stay_on_top_menu.into(), #[cfg(target_os = "macos")] @@ -190,6 +189,10 @@ pub fn init() -> Menu { let window_menu = Submenu::new( "Window", Menu::new() + .add_item(CustomMenuItem::new( + "app_website".to_string(), + "ChatGPT User's Guide", + )) .add_item(CustomMenuItem::new("dalle2".to_string(), "DALLĀ·E 2")) .add_native_item(MenuItem::Separator) .add_native_item(MenuItem::Minimize) diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs index ee3c39865..bc5ef19b7 100644 --- a/src-tauri/src/app/window.rs +++ b/src-tauri/src/app/window.rs @@ -145,6 +145,8 @@ pub mod cmd { .initialization_script(&script.unwrap_or_default()) .initialization_script(include_str!("../scripts/core.js")) .title(title) + .inner_size(960.0, 700.0) + .resizable(true) .build() .unwrap(); }); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 74590ccc3..01c042f37 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,7 +9,6 @@ mod utils; use app::{cmd, fs_extra, gpt, menu, setup, window}; use conf::AppConf; -use log::info; use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_log::{ fern::colors::{Color, ColoredLevelConfig}, diff --git a/src-tauri/src/scripts/export.js b/src-tauri/src/scripts/export.js index 16734af6a..de625161b 100644 --- a/src-tauri/src/scripts/export.js +++ b/src-tauri/src/scripts/export.js @@ -20,6 +20,7 @@ async function init() { TryAgainButton = parentNode.querySelector("button"); } addActionsButtons(actionsArea, TryAgainButton, chatConf); + copyBtns(); } else if (shouldRemoveButtons()) { removeButtons(); } @@ -268,10 +269,21 @@ function setIcon(type) { // link: ``, png: ``, pdf: ``, - md: `` + md: ``, + copy: `` }[type]; } +function copyBtns() { + document.querySelectorAll("main >div>div>div>div>div").forEach(i => { + if (!/flex-shrink/i.test(i.getAttribute('class'))) return; + const btn = i.querySelector('button').cloneNode(true); + btn.innerHTML = setIcon('copy'); + i.querySelector('.self-end').appendChild(btn); + }) +} + + if ( document.readyState === "complete" || document.readyState === "interactive"