diff --git a/src/components/video-editor/EnterpriseSettingsPanel.tsx b/src/components/video-editor/EnterpriseSettingsPanel.tsx index 686f9f8ab2..6e4b2a8e28 100644 --- a/src/components/video-editor/EnterpriseSettingsPanel.tsx +++ b/src/components/video-editor/EnterpriseSettingsPanel.tsx @@ -183,6 +183,8 @@ interface EnterpriseSettingsPanelProps { subtitleStyle?: import("./types").SubtitleStyle; onSubtitleStyleChange?: (style: Partial) => void; onSubtitleTextChange?: (id: string, text: string) => void; + /** Subtitle selected on the timeline; opens the Subtitles section and scrolls to it. */ + selectedSubtitleId?: string | null; onGenerateSubtitles?: () => void; isGeneratingSubtitles?: boolean; onClearSubtitles?: () => void; @@ -284,6 +286,7 @@ export function EnterpriseSettingsPanel({ subtitleStyle, onSubtitleStyleChange, onSubtitleTextChange, + selectedSubtitleId, onGenerateSubtitles, isGeneratingSubtitles = false, onClearSubtitles, @@ -292,6 +295,25 @@ export function EnterpriseSettingsPanel({ const [wallpaperPaths, setWallpaperPaths] = useState([]); const [customImages, setCustomImages] = useState([]); const fileInputRef = useRef(null); + const [openSections, setOpenSections] = useState(() => + hasWebcam ? ["layout", "effects", "background"] : ["effects", "background"], + ); + const subtitleItemRefs = useRef(new Map()); + + // Timeline selection drives the sidebar: open the Subtitles section and bring + // the selected line's editor into view (after the accordion expand settles). + useEffect(() => { + if (!selectedSubtitleId) return; + setOpenSections((prev) => (prev.includes("subtitles") ? prev : [...prev, "subtitles"])); + const timer = window.setTimeout(() => { + const el = subtitleItemRefs.current.get(selectedSubtitleId); + if (el) { + el.scrollIntoView({ behavior: "smooth", block: "center" }); + el.focus({ preventScroll: true }); + } + }, 220); + return () => window.clearTimeout(timer); + }, [selectedSubtitleId]); useEffect(() => { let mounted = true; @@ -716,7 +738,8 @@ export function EnterpriseSettingsPanel({ @@ -1531,13 +1554,22 @@ export function EnterpriseSettingsPanel({ const mm = Math.floor(startSec / 60); const ss = String(Math.floor(startSec % 60)).padStart(2, "0"); const ts = `${mm}:${ss}`; + const isSelected = sub.id === selectedSubtitleId; return (
{ts}