Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(captions): open caption settings in place of the transcript pane
EtienneLescotfe04a3b06739
diff --git a/src/components/ai-edition/CaptionsPane.tsx b/src/components/ai-edition/CaptionsPane.tsxindex 20c3bc111..e1ea3ae7e 100644--- a/src/components/ai-edition/CaptionsPane.tsx+++ b/src/components/ai-edition/CaptionsPane.tsx@@ -198,7 +198,6 @@ export function CaptionsPane({ onClose }: { onClose?: () => void } = {}) {className={styles.paneHead}style={{position: "relative",- paddingRight: "var(--sp-4)",flexShrink: 0,}}>diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.cssindex 7a8572f5e..6050c1a80 100644--- a/src/components/ai-edition/NewEditorShell.module.css+++ b/src/components/ai-edition/NewEditorShell.module.css@@ -1335,20 +1335,6 @@ textarea.control {box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand), transparent 70%);}-.captionsPopover {- width: 310px;- display: flex;- flex-direction: column;- border: 1px solid var(--border);- border-radius: 14px;- background: var(--surface-1);- box-shadow: var(--elev-pop);- backdrop-filter: blur(18px);- -webkit-backdrop-filter: blur(18px);- max-height: min(var(--radix-popover-content-available-height, 80vh), 560px);- overflow: hidden;-}-/* ─── toggle (switch) ──────────────────────────────────────────── */.toggle {width: 40px;diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex 647da5c28..2ba359d49 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -96,7 +96,6 @@ import { removedRawSpans } from "@/lib/ai-edition/timeline/programme-time";import {type AssetTranscriptionView,type TranscriptGateReason,- transcriptHasSpeech,} from "@/lib/ai-edition/transcription/status";import { getAssetPath } from "@/lib/assetPath";import { resolveWebcamLayoutPreset, supportsWebcamReactiveZoom } from "@/lib/compositeLayout";@@ -767,51 +766,17 @@ function TranscriptLaneSwitch({}/**- * Caption settings, reached from the transcript tab (issue #560).- *- * The pane is reused VERBATIM rather than rebuilt into a popover body: it is ~600- * lines of settings that already work, and "make it a popover" is a question about- * where it is mounted, not about what it contains. Rebuilding it would have been the- * one reliable way to arrive at a popover that is not at parity with the tab it- * replaces.- *- * Safe inside a Popover specifically because nothing in it takes focus away — no file- * input, no OS dialog. That is the trap `useWallpaperFileInput` documents above, and- * it is worth re-checking if a picker is ever added to captions.+ * Caption settings, reached from the transcript tab (issue #560). Opening them swaps+ * the transcript pane for `CaptionsPane` in the same inspector card, so the settings+ * take the transcript's place and size instead of floating beside it.*/-function CaptionSettingsButton({ onShowCaptions }: { onShowCaptions?: () => void }) {+function CaptionSettingsButton({ onOpen }: { onOpen: () => void }) {const ts = useScopedT("settings");- const [open, setOpen] = useState(false);return (- <>- {/* Captions are off by default: once there is speech to caption, offer them where- the transcript is, rather than leaving them behind the settings popover. */}- {onShowCaptions ? (- <button type="button" className={styles.paneHeadBtn} onClick={onShowCaptions}>- {ts("captions.turnOn")}- </button>- ) : null}- <Popover open={open} onOpenChange={setOpen}>- <PopoverTrigger asChild>- <button type="button" className={styles.paneHeadBtn} aria-expanded={open}>- <CaptionsIcon size={14} />- {ts("facets.captions")}- </button>- </PopoverTrigger>- <PopoverContent- align="end"- side="bottom"- sideOffset={8}- collisionPadding={16}- animated={false}- className="w-auto border-0 bg-transparent p-0 shadow-none z-50"- >- <div className={styles.captionsPopover}>- <CaptionsPane onClose={() => setOpen(false)} />- </div>- </PopoverContent>- </Popover>- </>+ <button type="button" className={styles.paneHeadBtn} onClick={onOpen}>+ <CaptionsIcon size={14} />+ {ts("facets.captions")}+ </button>);}@@ -936,6 +901,7 @@ export function TranscriptPane({// engine, nothing attempted) leaves the button worth pressing.const silentMedia = blocked?.reason === "no-audio";const transcriptionLabel = useTranscriptionLabel();+ const [captionsOpen, setCaptionsOpen] = useState(false);const paneBusyLabel = transcriptionBusyLabel(busyView ??(isTranscribing ? { assetId: "", status: "running", phase: "loading-model" } : undefined),@@ -949,13 +915,15 @@ export function TranscriptPane({insertionsEnabled() ? "transcript.editingHintDev" : "transcript.editingHint",);+ if (captionsOpen) return <CaptionsPane onClose={() => setCaptionsOpen(false)} />;+if (placements.length === 0 || !hasAnyTranscript) {return (<Panetitle={ts("transcript.title")}icon={<FileText size={16} />}helpText={helpText}- actions={<CaptionSettingsButton />}+ actions={<CaptionSettingsButton onOpen={() => setCaptionsOpen(true)} />}>{laneSwitch}<div@@ -1001,22 +969,12 @@ export function TranscriptPane({);}- // Speech, not just segments: a silence-only transcript has nothing to caption.- const hasSpeech = sections.some((section) => transcriptHasSpeech(section.transcript ?? null));return (<Panetitle={ts("transcript.title")}icon={<FileText size={16} />}helpText={helpText}- actions={- <CaptionSettingsButton- onShowCaptions={- hasSpeech && !captionSettings.enabled- ? () => void setCaptionSettings({ enabled: true })- : undefined- }- />- }+ actions={<CaptionSettingsButton onOpen={() => setCaptionsOpen(true)} />}>{laneSwitch}{/* The gestures are invisible until tried: nothing on a plain word stream saysdiff --git a/src/components/ai-edition/TranscriptPane.captions.test.tsx b/src/components/ai-edition/TranscriptPane.captions.test.tsxindex 39732f61b..59a76fe98 100644--- a/src/components/ai-edition/TranscriptPane.captions.test.tsx+++ b/src/components/ai-edition/TranscriptPane.captions.test.tsx@@ -10,7 +10,7 @@// settings at all — and it really does open the pane, not a rebuilt stub of it.import "@testing-library/jest-dom";-import { cleanup, render, screen, within } from "@testing-library/react";+import { cleanup, render, screen } from "@testing-library/react";import userEvent from "@testing-library/user-event";import { afterEach, describe, expect, it, vi } from "vitest";import { I18nProvider } from "@/contexts/I18nContext";@@ -96,26 +96,23 @@ describe("caption settings on the transcript tab", () => {expect(screen.getByRole("button", { name: "Captions" })).toBeInTheDocument();});- it("opens the real caption settings rather than a stub", async () => {+ it("opens the real caption settings in place of the transcript", async () => {const user = userEvent.setup();mount([TRANSCRIPT]);await user.click(screen.getByRole("button", { name: "Captions" }));// A control that only the actual CaptionsPane renders — proof the pane was- // mounted whole rather than reimplemented into the popover.- const settings = await screen.findByRole("dialog");- expect(within(settings).getByText("Show captions")).toBeInTheDocument();+ // mounted whole rather than reimplemented.+ expect(screen.getByText("Show captions")).toBeInTheDocument();+ // It takes the transcript's slot in the inspector, not a spot beside it.+ expect(screen.queryByRole("heading", { name: "Transcript" })).not.toBeInTheDocument();});- it("renders a close button and closes the popover when clicked", async () => {+ it("goes back to the transcript when closed", async () => {const user = userEvent.setup();mount([TRANSCRIPT]);await user.click(screen.getByRole("button", { name: "Captions" }));- const settings = await screen.findByRole("dialog");- expect(within(settings).getByText("Show captions")).toBeInTheDocument();-- const closeBtn = within(settings).getByRole("button", { name: "Close" });- expect(closeBtn).toBeInTheDocument();- await user.click(closeBtn);- expect(screen.queryByRole("dialog")).not.toBeInTheDocument();+ await user.click(screen.getByRole("button", { name: "Close" }));+ expect(screen.queryByText("Show captions")).not.toBeInTheDocument();+ expect(screen.getByRole("heading", { name: "Transcript" })).toBeInTheDocument();});});diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.jsonindex a552861dc..38f7d10aa 100644--- a/src/i18n/locales/ar/settings.json+++ b/src/i18n/locales/ar/settings.json@@ -253,8 +253,7 @@"minimal": "بسيط","light": "فاتح"},- "customize": "تخصيص",- "turnOn": "إظهار الترجمة"+ "customize": "تخصيص"},"panes": {"help": "مساعدة"diff --git a/src/i18n/locales/cs/settings.json b/src/i18n/locales/cs/settings.jsonindex 0ed74d98f..64a0941b5 100644--- a/src/i18n/locales/cs/settings.json+++ b/src/i18n/locales/cs/settings.json@@ -253,8 +253,7 @@"minimal": "Minimální","light": "Světlý"},- "customize": "Upravit",- "turnOn": "Zobrazit titulky"+ "customize": "Upravit"},"panes": {"help": "Nápověda"diff --git a/src/i18n/locales/de/settings.json b/src/i18n/locales/de/settings.jsonindex 4dea49a00..8a069bbd3 100644--- a/src/i18n/locales/de/settings.json+++ b/src/i18n/locales/de/settings.json@@ -253,8 +253,7 @@"minimal": "Minimal","light": "Hell"},- "customize": "Anpassen",- "turnOn": "Untertitel anzeigen"+ "customize": "Anpassen"},"panes": {"help": "Hilfe"diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.jsonindex 26272387b..341a3ccf3 100644--- a/src/i18n/locales/en/settings.json+++ b/src/i18n/locales/en/settings.json@@ -253,8 +253,7 @@"minimal": "Minimal","light": "Light"},- "customize": "Customize",- "turnOn": "Show captions"+ "customize": "Customize"},"panes": {"help": "Help"diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.jsonindex 7b84f369d..3b86b668b 100644--- a/src/i18n/locales/es/settings.json+++ b/src/i18n/locales/es/settings.json@@ -253,8 +253,7 @@"minimal": "Minimalista","light": "Claro"},- "customize": "Personalizar",- "turnOn": "Mostrar subtítulos"+ "customize": "Personalizar"},"panes": {"help": "Ayuda"diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.jsonindex d1f7da9d6..bb49313e9 100644--- a/src/i18n/locales/fr/settings.json+++ b/src/i18n/locales/fr/settings.json@@ -253,8 +253,7 @@"minimal": "Minimal","light": "Clair"},- "customize": "Personnaliser",- "turnOn": "Afficher les sous-titres"+ "customize": "Personnaliser"},"panes": {"help": "Aide"diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.jsonindex d716ce026..4217fada4 100644--- a/src/i18n/locales/it/settings.json+++ b/src/i18n/locales/it/settings.json@@ -253,8 +253,7 @@"minimal": "Minimale","light": "Chiaro"},- "customize": "Personalizza",- "turnOn": "Mostra sottotitoli"+ "customize": "Personalizza"},"panes": {"help": "Aiuto"diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.jsonindex 168f4836c..23d7b70ae 100644--- a/src/i18n/locales/ja-JP/settings.json+++ b/src/i18n/locales/ja-JP/settings.json@@ -253,8 +253,7 @@"minimal": "ミニマル","light": "ライト"},- "customize": "カスタマイズ",- "turnOn": "字幕を表示"+ "customize": "カスタマイズ"},"panes": {"help": "ヘルプ"diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.jsonindex 408f52656..ffcb06399 100644--- a/src/i18n/locales/ko-KR/settings.json+++ b/src/i18n/locales/ko-KR/settings.json@@ -253,8 +253,7 @@"minimal": "미니멀","light": "밝게"},- "customize": "사용자 지정",- "turnOn": "자막 표시"+ "customize": "사용자 지정"},"panes": {"help": "도움말"diff --git a/src/i18n/locales/pt-BR/settings.json b/src/i18n/locales/pt-BR/settings.jsonindex 252217847..55fab2fa0 100644--- a/src/i18n/locales/pt-BR/settings.json+++ b/src/i18n/locales/pt-BR/settings.json@@ -253,8 +253,7 @@"minimal": "Minimalista","light": "Claro"},- "customize": "Personalizar",- "turnOn": "Mostrar legendas"+ "customize": "Personalizar"},"panes": {"help": "Ajuda"diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.jsonindex 44d880afc..3b79b5c7e 100644--- a/src/i18n/locales/ru/settings.json+++ b/src/i18n/locales/ru/settings.json@@ -253,8 +253,7 @@"minimal": "Минимальный","light": "Светлый"},- "customize": "Настроить",- "turnOn": "Показать субтитры"+ "customize": "Настроить"},"panes": {"help": "Справка"diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.jsonindex 6b542a780..f4b1dafce 100644--- a/src/i18n/locales/tr/settings.json+++ b/src/i18n/locales/tr/settings.json@@ -253,8 +253,7 @@"minimal": "Minimal","light": "Açık"},- "customize": "Özelleştir",- "turnOn": "Altyazıları göster"+ "customize": "Özelleştir"},"panes": {"help": "Yardım"diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.jsonindex 170f1751a..a5805df33 100644--- a/src/i18n/locales/vi/settings.json+++ b/src/i18n/locales/vi/settings.json@@ -253,8 +253,7 @@"minimal": "Tối giản","light": "Sáng"},- "customize": "Tùy chỉnh",- "turnOn": "Hiện phụ đề"+ "customize": "Tùy chỉnh"},"panes": {"help": "Trợ giúp"diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.jsonindex 85287f549..6852537bd 100644--- a/src/i18n/locales/zh-CN/settings.json+++ b/src/i18n/locales/zh-CN/settings.json@@ -253,8 +253,7 @@"minimal": "简约","light": "浅色"},- "customize": "自定义",- "turnOn": "显示字幕"+ "customize": "自定义"},"panes": {"help": "帮助"diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.jsonindex 882d8881f..3de673465 100644--- a/src/i18n/locales/zh-TW/settings.json+++ b/src/i18n/locales/zh-TW/settings.json@@ -253,8 +253,7 @@"minimal": "簡約","light": "淺色"},- "customize": "自訂",- "turnOn": "顯示字幕"+ "customize": "自訂"},"panes": {"help": "說明"