From 4775d77063f8519680b0ddcd942e554d48daa3d8 Mon Sep 17 00:00:00 2001 From: ct Date: Fri, 18 Jul 2025 01:15:14 +0800 Subject: [PATCH] Update --- .../editor/partials/canvas/video-preview.jsx | 5 +++++ .../js/modules/editor/partials/editor-controls.jsx | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/js/modules/editor/partials/canvas/video-preview.jsx b/resources/js/modules/editor/partials/canvas/video-preview.jsx index 6a4e88d..60c01ea 100644 --- a/resources/js/modules/editor/partials/canvas/video-preview.jsx +++ b/resources/js/modules/editor/partials/canvas/video-preview.jsx @@ -119,6 +119,10 @@ const VideoPreview = ({ elementRefs, ); + const handleResetClick = () => { + emitter.emit('video-reset'); + }; + // Enhanced stage click handler that also clears guide lines const handleStageClick = (e) => { baseHandleStageClick(e); @@ -281,6 +285,7 @@ const VideoPreview = ({ id="open-text-editor" className="h-16 w-16 rounded-full shadow-xl" onClick={() => { + handleResetClick(); handleElementSelect(element.id); onOpenTextSidebar(); }} diff --git a/resources/js/modules/editor/partials/editor-controls.jsx b/resources/js/modules/editor/partials/editor-controls.jsx index 82eb566..e23c523 100644 --- a/resources/js/modules/editor/partials/editor-controls.jsx +++ b/resources/js/modules/editor/partials/editor-controls.jsx @@ -3,9 +3,9 @@ import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; import { useMitt } from '@/plugins/MittContext'; -import useVideoEditorStore from '@/stores/VideoEditorStore'; import useMediaStore from '@/stores/MediaStore'; -import { Download, Play, Square, SquarePen, RefreshCw } from 'lucide-react'; +import useVideoEditorStore from '@/stores/VideoEditorStore'; +import { Download, Play, RefreshCw, Square, SquarePen } from 'lucide-react'; const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive = false }) => { const { videoIsPlaying } = useVideoEditorStore(); @@ -16,15 +16,22 @@ const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive = emitter.emit('video-play'); }; + const handleOnEditClick = () => { + handleReset(); + onEditClick(); + }; + const handleReset = () => { emitter.emit('video-reset'); }; const handleDownloadButton = () => { + handleReset(); emitter.emit('video-open-download-modal'); }; const handleAIButton = () => { + handleReset(); emitter.emit('open-ai-editor-sheet'); }; @@ -60,7 +67,7 @@ const EditorControls = ({ className = '', onEditClick = () => {}, isEditActive = variant={isEditActive ? 'outline' : 'outline'} size="icon" className="h-12 w-12 rounded-full border shadow-sm" - onClick={onEditClick} + onClick={handleOnEditClick} >