feat(editor): 优化编辑器UI和改进核心功能 (#234)

* feat(editor): 优化编辑器UI和改进核心功能

* feat(editor): 优化编辑器UI和改进核心功能
This commit is contained in:
YHH
2025-11-23 21:45:10 +08:00
committed by GitHub
parent 4d95a7f044
commit 32460ac133
38 changed files with 2201 additions and 485 deletions

View File

@@ -28,6 +28,7 @@ interface FileTreeProps {
messageHub?: MessageHub;
searchQuery?: string;
showFiles?: boolean;
onOpenScene?: (scenePath: string) => void;
}
export interface FileTreeHandle {
@@ -36,7 +37,7 @@ export interface FileTreeHandle {
revealPath: (targetPath: string) => Promise<void>;
}
export const FileTree = forwardRef<FileTreeHandle, FileTreeProps>(({ rootPath, onSelectFile, onSelectFiles, selectedPath, selectedPaths, messageHub, searchQuery, showFiles = true }, ref) => {
export const FileTree = forwardRef<FileTreeHandle, FileTreeProps>(({ rootPath, onSelectFile, onSelectFiles, selectedPath, selectedPaths, messageHub, searchQuery, showFiles = true, onOpenScene }, ref) => {
const [tree, setTree] = useState<TreeNode[]>([]);
const [loading, setLoading] = useState(false);
const [internalSelectedPath, setInternalSelectedPath] = useState<string | null>(null);
@@ -714,6 +715,14 @@ export const FileTree = forwardRef<FileTreeHandle, FileTreeProps>(({ rootPath, o
const handleNodeDoubleClick = async (node: TreeNode) => {
if (node.type === 'file') {
// Handle .ecs scene files
const ext = node.name.split('.').pop()?.toLowerCase();
if (ext === 'ecs' && onOpenScene) {
console.log('[FileTree] Opening scene:', node.path);
onOpenScene(node.path);
return;
}
if (fileActionRegistry) {
const handled = await fileActionRegistry.handleDoubleClick(node.path);
if (handled) {