mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-29 09:55:56 +08:00
feat: 原生对话框、ErrorBoundary、配置生效、交互打磨
- handleBrowse 改用 @tauri-apps/plugin-dialog 原生目录选择 - handleImport 清理临时 DOM 元素(add input.remove()) - config/default.json 实际导入生效(maxHistory、path 长度限制) - app-store.ts 长度检查改用配置值 - 删除 AppShell 中与 store 重复的长度检查 - 新增 ErrorBoundary 组件避免单异常白屏 - StatusBar 加载失败时显示重试按钮 - 取消按钮检查 isModified 未保存提示 - lib.rs 注册 tauri-plugin-dialog - tsconfig 添加 resolveJsonModule - CLAUDE.md 添加 cargo test 运行时说明 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import { invoke } from '@tauri-apps/api/core';
|
||||
import i18n from '@/i18n';
|
||||
import { UndoRedoManager, OperationType, TargetType } from '@/core/undo-redo';
|
||||
import { pathClean } from '@/core/path-manager';
|
||||
import appConfig from '@/config/default.json';
|
||||
|
||||
export type TabId = 'system' | 'user' | 'merged';
|
||||
|
||||
@@ -47,7 +48,7 @@ interface AppState {
|
||||
export const useAppStore = create<AppState>((set, get) => ({
|
||||
sysPaths: [],
|
||||
userPaths: [],
|
||||
undoRedo: new UndoRedoManager(50),
|
||||
undoRedo: new UndoRedoManager(appConfig.undo.maxHistory),
|
||||
|
||||
activeTab: 'system',
|
||||
searchQuery: '',
|
||||
@@ -207,7 +208,7 @@ export const useAppStore = create<AppState>((set, get) => ({
|
||||
set({
|
||||
sysPaths: sysArr,
|
||||
userPaths: userArr,
|
||||
undoRedo: new UndoRedoManager(50),
|
||||
undoRedo: new UndoRedoManager(appConfig.undo.maxHistory),
|
||||
isLoading: false,
|
||||
isModified: false,
|
||||
statusMessage: i18n.t('status.loaded', { sysCount: sysArr.length, userCount: userArr.length }),
|
||||
@@ -222,7 +223,8 @@ export const useAppStore = create<AppState>((set, get) => ({
|
||||
const sysJoined = sysPaths.join(';');
|
||||
const userJoined = userPaths.join(';');
|
||||
|
||||
if (sysJoined.length > 2048 || userJoined.length > 2048 || (sysJoined + userJoined).length > 8191) {
|
||||
const { maxSystemLength, maxUserLength, maxCombinedLength } = appConfig.path;
|
||||
if (sysJoined.length > maxSystemLength || userJoined.length > maxUserLength || (sysJoined + userJoined).length > maxCombinedLength) {
|
||||
if (!window.confirm(`${i18n.t('status.error')}: PATH 长度超过建议值,是否继续?`)) return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user