diff --git a/src/App.tsx b/src/App.tsx index c71746be0..c7ac3216c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,7 +4,6 @@ import { appWindow } from "@tauri-apps/api/window"; import { ConfigProvider, theme } from "antd"; import { RouterProvider } from "react-router-dom"; import { useSnapshot } from "valtio"; -import { subscribeKey } from "valtio/utils"; const { defaultAlgorithm, darkAlgorithm } = theme; import { isString } from "arcdash"; import { error } from "tauri-plugin-log-api"; @@ -27,28 +26,6 @@ const App = () => { setLocale(value); }); - subscribeKey(globalStore.appearance, "theme", async (value) => { - let nextTheme = value; - - if (isWin()) { - const yes = await ask("切换主题需要重启 app 才能生效!", { - okLabel: "重启", - cancelLabel: "取消", - type: "warning", - }); - - if (!yes) return; - } - - if (nextTheme === "auto") { - nextTheme = (await appWindow.theme()) ?? "light"; - } - - globalStore.appearance.isDark = nextTheme === "dark"; - - setTheme(value); - }); - watchKey(globalStore.appearance, "isDark", (value) => { if (value) { document.documentElement.classList.add("dark"); diff --git a/src/components/ProList/index.module.scss b/src/components/ProList/index.module.scss index 23054760c..8472cb50a 100644 --- a/src/components/ProList/index.module.scss +++ b/src/components/ProList/index.module.scss @@ -1,4 +1,4 @@ -.normal { +.root { --uno: "not-last-of-type:mb-16"; .title { diff --git a/src/components/ProList/index.tsx b/src/components/ProList/index.tsx index ec8a895f4..d7316bf8d 100644 --- a/src/components/ProList/index.tsx +++ b/src/components/ProList/index.tsx @@ -6,7 +6,7 @@ const ProList: FC> = (props) => { const { header, children, ...rest } = props; return ( - + {header && (
{header} diff --git a/src/layouts/Preference/index.tsx b/src/layouts/Preference/index.tsx index 29cc8c6e7..ea5e84751 100644 --- a/src/layouts/Preference/index.tsx +++ b/src/layouts/Preference/index.tsx @@ -9,6 +9,7 @@ import { Flex } from "antd"; import clsx from "clsx"; import { disable, enable, isEnabled } from "tauri-plugin-autostart-api"; import { subscribe, useSnapshot } from "valtio"; +import { subscribeKey } from "valtio/utils"; const Preference = () => { const { pathname } = useLocation(); @@ -64,6 +65,18 @@ const Preference = () => { appWindow.setTitle(t("preference.title")); }); }); + + subscribeKey(globalStore.appearance, "theme", async (value) => { + let nextTheme = value; + + if (nextTheme === "auto") { + nextTheme = (await appWindow.theme()) ?? "light"; + } + + globalStore.appearance.isDark = nextTheme === "dark"; + + setTheme(value); + }); }); useRegister(toggleWindowVisible, [shortcut.preference]); diff --git a/src/locales/en-US.json b/src/locales/en-US.json index e88da3701..29e1f8e91 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -52,7 +52,7 @@ }, "hints": { "auto_paste": "Quickly paste content to the input field when using the left mouse button", - "image_ocr": "Helps prevent crashes due to insufficient system OCR support; Linux users may need to download separately", + "image_ocr": "Note: Please be sure to download the", "copy_as_plain": "Only retains plain text content when copying rich text or HTML formats" } } @@ -116,6 +116,9 @@ "theme_auto": "System", "theme_light": "Light", "theme_dark": "Dark" + }, + "hints": { + "theme": "Note: The app will restart automatically when switching themes" } } }, diff --git a/src/locales/ja-JP.json b/src/locales/ja-JP.json index 2f426916f..35f793d2d 100644 --- a/src/locales/ja-JP.json +++ b/src/locales/ja-JP.json @@ -52,7 +52,7 @@ }, "hints": { "auto_paste": "左クリック時に、内容を素早く入力フィールドに貼り付けます", - "image_ocr": "システムOCRのサポートが不十分な場合のアプリケーションクラッシュを回避するために役立ちます。Linuxユーザーは別途ダウンロードが必要な場合があります。", + "image_ocr": "注意:ご使用前に必ずダウンロードしてください。", "copy_as_plain": "リッチテキストやHTML形式をコピーする際に、プレーンテキストのみを保持します" } } @@ -116,6 +116,9 @@ "theme_auto": "システムに従う", "theme_light": "ライト", "theme_dark": "ダーク" + }, + "hints": { + "theme": "注意: テーマを切り替えると、アプリは自動的に再起動します。" } } }, diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 293eca57f..9198b9991 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -52,7 +52,7 @@ }, "hints": { "auto_paste": "鼠标左键操作时,快速粘贴内容至输入位置", - "image_ocr": "可以暂时避免由于系统 OCR 支持不足导致应用崩溃的问题,如果是 linux 用户请自行下载", + "image_ocr": "注意:使用前请务必先下载", "copy_as_plain": "富文本和 HTML 格式在复制时仅保留纯文本内容" } } @@ -116,6 +116,9 @@ "theme_auto": "跟随系统", "theme_light": "亮色模式", "theme_dark": "暗色模式" + }, + "hints": { + "theme": "注意:切换主题时,应用将会自动重启" } } }, diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index a6e3128fa..e8d448774 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -52,7 +52,7 @@ }, "hints": { "auto_paste": "當使用滑鼠左鍵時,快速將內容貼上到輸入位置", - "image_ocr": "可暫時避免因系統 OCR 支援不足導致應用程式崩潰的問題,若為 Linux 用戶請自行下載", + "image_ocr": "注意:使用前請務必先下載", "copy_as_plain": "富文本和 HTML 格式在複製時僅保留純文字內容" } } @@ -116,6 +116,9 @@ "theme_auto": "跟隨系統", "theme_light": "亮色模式", "theme_dark": "暗色模式" + }, + "hints": { + "theme": "注意:切換主題時,應用將會自動重啟" } } }, diff --git a/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.module.scss b/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.module.scss index 3f3e8e070..b7f6f74c3 100644 --- a/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.module.scss +++ b/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.module.scss @@ -1,4 +1,4 @@ -.normal { +.root { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 4; diff --git a/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.tsx b/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.tsx index 5469397cd..bf39f620b 100644 --- a/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.tsx +++ b/src/pages/Clipboard/History/components/List/components/Item/components/Text/index.tsx @@ -37,7 +37,7 @@ const Text: FC = (props) => { return value; }; - return
{renderContent()}
; + return
{renderContent()}
; }; export default memo(Text); diff --git a/src/pages/Clipboard/Settings/index.tsx b/src/pages/Clipboard/Settings/index.tsx index 5df0ddf4d..d12c25ed3 100644 --- a/src/pages/Clipboard/Settings/index.tsx +++ b/src/pages/Clipboard/Settings/index.tsx @@ -70,12 +70,14 @@ const Clipboard = () => { - {t("preference.clipboard.content_settings.hints.image_ocr")}{" "} - - tesseract - - + isLinux() && ( + <> + {t("preference.clipboard.content_settings.hints.image_ocr")}{" "} + + tesseract + + + ) } value={content.ocr} onChange={(value) => { diff --git a/src/pages/General/components/ThemeMode/index.tsx b/src/pages/General/components/ThemeMode/index.tsx index 6f713b22e..016cf198b 100644 --- a/src/pages/General/components/ThemeMode/index.tsx +++ b/src/pages/General/components/ThemeMode/index.tsx @@ -29,6 +29,9 @@ const ThemeMode = () => { return ( {