fix
This commit is contained in:
parent
01b6603eec
commit
3462256cce
|
|
@ -1,11 +1,13 @@
|
||||||
import React from 'react'
|
import React, { useEffect } from 'react'
|
||||||
import { Download, Save, Scissors } from 'lucide-react'
|
import { Download, Save, Scissors, ArrowLeft } from 'lucide-react'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
import VideoPreview from '../components/VideoPreview'
|
import VideoPreview from '../components/VideoPreview'
|
||||||
import MediaLibrary from '../components/MediaLibrary'
|
import MediaLibrary from '../components/MediaLibrary'
|
||||||
import { useProjectStore } from '../stores/useProjectStore'
|
import { useProjectStore } from '../stores/useProjectStore'
|
||||||
|
|
||||||
const EditorPage: React.FC = () => {
|
const EditorPage: React.FC = () => {
|
||||||
const { currentProject, saveProject, isSaving } = useProjectStore()
|
const { currentProject, saveProject, isSaving } = useProjectStore()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (currentProject) {
|
if (currentProject) {
|
||||||
|
|
@ -18,11 +20,48 @@ const EditorPage: React.FC = () => {
|
||||||
console.log('Export project')
|
console.log('Export project')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleBack = () => {
|
||||||
|
// 返回到首页
|
||||||
|
navigate('/')
|
||||||
|
}
|
||||||
|
|
||||||
|
// 键盘快捷键支持
|
||||||
|
useEffect(() => {
|
||||||
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
|
// ESC键返回
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
handleBack()
|
||||||
|
}
|
||||||
|
// Ctrl+S 保存
|
||||||
|
if (event.ctrlKey && event.key === 's') {
|
||||||
|
event.preventDefault()
|
||||||
|
handleSave()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('keydown', handleKeyDown)
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('keydown', handleKeyDown)
|
||||||
|
}
|
||||||
|
}, [currentProject])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col bg-secondary-900">
|
<div className="h-full flex flex-col bg-secondary-900">
|
||||||
{/* Top Toolbar */}
|
{/* Top Toolbar */}
|
||||||
<div className="bg-secondary-800 border-b border-secondary-700 p-4 flex items-center justify-between">
|
<div className="bg-secondary-800 border-b border-secondary-700 p-4 flex items-center justify-between">
|
||||||
<div className="flex items-center space-x-4">
|
<div className="flex items-center space-x-4">
|
||||||
|
{/* 返回按钮 */}
|
||||||
|
<button
|
||||||
|
onClick={handleBack}
|
||||||
|
className="flex items-center text-white hover:text-gray-300 transition-colors"
|
||||||
|
title="返回首页"
|
||||||
|
>
|
||||||
|
<ArrowLeft size={20} className="mr-2" />
|
||||||
|
<span className="text-sm">返回</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div className="w-px h-6 bg-secondary-600"></div>
|
||||||
|
|
||||||
<h1 className="text-white font-semibold">
|
<h1 className="text-white font-semibold">
|
||||||
{currentProject ? currentProject.name : '视频编辑器'}
|
{currentProject ? currentProject.name : '视频编辑器'}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
||||||
|
|
@ -71,15 +71,6 @@ const HomePage: React.FC = () => {
|
||||||
>
|
>
|
||||||
创建项目
|
创建项目
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
|
||||||
onClick={testTauriConnection}
|
|
||||||
disabled={isTestingConnection}
|
|
||||||
className="btn-ghost px-6 py-3 border border-secondary-300"
|
|
||||||
>
|
|
||||||
<TestTube className="mr-2" size={16} />
|
|
||||||
{isTestingConnection ? '测试中...' : '测试连接'}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{testResult && (
|
{testResult && (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue