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(notes): make the mirrored note read-only
My-Denia84672161a39c
diff --git a/src/components/launch/NotesToolbar.test.tsx b/src/components/launch/NotesToolbar.test.tsxindex 9ac483ccb..3ee81d6b3 100644--- a/src/components/launch/NotesToolbar.test.tsx+++ b/src/components/launch/NotesToolbar.test.tsx@@ -47,6 +47,7 @@ function createProps(overrides: Partial<NotesToolbarProps> = {}): NotesToolbarPrreturn {editor: createEditor(),isPlaying: false,+ formattingDisabled: false,speed: 40,fontSize: 16,mirrored: false,@@ -154,8 +155,9 @@ describe("NotesToolbar teleprompter controls", () => {);});- it("locks formatting while the teleprompter scrolls", () => {- renderToolbar(createProps({ isPlaying: true }));+ it("locks formatting when the note is locked, keeping teleprompter controls live", () => {+ // formattingDisabled without isPlaying is the mirrored-while-paused case.+ renderToolbar(createProps({ formattingDisabled: true }));// Sweep the whole row rather than a hand-written list, so a formatting button added// later cannot quietly escape the lock.@@ -167,9 +169,12 @@ describe("NotesToolbar teleprompter controls", () => {expect(button).toBeDisabled();}- // Teleprompter controls stay live so playback can always be stopped.- expect(screen.getByRole("button", { name: "Pause auto-scroll" })).toBeEnabled();+ // Teleprompter controls stay live so the lock can always be lifted, and the play+ // button's label keeps tracking isPlaying alone rather than the lock.+ expect(screen.getByRole("button", { name: "Start auto-scroll" })).toBeEnabled();expect(screen.getByRole("button", { name: "Mirror horizontally" })).toBeEnabled();+ expect(screen.getByRole("button", { name: "Decrease scroll speed" })).toBeEnabled();+ expect(screen.getByRole("button", { name: "Increase font size" })).toBeEnabled();});it("formats readout values for the active locale", () => {@@ -193,6 +198,7 @@ function ToolbarHarness() {{...createProps({isPlaying,mirrored,+ formattingDisabled: isPlaying || mirrored,onTogglePlaying: () => setIsPlaying((current) => !current),onToggleMirror: () => setMirrored((current) => !current),})}diff --git a/src/components/launch/NotesToolbar.tsx b/src/components/launch/NotesToolbar.tsxindex c51c42e2a..ce8e9cc0b 100644--- a/src/components/launch/NotesToolbar.tsx+++ b/src/components/launch/NotesToolbar.tsx@@ -27,6 +27,8 @@ import {export type NotesToolbarProps = {editor: Editor | null;isPlaying: boolean;+ /** True while the note body rejects edits (playback or mirroring); disables formatting only. */+ formattingDisabled: boolean;speed: number;fontSize: number;mirrored: boolean;@@ -109,6 +111,7 @@ function useEditorRevision(editor: Editor | null): void {export function NotesToolbar({editor,isPlaying,+ formattingDisabled,speed,fontSize,mirrored,@@ -137,7 +140,7 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.bold")}tooltipContent={t("tooltips.notesToolbar.bold")}active={editor?.isActive("bold") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleBold().run()}+ disabled={formattingDisabled || !editor?.can().chain().focus().toggleBold().run()}onClick={() => editor?.chain().focus().toggleBold().run()}><Bold size={16} />@@ -146,7 +149,7 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.italic")}tooltipContent={t("tooltips.notesToolbar.italic")}active={editor?.isActive("italic") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleItalic().run()}+ disabled={formattingDisabled || !editor?.can().chain().focus().toggleItalic().run()}onClick={() => editor?.chain().focus().toggleItalic().run()}><Italic size={16} />@@ -155,7 +158,7 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.strikethrough")}tooltipContent={t("tooltips.notesToolbar.strikethrough")}active={editor?.isActive("strike") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleStrike().run()}+ disabled={formattingDisabled || !editor?.can().chain().focus().toggleStrike().run()}onClick={() => editor?.chain().focus().toggleStrike().run()}><Strikethrough size={16} />@@ -169,7 +172,9 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.bulletList")}tooltipContent={t("tooltips.notesToolbar.bulletList")}active={editor?.isActive("bulletList") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleBulletList().run()}+ disabled={+ formattingDisabled || !editor?.can().chain().focus().toggleBulletList().run()+ }onClick={() => editor?.chain().focus().toggleBulletList().run()}><List size={16} />@@ -178,7 +183,9 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.numberedList")}tooltipContent={t("tooltips.notesToolbar.numberedList")}active={editor?.isActive("orderedList") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleOrderedList().run()}+ disabled={+ formattingDisabled || !editor?.can().chain().focus().toggleOrderedList().run()+ }onClick={() => editor?.chain().focus().toggleOrderedList().run()}><ListOrdered size={16} />@@ -192,7 +199,9 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.blockquote")}tooltipContent={t("tooltips.notesToolbar.blockquote")}active={editor?.isActive("blockquote") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleBlockquote().run()}+ disabled={+ formattingDisabled || !editor?.can().chain().focus().toggleBlockquote().run()+ }onClick={() => editor?.chain().focus().toggleBlockquote().run()}><Quote size={16} />@@ -201,7 +210,9 @@ export function NotesToolbar({aria-label={t("tooltips.notesToolbar.codeBlock")}tooltipContent={t("tooltips.notesToolbar.codeBlock")}active={editor?.isActive("codeBlock") ?? false}- disabled={isPlaying || !editor?.can().chain().focus().toggleCodeBlock().run()}+ disabled={+ formattingDisabled || !editor?.can().chain().focus().toggleCodeBlock().run()+ }onClick={() => editor?.chain().focus().toggleCodeBlock().run()}><Code size={16} />diff --git a/src/components/launch/NotesWindow.test.tsx b/src/components/launch/NotesWindow.test.tsxindex aacdb107e..44ff92454 100644--- a/src/components/launch/NotesWindow.test.tsx+++ b/src/components/launch/NotesWindow.test.tsx@@ -266,6 +266,74 @@ describe("NotesWindow teleprompter mode", () => {expect(screen.getByRole("button", { name: "Bold" })).toBeEnabled();});+ it("locks the note in every mirrored or playing state and unlocks only when both end", async () => {+ const user = userEvent.setup();+ render(<NotesWindow />);+ const bold = () => screen.getByRole("button", { name: "Bold" });++ // Not playing, not mirrored: editable.+ expect(setEditable).toHaveBeenLastCalledWith(true, false);+ expect(bold()).toBeEnabled();++ // Not playing, mirrored: locked.+ await user.click(screen.getByRole("button", { name: "Mirror" }));+ expect(setEditable).toHaveBeenLastCalledWith(false, false);+ expect(bold()).toBeDisabled();++ // Playing, mirrored: locked.+ await user.click(screen.getByRole("button", { name: "Play" }));+ expect(setEditable).toHaveBeenLastCalledWith(false, false);+ expect(bold()).toBeDisabled();++ // Paused again but still mirrored: stays locked.+ await user.click(screen.getByRole("button", { name: "Pause" }));+ expect(setEditable).toHaveBeenLastCalledWith(false, false);+ expect(bold()).toBeDisabled();++ // The teleprompter controls stay usable while the note is locked.+ const content = screen.getByTestId("notes-teleprompter-content");+ await user.click(screen.getByRole("button", { name: "Increase font size" }));+ expect(content).toHaveStyle({ fontSize: "18px" });++ // Unmirrored while paused: editable again.+ await user.click(screen.getByRole("button", { name: "Mirror" }));+ expect(setEditable).toHaveBeenLastCalledWith(true, false);+ expect(bold()).toBeEnabled();++ // None of the state flips wrote note content.+ expect(localStorage.getItem("notes")).toBeNull();+ });++ it("locks the note from the first render when a mirrored setting is restored", () => {+ localStorage.setItem(+ NOTES_TELEPROMPTER_STORAGE_KEY,+ JSON.stringify({ speed: 40, fontSize: 16, mirrored: true }),+ );+ render(<NotesWindow />);++ expect(setEditable).toHaveBeenLastCalledWith(false, false);+ expect(setEditable).not.toHaveBeenCalledWith(true, false);+ expect(screen.getByRole("button", { name: "Bold" })).toBeDisabled();+ // A restored mirror must not auto-start playback.+ expect(screen.getByRole("button", { name: "Play" })).toBeInTheDocument();+ });++ it("keeps mirroring and playback independent", async () => {+ const user = userEvent.setup();+ render(<NotesWindow />);+ const content = screen.getByTestId("notes-teleprompter-content");++ // Mirroring must not start playback.+ await user.click(screen.getByRole("button", { name: "Mirror" }));+ expect(screen.getByRole("button", { name: "Play" })).toBeInTheDocument();+ expect(content).toHaveAttribute("data-mirrored", "true");++ // Pausing must not unmirror.+ await user.click(screen.getByRole("button", { name: "Play" }));+ await user.click(screen.getByRole("button", { name: "Pause" }));+ expect(content).toHaveAttribute("data-mirrored", "true");+ });+it("applies and persists font and mirror settings without persisting playback", async () => {const user = userEvent.setup();render(<NotesWindow />);diff --git a/src/components/launch/NotesWindow.tsx b/src/components/launch/NotesWindow.tsxindex ab042f91f..b16c3a168 100644--- a/src/components/launch/NotesWindow.tsx+++ b/src/components/launch/NotesWindow.tsx@@ -49,13 +49,17 @@ export function NotesWindow() {saveNotesTeleprompterSettings(settings);}, [settings]);- // Typing during playback makes ProseMirror scroll the caret back into view, which fights- // the teleprompter. Reading is the only sensible mode while it scrolls, so the note goes- // read-only and the toolbar disables formatting for as long as playback runs.+ // Whether the note body currently rejects edits. Playback locks it because typing makes+ // ProseMirror scroll the caret back into view, which fights the teleprompter. Mirroring+ // locks it because caret placement and selection are horizontally reversed on screen, so+ // the mirrored note is presentation-only. The teleprompter controls themselves stay live+ // in both states; turning the lock's last reason off restores editing.+ const editingLocked = isPlaying || settings.mirrored;+// `emitUpdate: false` — the content did not change, so there is nothing to persist.useEffect(() => {- editor?.setEditable(!isPlaying, false);- }, [editor, isPlaying]);+ editor?.setEditable(!editingLocked, false);+ }, [editor, editingLocked]);useEffect(() => {if (!isPlaying || !editor) {@@ -127,6 +131,7 @@ export function NotesWindow() {<NotesToolbareditor={editor}isPlaying={isPlaying}+ formattingDisabled={editingLocked}speed={settings.speed}fontSize={settings.fontSize}mirrored={settings.mirrored}