fix(export): clear timeline selection when opening export panel

When a zoom/trim/speed region is selected, hasTimelineSelection is true
and the export panel is gated behind !hasTimelineSelection. Clicking the
Download button only switched activePanelMode locally in SettingsPanel
without clearing the selection in VideoEditor, so the export panel never
rendered.

Add onExportPanelOpen callback prop to SettingsPanel and call it on
Download button click to clear selectedZoomId, selectedTrimId, and
selectedSpeedId — making hasTimelineSelection false and unblocking the
export panel.

Complements PR #611 which fixed the bulk suggest-zooms path; this
covers the manual selection path.
This commit is contained in:
auberginewly
2026-05-23 16:13:38 +08:00
parent 34340c2b29
commit 37eaacc07b
2 changed files with 11 additions and 1 deletions
@@ -284,6 +284,7 @@ interface SettingsPanelProps {
onGifSizePresetChange?: (preset: GifSizePreset) => void;
gifOutputDimensions?: { width: number; height: number };
onExport?: () => void;
onExportPanelOpen?: () => void;
unsavedExport?: {
arrayBuffer: ArrayBuffer;
fileName: string;
@@ -414,6 +415,7 @@ export function SettingsPanel({
onGifSizePresetChange,
gifOutputDimensions = DEFAULT_GIF_SETTINGS.outputDimensions,
onExport,
onExportPanelOpen,
unsavedExport,
onSaveUnsavedExport,
selectedAnnotationId,
@@ -822,7 +824,10 @@ export function SettingsPanel({
data-testid={getTestId("export-panel-button")}
type="button"
title={exportPanelMode.label}
onClick={() => setActivePanelMode(exportPanelMode.id)}
onClick={() => {
setActivePanelMode(exportPanelMode.id);
onExportPanelOpen?.();
}}
className={cn(
"mt-auto flex h-8 w-8 items-center justify-center rounded-lg border transition-all",
activePanelMode === "export" && !hasTimelineSelection
@@ -2256,6 +2256,11 @@ export default function VideoEditor() {
: getAspectRatioValue(aspectRatio),
)}
onExport={handleOpenExportDialog}
onExportPanelOpen={() => {
setSelectedZoomId(null);
setSelectedTrimId(null);
setSelectedSpeedId(null);
}}
selectedAnnotationId={selectedAnnotationId}
annotationRegions={annotationOnlyRegions}
onAnnotationContentChange={handleAnnotationContentChange}