Feature/editor optimization (#251)

* refactor: 编辑器/运行时架构拆分与构建系统升级

* feat(core): 层级系统重构与UI变换矩阵修复

* refactor: 移除 ecs-components 聚合包并修复跨包组件查找问题

* fix(physics): 修复跨包组件类引用问题

* feat: 统一运行时架构与浏览器运行支持

* feat(asset): 实现浏览器运行时资产加载系统

* fix: 修复文档、CodeQL安全问题和CI类型检查错误

* fix: 修复文档、CodeQL安全问题和CI类型检查错误

* fix: 修复文档、CodeQL安全问题、CI类型检查和测试错误

* test: 补齐核心模块测试用例,修复CI构建配置

* fix: 修复测试用例中的类型错误和断言问题

* fix: 修复 turbo build:npm 任务的依赖顺序问题

* fix: 修复 CI 构建错误并优化构建性能
This commit is contained in:
YHH
2025-12-01 22:28:51 +08:00
committed by GitHub
parent 189714c727
commit b42a7b4e43
468 changed files with 18301 additions and 9075 deletions

View File

@@ -1,6 +1,9 @@
import { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
import * as LucideIcons from 'lucide-react';
import { Folder, ChevronRight, ChevronDown, File, Edit3, Trash2, FolderOpen, Copy, FileText, FolderPlus, Plus } from 'lucide-react';
import {
Folder, ChevronRight, ChevronDown, File, Edit3, Trash2, FolderOpen, Copy, FileText, FolderPlus, Plus,
Save, Tag, Link, FileSearch, Globe, Package, Clipboard, RefreshCw, Settings
} from 'lucide-react';
import { TauriAPI, DirectoryEntry } from '../api/tauri';
import { MessageHub, FileActionRegistry } from '@esengine/editor-core';
import { Core } from '@esengine/ecs-framework';
@@ -614,25 +617,187 @@ export const FileTree = forwardRef<FileTreeHandle, FileTreeProps>(({ rootPath, o
}
}
}
items.push({ label: '', separator: true, onClick: () => {} });
// 文件操作菜单项
items.push({
label: '保存',
icon: <Save size={16} />,
shortcut: 'Ctrl+S',
onClick: () => {
// TODO: 实现保存功能
console.log('Save file:', node.path);
}
});
}
items.push({
label: '重命名',
icon: <Edit3 size={16} />,
shortcut: 'F2',
onClick: () => {
setRenamingNode(node.path);
setNewName(node.name);
}
});
items.push({
label: '批量重命名',
icon: <Edit3 size={16} />,
shortcut: 'Shift+F2',
disabled: true, // TODO: 实现批量重命名
onClick: () => {
console.log('Batch rename');
}
});
items.push({
label: '复制',
icon: <Clipboard size={16} />,
shortcut: 'Ctrl+D',
onClick: () => {
// TODO: 实现复制功能
console.log('Duplicate:', node.path);
}
});
items.push({
label: '删除',
icon: <Trash2 size={16} />,
shortcut: 'Delete',
onClick: () => handleDeleteClick(node)
});
items.push({ label: '', separator: true, onClick: () => {} });
// 资产操作子菜单
items.push({
label: '资产操作',
icon: <Settings size={16} />,
onClick: () => {},
children: [
{
label: '重新导入',
icon: <RefreshCw size={16} />,
onClick: () => {
console.log('Reimport asset:', node.path);
}
},
{
label: '导出...',
icon: <Package size={16} />,
onClick: () => {
console.log('Export asset:', node.path);
}
},
{ label: '', separator: true, onClick: () => {} },
{
label: '迁移资产',
icon: <Folder size={16} />,
onClick: () => {
console.log('Migrate asset:', node.path);
}
}
]
});
// 资产本地化子菜单
items.push({
label: '资产本地化',
icon: <Globe size={16} />,
onClick: () => {},
children: [
{
label: '创建本地化资产',
onClick: () => {
console.log('Create localized asset:', node.path);
}
},
{
label: '导入翻译',
onClick: () => {
console.log('Import translation:', node.path);
}
},
{
label: '导出翻译',
onClick: () => {
console.log('Export translation:', node.path);
}
}
]
});
items.push({ label: '', separator: true, onClick: () => {} });
// 标签和引用
items.push({
label: '管理标签',
icon: <Tag size={16} />,
shortcut: 'Ctrl+T',
onClick: () => {
console.log('Manage tags:', node.path);
}
});
items.push({ label: '', separator: true, onClick: () => {} });
// 路径复制选项
items.push({
label: '复制引用',
icon: <Link size={16} />,
shortcut: 'Ctrl+C',
onClick: () => {
navigator.clipboard.writeText(node.path);
}
});
items.push({
label: '拷贝Object路径',
icon: <Copy size={16} />,
shortcut: 'Ctrl+Shift+C',
onClick: () => {
// 生成对象路径格式
const objectPath = node.path.replace(/\\/g, '/');
navigator.clipboard.writeText(objectPath);
}
});
items.push({
label: '拷贝包路径',
icon: <Package size={16} />,
shortcut: 'Ctrl+Alt+C',
onClick: () => {
// 生成包路径格式
const packagePath = '/' + node.path.replace(/\\/g, '/').split('/').slice(-2).join('/');
navigator.clipboard.writeText(packagePath);
}
});
items.push({ label: '', separator: true, onClick: () => {} });
// 引用查看器
items.push({
label: '引用查看器',
icon: <FileSearch size={16} />,
shortcut: 'Alt+Shift+R',
onClick: () => {
console.log('Open reference viewer:', node.path);
}
});
items.push({
label: '尺寸信息图',
icon: <FileSearch size={16} />,
shortcut: 'Alt+Shift+D',
onClick: () => {
console.log('Show size map:', node.path);
}
});
items.push({ label: '', separator: true, onClick: () => {} });
if (node.type === 'folder') {
items.push({
label: '新建文件',
@@ -675,14 +840,6 @@ export const FileTree = forwardRef<FileTreeHandle, FileTreeProps>(({ rootPath, o
}
});
items.push({
label: '复制路径',
icon: <Copy size={16} />,
onClick: () => {
navigator.clipboard.writeText(node.path);
}
});
return items;
};