Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(notes): address review findings on teleprompter mode

Etienne Lescote383f9bec5ba
diff --git a/src/components/launch/NotesToolbar.browser.test.tsx b/src/components/launch/NotesToolbar.browser.test.tsx
deleted file mode 100644
index f1bbfb90a..000000000
--- a/src/components/launch/NotesToolbar.browser.test.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-import "@/index.css";
-import type { Editor } from "@tiptap/react";
-import { userEvent } from "@vitest/browser/context";
-import { useState } from "react";
-import { flushSync } from "react-dom";
-import { createRoot, type Root } from "react-dom/client";
-import { afterEach, describe, expect, it, vi } from "vitest";
-import { NotesToolbar } from "./NotesToolbar";
-
-vi.mock("@/components/ui/tooltip", () => ({
- Tooltip: ({ children }: { children: React.ReactNode }) => children,
-}));
-
-vi.mock("@/contexts/I18nContext", () => ({
- useI18n: () => ({ locale: "en" }),
- useScopedT: () => (key: string, vars?: Record<string, string | number>) => {
- const labels: Record<string, string> = {
- "tooltips.notesToolbar.play": "Play",
- "tooltips.notesToolbar.pause": "Pause",
- "tooltips.notesToolbar.speed": "Scroll speed",
- "tooltips.notesToolbar.decreaseSpeed": "Decrease scroll speed",
- "tooltips.notesToolbar.increaseSpeed": "Increase scroll speed",
- "tooltips.notesToolbar.fontSize": "Font size",
- "tooltips.notesToolbar.decreaseFontSize": "Decrease font size",
- "tooltips.notesToolbar.increaseFontSize": "Increase font size",
- "tooltips.notesToolbar.mirror": "Mirror",
- "units.pixelsPerSecond": "{{value}} px/s",
- "units.pixels": "{{value}} px",
- };
- return (labels[key] ?? key).replace(/\{\{(\w+)\}\}/g, (_, name: string) =>
- String(vars?.[name] ?? `{{${name}}}`),
- );
- },
-}));
-
-function createEditor(): Editor {
- const chain: Record<string, ReturnType<typeof vi.fn>> = {};
- for (const command of [
- "focus",
- "toggleBold",
- "toggleItalic",
- "toggleStrike",
- "toggleBulletList",
- "toggleOrderedList",
- "toggleBlockquote",
- "toggleCodeBlock",
- ]) {
- chain[command] = vi.fn(() => chain);
- }
- chain.run = vi.fn(() => true);
-
- return {
- can: () => ({ chain: () => chain }),
- chain: () => chain,
- isActive: () => false,
- on: vi.fn(),
- off: vi.fn(),
- } as unknown as Editor;
-}
-
-function ToolbarHarness() {
- const [isPlaying, setIsPlaying] = useState(false);
- const [speed, setSpeed] = useState(40);
- const [fontSize, setFontSize] = useState(16);
- const [mirrored, setMirrored] = useState(false);
-
- return (
- <NotesToolbar
- editor={createEditor()}
- isPlaying={isPlaying}
- speed={speed}
- fontSize={fontSize}
- mirrored={mirrored}
- onTogglePlaying={() => setIsPlaying((current) => !current)}
- onDecreaseSpeed={() => setSpeed((current) => current - 10)}
- onIncreaseSpeed={() => setSpeed((current) => current + 10)}
- onDecreaseFontSize={() => setFontSize((current) => current - 2)}
- onIncreaseFontSize={() => setFontSize((current) => current + 2)}
- onToggleMirror={() => setMirrored((current) => !current)}
- />
- );
-}
-
-describe("NotesToolbar narrow-width reachability", () => {
- let root: Root | null = null;
- let host: HTMLDivElement | null = null;
-
- afterEach(() => {
- root?.unmount();
- host?.remove();
- root = null;
- host = null;
- });
-
- it("keeps every teleprompter control reachable at a severe 160px width", async () => {
- host = document.createElement("div");
- host.style.width = "160px";
- document.body.append(host);
- root = createRoot(host);
- flushSync(() => root?.render(<ToolbarHarness />));
-
- const row = host.querySelector<HTMLElement>('[data-testid="notes-teleprompter-controls"]');
- const controls = Array.from(
- host.querySelectorAll<HTMLButtonElement>("[data-teleprompter-control]"),
- );
- if (!row || controls.length === 0) {
- throw new Error("Teleprompter controls did not render");
- }
-
- expect(row.scrollWidth).toBeGreaterThan(row.clientWidth);
- await userEvent.wheel(row, { delta: { x: row.scrollWidth } });
- await new Promise(requestAnimationFrame);
- expect(row.scrollLeft).toBeGreaterThan(0);
-
- const rowRect = row.getBoundingClientRect();
- const lastRect = controls.at(-1)?.getBoundingClientRect();
- expect(lastRect).toBeDefined();
- expect(lastRect!.left).toBeGreaterThanOrEqual(rowRect.left - 1);
- expect(lastRect!.right).toBeLessThanOrEqual(rowRect.right + 1);
-
- controls[0]?.focus();
- expect(document.activeElement).toBe(controls[0]);
- for (let index = 1; index < controls.length; index++) {
- await userEvent.tab();
- expect(document.activeElement).toBe(controls[index]);
- }
-
- controls[0]?.focus();
- await userEvent.keyboard("{Enter}");
- expect(controls[0]?.getAttribute("aria-label")).toBe("Pause");
-
- const mirror = controls.at(-1)!;
- await userEvent.click(mirror);
- expect(mirror.getAttribute("aria-pressed")).toBe("true");
- });
-});
diff --git a/src/components/launch/NotesToolbar.test.tsx b/src/components/launch/NotesToolbar.test.tsx
index 6564b60d2..9ac483ccb 100644
--- a/src/components/launch/NotesToolbar.test.tsx
+++ b/src/components/launch/NotesToolbar.test.tsx
@@ -2,15 +2,22 @@ import "@testing-library/jest-dom";
import { render, screen, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import type { Editor } from "@tiptap/react";
-import { type ReactNode, useLayoutEffect } from "react";
-import { describe, expect, it, vi } from "vitest";
+import { type ReactNode, useLayoutEffect, useState } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import { I18nProvider, useI18n } from "@/contexts/I18nContext";
+import { LOCALE_STORAGE_KEY } from "@/i18n/config";
import { NotesToolbar, type NotesToolbarProps } from "./NotesToolbar";
vi.mock("@/components/ui/tooltip", () => ({
Tooltip: ({ children }: { children: React.ReactNode }) => children,
}));
+beforeEach(() => {
+ // `setLocale` persists its choice, and `I18nProvider` reads it back on mount — without
+ // this, the one test that switches language would leak into every test after it.
+ localStorage.removeItem(LOCALE_STORAGE_KEY);
+});
+
function createEditor(): Editor {
const chain: Record<string, ReturnType<typeof vi.fn>> = {};
for (const command of [
@@ -131,6 +138,40 @@ describe("NotesToolbar teleprompter controls", () => {
expect(screen.queryByRole("button", { name: "Pause auto-scroll" })).not.toBeInTheDocument();
});
+ it("announces playback through its label rather than a second pressed state", () => {
+ const { rerender } = renderToolbar(createProps());
+ expect(screen.getByRole("button", { name: "Start auto-scroll" })).not.toHaveAttribute(
+ "aria-pressed",
+ );
+
+ rerender(
+ <I18nProvider>
+ <NotesToolbar {...createProps({ isPlaying: true })} />
+ </I18nProvider>,
+ );
+ expect(screen.getByRole("button", { name: "Pause auto-scroll" })).not.toHaveAttribute(
+ "aria-pressed",
+ );
+ });
+
+ it("locks formatting while the teleprompter scrolls", () => {
+ renderToolbar(createProps({ isPlaying: true }));
+
+ // Sweep the whole row rather than a hand-written list, so a formatting button added
+ // later cannot quietly escape the lock.
+ const formatting = within(screen.getByTestId("notes-formatting-controls")).getAllByRole(
+ "button",
+ );
+ expect(formatting).toHaveLength(7);
+ for (const button of formatting) {
+ expect(button).toBeDisabled();
+ }
+
+ // Teleprompter controls stay live so playback can always be stopped.
+ expect(screen.getByRole("button", { name: "Pause auto-scroll" })).toBeEnabled();
+ expect(screen.getByRole("button", { name: "Mirror horizontally" })).toBeEnabled();
+ });
+
it("formats readout values for the active locale", () => {
renderToolbar(createProps(), "ar");
const speed = within(screen.getByRole("group", { name: "سرعة التمرير" })).getByRole("status");
@@ -142,3 +183,52 @@ describe("NotesToolbar teleprompter controls", () => {
expect(fontSize).toHaveTextContent(`${new Intl.NumberFormat("ar").format(16)} بكسل`);
});
});
+
+function ToolbarHarness() {
+ const [isPlaying, setIsPlaying] = useState(false);
+ const [mirrored, setMirrored] = useState(false);
+
+ return (
+ <NotesToolbar
+ {...createProps({
+ isPlaying,
+ mirrored,
+ onTogglePlaying: () => setIsPlaying((current) => !current),
+ onToggleMirror: () => setMirrored((current) => !current),
+ })}
+ />
+ );
+}
+
+describe("NotesToolbar keyboard reachability", () => {
+ it("walks every teleprompter control in order and toggles them from the keyboard", async () => {
+ const user = userEvent.setup();
+ const { container } = render(
+ <I18nProvider>
+ <ToolbarHarness />
+ </I18nProvider>,
+ );
+
+ const row = container.querySelector<HTMLElement>('[data-testid="notes-teleprompter-controls"]');
+ const controls = Array.from(
+ container.querySelectorAll<HTMLButtonElement>("[data-teleprompter-control]"),
+ );
+ expect(row).not.toBeNull();
+ expect(controls).toHaveLength(6);
+
+ controls[0]?.focus();
+ expect(document.activeElement).toBe(controls[0]);
+ for (let index = 1; index < controls.length; index++) {
+ await user.tab();
+ expect(document.activeElement).toBe(controls[index]);
+ }
+
+ controls[0]?.focus();
+ await user.keyboard("{Enter}");
+ expect(controls[0]).toHaveAttribute("aria-label", "Pause auto-scroll");
+
+ const mirror = controls.at(-1);
+ await user.click(mirror as HTMLButtonElement);
+ expect(mirror).toHaveAttribute("aria-pressed", "true");
+ });
+});
diff --git a/src/components/launch/NotesToolbar.tsx b/src/components/launch/NotesToolbar.tsx
index 0fd14e3e0..c51c42e2a 100644
--- a/src/components/launch/NotesToolbar.tsx
+++ b/src/components/launch/NotesToolbar.tsx
@@ -41,7 +41,13 @@ export type NotesToolbarProps = {
type ToolbarButtonProps = {
"aria-label": string;
tooltipContent: string;
+ /** Toggle state: drives both `aria-pressed` and the pressed styling. */
active?: boolean;
+ /**
+ * Pressed styling without `aria-pressed`, for buttons that already announce their state
+ * through a label that changes with it. Announcing both would say it twice.
+ */
+ highlighted?: boolean;
disabled?: boolean;
teleprompterControl?: boolean;
onClick: () => void;
@@ -52,6 +58,7 @@ function ToolbarButton({
"aria-label": ariaLabel,
tooltipContent,
active,
+ highlighted = false,
disabled = false,
teleprompterControl = false,
onClick,
@@ -68,7 +75,7 @@ function ToolbarButton({
onClick={onClick}
className={cn(
"shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-md border-0 bg-transparent text-gray-700 transition-colors hover:bg-gray-200 hover:text-gray-900 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-violet-600 disabled:cursor-not-allowed disabled:opacity-35",
- active && "bg-gray-900 text-white hover:bg-gray-800 hover:text-white",
+ (active || highlighted) && "bg-gray-900 text-white hover:bg-gray-800 hover:text-white",
)}
>
{children}
@@ -115,13 +122,14 @@ export function NotesToolbar({
useEditorRevision(editor);
const { locale } = useI18n();
const t = useScopedT("launch");
+ const tCommon = useScopedT("common");
const numberFormatter = useMemo(() => new Intl.NumberFormat(locale), [locale]);
return (
<div className="flex w-full min-w-0 max-w-full flex-col gap-1.5 rounded-[0.625rem] border border-gray-200 bg-gray-50 p-1.5">
<div
data-testid="notes-formatting-controls"
- className="flex w-full min-w-0 items-center overflow-x-auto"
+ className="flex w-full min-w-0 items-center overflow-x-auto no-scrollbar"
>
<div className="flex min-w-max items-center gap-1">
<div className="flex shrink-0 items-center gap-1">
@@ -129,7 +137,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.bold")}
tooltipContent={t("tooltips.notesToolbar.bold")}
active={editor?.isActive("bold") ?? false}
- disabled={!editor?.can().chain().focus().toggleBold().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleBold().run()}
onClick={() => editor?.chain().focus().toggleBold().run()}
>
<Bold size={16} />
@@ -138,7 +146,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.italic")}
tooltipContent={t("tooltips.notesToolbar.italic")}
active={editor?.isActive("italic") ?? false}
- disabled={!editor?.can().chain().focus().toggleItalic().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleItalic().run()}
onClick={() => editor?.chain().focus().toggleItalic().run()}
>
<Italic size={16} />
@@ -147,7 +155,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.strikethrough")}
tooltipContent={t("tooltips.notesToolbar.strikethrough")}
active={editor?.isActive("strike") ?? false}
- disabled={!editor?.can().chain().focus().toggleStrike().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleStrike().run()}
onClick={() => editor?.chain().focus().toggleStrike().run()}
>
<Strikethrough size={16} />
@@ -161,7 +169,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.bulletList")}
tooltipContent={t("tooltips.notesToolbar.bulletList")}
active={editor?.isActive("bulletList") ?? false}
- disabled={!editor?.can().chain().focus().toggleBulletList().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleBulletList().run()}
onClick={() => editor?.chain().focus().toggleBulletList().run()}
>
<List size={16} />
@@ -170,7 +178,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.numberedList")}
tooltipContent={t("tooltips.notesToolbar.numberedList")}
active={editor?.isActive("orderedList") ?? false}
- disabled={!editor?.can().chain().focus().toggleOrderedList().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleOrderedList().run()}
onClick={() => editor?.chain().focus().toggleOrderedList().run()}
>
<ListOrdered size={16} />
@@ -184,7 +192,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.blockquote")}
tooltipContent={t("tooltips.notesToolbar.blockquote")}
active={editor?.isActive("blockquote") ?? false}
- disabled={!editor?.can().chain().focus().toggleBlockquote().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleBlockquote().run()}
onClick={() => editor?.chain().focus().toggleBlockquote().run()}
>
<Quote size={16} />
@@ -193,7 +201,7 @@ export function NotesToolbar({
aria-label={t("tooltips.notesToolbar.codeBlock")}
tooltipContent={t("tooltips.notesToolbar.codeBlock")}
active={editor?.isActive("codeBlock") ?? false}
- disabled={!editor?.can().chain().focus().toggleCodeBlock().run()}
+ disabled={isPlaying || !editor?.can().chain().focus().toggleCodeBlock().run()}
onClick={() => editor?.chain().focus().toggleCodeBlock().run()}
>
<Code size={16} />
@@ -204,7 +212,7 @@ export function NotesToolbar({
<div
data-testid="notes-teleprompter-controls"
- className="flex w-full min-w-0 items-center overflow-x-auto"
+ className="flex w-full min-w-0 items-center overflow-x-auto no-scrollbar"
>
<div className="flex min-w-max items-center gap-1">
<ToolbarButton
@@ -212,7 +220,7 @@ export function NotesToolbar({
tooltipContent={t(
isPlaying ? "tooltips.notesToolbar.pause" : "tooltips.notesToolbar.play",
)}
- active={isPlaying}
+ highlighted={isPlaying}
disabled={!editor}
teleprompterControl
onClick={onTogglePlaying}
@@ -235,7 +243,7 @@ export function NotesToolbar({
<Minus size={16} />
</ToolbarButton>
<output className="min-w-14 text-center text-xs tabular-nums text-gray-700">
- {t("units.pixelsPerSecond", { value: numberFormatter.format(speed) })}
+ {tCommon("units.pixelsPerSecond", { value: numberFormatter.format(speed) })}
</output>
<ToolbarButton
aria-label={t("tooltips.notesToolbar.increaseSpeed")}
@@ -263,7 +271,7 @@ export function NotesToolbar({
<Minus size={16} />
</ToolbarButton>
<output className="min-w-10 text-center text-xs tabular-nums text-gray-700">
- {t("units.pixels", { value: numberFormatter.format(fontSize) })}
+ {tCommon("units.pixels", { value: numberFormatter.format(fontSize) })}
</output>
<ToolbarButton
aria-label={t("tooltips.notesToolbar.increaseFontSize")}
diff --git a/src/components/launch/NotesWindow.module.css b/src/components/launch/NotesWindow.module.css
index cda0a410a..b5793f25e 100644
--- a/src/components/launch/NotesWindow.module.css
+++ b/src/components/launch/NotesWindow.module.css
@@ -8,10 +8,6 @@
caret-color: #111827;
}
-:global(.notes-teleprompter-content) {
- transform-origin: center;
-}
-
:global(.notes-teleprompter-content[data-mirrored="true"]) {
transform: scaleX(-1);
}
@@ -20,11 +16,16 @@
margin-top: 0;
}
+/*
+ * Spacing is in `em` so it tracks the teleprompter font size the Notes window sets on the
+ * container. Every element below inherits that size, so `em` here equals the container size
+ * and the default 16px rendering is unchanged. Headings are the exception — see below.
+ */
:global(.tiptap) p {
- min-height: 1.5rem;
+ min-height: 1.5em;
line-height: 1.5;
- margin-top: 0.75rem;
- margin-bottom: 0.75rem;
+ margin-top: 0.75em;
+ margin-bottom: 0.75em;
}
:global(.tiptap) p:first-child {
@@ -34,8 +35,8 @@
/* Tailwind preflight strips list markers — restore them for markdown-style input rules. */
:global(.tiptap) ul,
:global(.tiptap) ol {
- padding-left: 1.5rem;
- margin: 1rem 0;
+ padding-left: 1.5em;
+ margin: 1em 0;
}
:global(.tiptap) ul {
@@ -56,6 +57,11 @@
margin-bottom: 0.25em;
}
+/*
+ * Heading margins stay in `rem`: `em` on a heading resolves against the heading's own
+ * enlarged font size, not the container's, so switching them would change the default
+ * rendering rather than just scale it.
+ */
:global(.tiptap) h1,
:global(.tiptap) h2,
:global(.tiptap) h3,
@@ -104,8 +110,8 @@
border-radius: 0.5rem;
color: #ffffff;
font-family: "JetBrainsMono", monospace;
- margin: 1.5rem 0;
- padding: 0.75rem 1rem;
+ margin: 1.5em 0;
+ padding: 0.75em 1em;
}
:global(.tiptap) pre code {
@@ -117,12 +123,12 @@
:global(.tiptap) blockquote {
border-left: 3px solid #d1d5db;
- margin: 1.5rem 0;
- padding-left: 1rem;
+ margin: 1.5em 0;
+ padding-left: 1em;
}
:global(.tiptap) hr {
border: none;
border-top: 1px solid #e5e7eb;
- margin: 2rem 0;
+ margin: 2em 0;
}
diff --git a/src/components/launch/NotesWindow.test.tsx b/src/components/launch/NotesWindow.test.tsx
index 4332bc126..aacdb107e 100644
--- a/src/components/launch/NotesWindow.test.tsx
+++ b/src/components/launch/NotesWindow.test.tsx
@@ -2,6 +2,7 @@ import "@testing-library/jest-dom";
import { act, render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import type { Editor } from "@tiptap/react";
+import { StrictMode } from "react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { NotesWindow } from "./NotesWindow";
import { NOTES_TELEPROMPTER_STORAGE_KEY } from "./notesTeleprompter";
@@ -35,6 +36,7 @@ vi.mock("@/contexts/I18nContext", () => ({
useI18n: () => ({ locale: "en" }),
useScopedT: () => (key: string, vars?: Record<string, string | number>) => {
const labels: Record<string, string> = {
+ "tooltips.notesToolbar.bold": "Bold",
"tooltips.notesToolbar.play": "Play",
"tooltips.notesToolbar.pause": "Pause",
"tooltips.notesToolbar.speed": "Scroll speed",
@@ -67,6 +69,8 @@ function createStorage(): Storage {
};
}
+const setEditable = vi.fn();
+
function createEditor(scrollElement: HTMLElement): Editor {
const chain: Record<string, ReturnType<typeof vi.fn>> = {};
for (const command of [
@@ -89,10 +93,23 @@ function createEditor(scrollElement: HTMLElement): Editor {
isActive: () => false,
on: vi.fn(),
off: vi.fn(),
+ setEditable,
view: { dom: scrollElement },
} as unknown as Editor;
}
+/** Mimics an engine that stores scroll offsets as whole pixels. */
+function makeScrollTopRounding(element: HTMLElement): void {
+ let value = 0;
+ Object.defineProperty(element, "scrollTop", {
+ configurable: true,
+ get: () => value,
+ set: (next: number) => {
+ value = Math.floor(next);
+ },
+ });
+}
+
describe("NotesWindow teleprompter mode", () => {
let scrollElement: HTMLElement;
let frameCallbacks: Map<number, FrameRequestCallback>;
@@ -114,6 +131,7 @@ describe("NotesWindow teleprompter mode", () => {
value: createStorage(),
configurable: true,
});
+ setEditable.mockClear();
scrollElement = document.createElement("div");
Object.defineProperties(scrollElement, {
@@ -171,7 +189,7 @@ describe("NotesWindow teleprompter mode", () => {
it("stops automatically at the bottom", async () => {
const user = userEvent.setup();
- scrollElement.scrollTop = 99;
+ scrollElement.scrollTop = 96;
render(<NotesWindow />);
await user.click(screen.getByRole("button", { name: "Play" }));
@@ -183,6 +201,71 @@ describe("NotesWindow teleprompter mode", () => {
expect(frameCallbacks.size).toBe(0);
});
+ it("replays from the top when playback starts at the bottom", async () => {
+ const user = userEvent.setup();
+ scrollElement.scrollTop = 100;
+ render(<NotesWindow />);
+
+ await user.click(screen.getByRole("button", { name: "Play" }));
+ expect(scrollElement.scrollTop).toBe(0);
+
+ flushNextFrame(0);
+ flushNextFrame(100);
+
+ expect(scrollElement.scrollTop).toBe(4);
+ expect(screen.getByRole("button", { name: "Pause" })).toBeInTheDocument();
+ });
+
+ it("stays armed when the note is shorter than the window", async () => {
+ const user = userEvent.setup();
+ Object.defineProperties(scrollElement, {
+ scrollHeight: { value: 100, configurable: true },
+ clientHeight: { value: 100, configurable: true },
+ });
+ render(<NotesWindow />);
+
+ await user.click(screen.getByRole("button", { name: "Play" }));
+ flushNextFrame(0);
+ flushNextFrame(100);
+
+ // Nothing to scroll, but the control must not snap back and look broken.
+ expect(scrollElement.scrollTop).toBe(0);
+ expect(screen.getByRole("button", { name: "Pause" })).toBeInTheDocument();
+ expect(frameCallbacks.size).toBe(1);
+ });
+
+ it("keeps advancing when the engine rounds scrollTop to whole pixels", async () => {
+ const user = userEvent.setup();
+ makeScrollTopRounding(scrollElement);
+ render(<NotesWindow />);
+
+ await user.click(screen.getByRole("button", { name: "Play" }));
+
+ // 40 px/s over 16 ms frames is 0.64 px each — every one of them rounds away on its
+ // own, so reading the position back from the DOM would stall the teleprompter.
+ let timestamp = 0;
+ for (let frame = 0; frame <= 5; frame++) {
+ flushNextFrame(timestamp);
+ timestamp += 16;
+ }
+
+ expect(scrollElement.scrollTop).toBe(3);
+ });
+
+ it("makes the note read-only while playing", async () => {
+ const user = userEvent.setup();
+ render(<NotesWindow />);
+ expect(setEditable).toHaveBeenLastCalledWith(true, false);
+
+ await user.click(screen.getByRole("button", { name: "Play" }));
+ expect(setEditable).toHaveBeenLastCalledWith(false, false);
+ expect(screen.getByRole("button", { name: "Bold" })).toBeDisabled();
+
+ await user.click(screen.getByRole("button", { name: "Pause" }));
+ expect(setEditable).toHaveBeenLastCalledWith(true, false);
+ expect(screen.getByRole("button", { name: "Bold" })).toBeEnabled();
+ });
+
it("applies and persists font and mirror settings without persisting playback", async () => {
const user = userEvent.setup();
render(<NotesWindow />);
@@ -190,6 +273,8 @@ describe("NotesWindow teleprompter mode", () => {
expect(content).toHaveStyle({ fontSize: "16px" });
expect(content).toHaveAttribute("data-mirrored", "false");
+ // Loading defaults is not a preference — nothing is stored until a control is used.
+ expect(localStorage.getItem(NOTES_TELEPROMPTER_STORAGE_KEY)).toBeNull();
await user.click(screen.getByRole("button", { name: "Increase font size" }));
await user.click(screen.getByRole("button", { name: "Mirror" }));
@@ -206,6 +291,18 @@ describe("NotesWindow teleprompter mode", () => {
});
});
+ it("still writes nothing on mount when StrictMode double-invokes effects", () => {
+ // The renderer really does mount under StrictMode (see src/main.tsx), so a
+ // "skip the first run" guard would persist defaults on the second invocation.
+ render(
+ <StrictMode>
+ <NotesWindow />
+ </StrictMode>,
+ );
+
+ expect(localStorage.getItem(NOTES_TELEPROMPTER_STORAGE_KEY)).toBeNull();
+ });
+
it("loads legacy note content and saves editor updates", () => {
localStorage.setItem("notes", "First\nSecond");
render(<NotesWindow />);
diff --git a/src/components/launch/NotesWindow.tsx b/src/components/launch/NotesWindow.tsx
index 532f50968..ab042f91f 100644
--- a/src/components/launch/NotesWindow.tsx
+++ b/src/components/launch/NotesWindow.tsx
@@ -1,15 +1,18 @@
import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import { NotesToolbar } from "./NotesToolbar";
import {
clampNotesFontSize,
clampTeleprompterSpeed,
+ getMaxScrollTop,
getNextTeleprompterScrollTop,
getTeleprompterFrame,
+ isAtTeleprompterEnd,
loadInitialNotesContent,
loadNotesTeleprompterSettings,
NOTES_FONT_SIZE_STEP,
+ resolveTeleprompterPosition,
saveNotesContent,
saveNotesTeleprompterSettings,
TELEPROMPTER_SPEED_STEP,
@@ -19,9 +22,10 @@ import "./NotesWindow.module.css";
export function NotesWindow() {
const [settings, setSettings] = useState(loadNotesTeleprompterSettings);
const [isPlaying, setIsPlaying] = useState(false);
+ const [initialContent] = useState(loadInitialNotesContent);
const editor = useEditor({
extensions: [StarterKit],
- content: loadInitialNotesContent(),
+ content: initialContent,
autofocus: "end",
editorProps: {
attributes: {
@@ -33,40 +37,63 @@ export function NotesWindow() {
},
});
+ // Writing back the settings that were just loaded would create the storage key before the
+ // user has touched a single control. Keying off the identity of the initial state rather
+ // than a "has run once" flag keeps that true under StrictMode's double-invoked effects.
+ const loadedSettingsRef = useRef(settings);
useEffect(() => {
+ if (settings === loadedSettingsRef.current) {
+ return;
+ }
+
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.
+ // `emitUpdate: false` — the content did not change, so there is nothing to persist.
+ useEffect(() => {
+ editor?.setEditable(!isPlaying, false);
+ }, [editor, isPlaying]);
+
useEffect(() => {
if (!isPlaying || !editor) {
return;
}
const scrollElement = editor.view.dom;
+
+ // Starting from the bottom — the end of a previous run, or a manual scroll —
+ // replays from the top instead of leaving the play button looking inert.
+ if (isAtTeleprompterEnd(scrollElement.scrollTop, getMaxScrollTop(scrollElement))) {
+ scrollElement.scrollTop = 0;
+ }
+
let frameId: number | null = null;
let previousTimestamp: number | null = null;
+ let position = scrollElement.scrollTop;
const tick = (timestamp: number) => {
const frame = getTeleprompterFrame(previousTimestamp, timestamp);
previousTimestamp = frame.nextTimestamp;
if (frame.elapsedMs > 0) {
- const maximumScrollTop = Math.max(
- 0,
- scrollElement.scrollHeight - scrollElement.clientHeight,
- );
- const nextScrollTop = getNextTeleprompterScrollTop(
- scrollElement.scrollTop,
+ const maximumScrollTop = getMaxScrollTop(scrollElement);
+ position = getNextTeleprompterScrollTop(
+ resolveTeleprompterPosition(position, scrollElement.scrollTop),
settings.speed,
frame.elapsedMs,
maximumScrollTop,
);
- scrollElement.scrollTop = nextScrollTop;
- if (nextScrollTop >= maximumScrollTop) {
+ if (isAtTeleprompterEnd(position, maximumScrollTop)) {
+ scrollElement.scrollTop = maximumScrollTop;
setIsPlaying(false);
return;
}
+
+ scrollElement.scrollTop = position;
}
frameId = requestAnimationFrame(tick);
diff --git a/src/components/launch/notesTeleprompter.test.ts b/src/components/launch/notesTeleprompter.test.ts
index ebdb1d328..56800361b 100644
--- a/src/components/launch/notesTeleprompter.test.ts
+++ b/src/components/launch/notesTeleprompter.test.ts
@@ -3,8 +3,10 @@ import {
clampNotesFontSize,
clampTeleprompterSpeed,
DEFAULT_NOTES_TELEPROMPTER_SETTINGS,
+ getMaxScrollTop,
getNextTeleprompterScrollTop,
getTeleprompterFrame,
+ isAtTeleprompterEnd,
loadInitialNotesContent,
loadNotesTeleprompterSettings,
MAX_NOTES_FONT_SIZE,
@@ -13,8 +15,10 @@ import {
MIN_NOTES_FONT_SIZE,
MIN_TELEPROMPTER_SPEED,
NOTES_TELEPROMPTER_STORAGE_KEY,
+ resolveTeleprompterPosition,
saveNotesContent,
saveNotesTeleprompterSettings,
+ TELEPROMPTER_SCROLL_TOLERANCE_PX,
} from "./notesTeleprompter";
describe("Notes teleprompter settings", () => {
@@ -132,3 +136,42 @@ describe("Notes teleprompter frame math", () => {
expect(getNextTeleprompterScrollTop(Number.NaN, 40, -1, 100)).toBe(0);
});
});
+
+describe("Notes teleprompter scroll position tracking", () => {
+ it("keeps the tracked sub-pixel position when the DOM only rounds it", () => {
+ const tracked = 12.4;
+ expect(resolveTeleprompterPosition(tracked, Math.floor(tracked))).toBe(tracked);
+ expect(resolveTeleprompterPosition(tracked, tracked + TELEPROMPTER_SCROLL_TOLERANCE_PX)).toBe(
+ tracked,
+ );
+ });
+
+ it("hands control back to the DOM once the reader scrolls by hand", () => {
+ expect(resolveTeleprompterPosition(12.4, 300)).toBe(300);
+ expect(resolveTeleprompterPosition(300, 12.4)).toBe(12.4);
+ });
+
+ it("falls back safely for unusable inputs", () => {
+ expect(resolveTeleprompterPosition(12.4, Number.NaN)).toBe(12.4);
+ expect(resolveTeleprompterPosition(Number.NaN, 12.4)).toBe(12.4);
+ expect(resolveTeleprompterPosition(Number.NaN, Number.NaN)).toBe(0);
+ expect(resolveTeleprompterPosition(-5, -5)).toBe(0);
+ });
+
+ it("reports the end only when there is something to scroll", () => {
+ expect(isAtTeleprompterEnd(100, 100)).toBe(true);
+ expect(isAtTeleprompterEnd(100 - TELEPROMPTER_SCROLL_TOLERANCE_PX, 100)).toBe(true);
+ expect(isAtTeleprompterEnd(50, 100)).toBe(false);
+
+ // A note that fits the window has nowhere to go — playback stays armed instead of
+ // snapping straight back to paused.
+ expect(isAtTeleprompterEnd(0, 0)).toBe(false);
+ expect(isAtTeleprompterEnd(0, Number.NaN)).toBe(false);
+ });
+
+ it("derives the scrollable distance without going negative", () => {
+ expect(getMaxScrollTop({ scrollHeight: 200, clientHeight: 100 })).toBe(100);
+ expect(getMaxScrollTop({ scrollHeight: 100, clientHeight: 100 })).toBe(0);
+ expect(getMaxScrollTop({ scrollHeight: 50, clientHeight: 100 })).toBe(0);
+ });
+});
diff --git a/src/components/launch/notesTeleprompter.ts b/src/components/launch/notesTeleprompter.ts
index f4b9f8ad2..c650892fc 100644
--- a/src/components/launch/notesTeleprompter.ts
+++ b/src/components/launch/notesTeleprompter.ts
@@ -10,6 +10,12 @@ export const NOTES_FONT_SIZE_STEP = 2;
export const MAX_TELEPROMPTER_FRAME_MS = 100;
+/**
+ * How far the DOM scroll position may drift from the tracked one before the DOM wins.
+ * Also the slack used to decide the teleprompter has reached the bottom.
+ */
+export const TELEPROMPTER_SCROLL_TOLERANCE_PX = 1;
+
export type NotesTeleprompterSettings = {
speed: number;
fontSize: number;
@@ -165,3 +171,45 @@ export function getNextTeleprompterScrollTop(
return Math.min(safeMaximum, safeCurrent + distance);
}
+
+/**
+ * Playback tracks its own fractional position instead of reading `scrollTop` back every
+ * frame: at the slowest speed a frame advances ~0.17px, and an engine that snaps scroll
+ * offsets to whole pixels would round that away, stalling the teleprompter outright.
+ * The DOM still wins once it drifts beyond the tolerance, so scrolling by hand mid-playback
+ * moves the teleprompter rather than fighting it.
+ */
+export function resolveTeleprompterPosition(
+ trackedPosition: number,
+ actualScrollTop: number,
+): number {
+ if (!Number.isFinite(actualScrollTop)) {
+ return Number.isFinite(trackedPosition) ? Math.max(0, trackedPosition) : 0;
+ }
+
+ if (!Number.isFinite(trackedPosition)) {
+ return Math.max(0, actualScrollTop);
+ }
+
+ const drift = Math.abs(actualScrollTop - trackedPosition);
+ return Math.max(0, drift > TELEPROMPTER_SCROLL_TOLERANCE_PX ? actualScrollTop : trackedPosition);
+}
+
+/**
+ * Content that fits the window is never "at the end" — it has nowhere to scroll, so
+ * playback stays armed and starts moving as soon as the note grows past the viewport.
+ */
+export function isAtTeleprompterEnd(scrollTop: number, maxScrollTop: number): boolean {
+ if (!Number.isFinite(maxScrollTop) || maxScrollTop <= 0) {
+ return false;
+ }
+
+ const safeScrollTop = Number.isFinite(scrollTop) ? scrollTop : 0;
+ return safeScrollTop >= maxScrollTop - TELEPROMPTER_SCROLL_TOLERANCE_PX;
+}
+
+export function getMaxScrollTop(
+ element: Pick<HTMLElement, "scrollHeight" | "clientHeight">,
+): number {
+ return Math.max(0, element.scrollHeight - element.clientHeight);
+}
diff --git a/src/i18n/locales/ar/common.json b/src/i18n/locales/ar/common.json
index 3591a29ab..16b826989 100644
--- a/src/i18n/locales/ar/common.json
+++ b/src/i18n/locales/ar/common.json
@@ -43,6 +43,10 @@
"fullscreen": "ملء الشاشة",
"exitFullscreen": "خروج من ملء الشاشة"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} بكسل/ثانية",
+ "pixels": "{{value}} بكسل"
+ },
"locale": {
"name": "عربي",
"short": "AR"
diff --git a/src/i18n/locales/ar/launch.json b/src/i18n/locales/ar/launch.json
index 61d028e09..08cb8a4e5 100644
--- a/src/i18n/locales/ar/launch.json
+++ b/src/i18n/locales/ar/launch.json
@@ -32,10 +32,6 @@
"mirror": "عكس أفقي"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} بكسل/ثانية",
- "pixels": "{{value}} بكسل"
- },
"audio": {
"enableSystemAudio": "تفعيل صوت النظام",
"disableSystemAudio": "تعطيل صوت النظام",
diff --git a/src/i18n/locales/en/common.json b/src/i18n/locales/en/common.json
index f60a40267..6d77a0121 100644
--- a/src/i18n/locales/en/common.json
+++ b/src/i18n/locales/en/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Fullscreen",
"exitFullscreen": "Exit Fullscreen"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} px/s",
+ "pixels": "{{value}} px"
+ },
"locale": {
"name": "English",
"short": "EN"
diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.json
index dcdefb59e..02b8ca626 100644
--- a/src/i18n/locales/en/launch.json
+++ b/src/i18n/locales/en/launch.json
@@ -32,10 +32,6 @@
"mirror": "Mirror horizontally"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} px/s",
- "pixels": "{{value}} px"
- },
"audio": {
"enableSystemAudio": "Enable system audio",
"disableSystemAudio": "Disable system audio",
diff --git a/src/i18n/locales/es/common.json b/src/i18n/locales/es/common.json
index 48160a9cf..82da2527a 100644
--- a/src/i18n/locales/es/common.json
+++ b/src/i18n/locales/es/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Pantalla completa",
"exitFullscreen": "Salir de pantalla completa"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} píxeles/s",
+ "pixels": "{{value}} píxeles"
+ },
"locale": {
"name": "Español",
"short": "ES"
diff --git a/src/i18n/locales/es/launch.json b/src/i18n/locales/es/launch.json
index 09f5764dc..c5fb8d10e 100644
--- a/src/i18n/locales/es/launch.json
+++ b/src/i18n/locales/es/launch.json
@@ -32,10 +32,6 @@
"mirror": "Reflejar horizontalmente"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} píxeles/s",
- "pixels": "{{value}} píxeles"
- },
"audio": {
"enableSystemAudio": "Activar audio del sistema",
"disableSystemAudio": "Desactivar audio del sistema",
diff --git a/src/i18n/locales/fr/common.json b/src/i18n/locales/fr/common.json
index f53ec4385..47955acd2 100644
--- a/src/i18n/locales/fr/common.json
+++ b/src/i18n/locales/fr/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Plein écran",
"exitFullscreen": "Quitter le plein écran"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} pixels/s",
+ "pixels": "{{value}} pixels"
+ },
"locale": {
"name": "Français",
"short": "FR"
diff --git a/src/i18n/locales/fr/launch.json b/src/i18n/locales/fr/launch.json
index 4b2837f51..5c49eafd1 100644
--- a/src/i18n/locales/fr/launch.json
+++ b/src/i18n/locales/fr/launch.json
@@ -32,10 +32,6 @@
"mirror": "Miroir horizontal"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} pixels/s",
- "pixels": "{{value}} pixels"
- },
"audio": {
"enableSystemAudio": "Activer l'audio système",
"disableSystemAudio": "Désactiver l'audio système",
diff --git a/src/i18n/locales/it/common.json b/src/i18n/locales/it/common.json
index c829a98a0..728b04e4f 100644
--- a/src/i18n/locales/it/common.json
+++ b/src/i18n/locales/it/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Schermo intero",
"exitFullscreen": "Esci dallo schermo intero"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} pixel/s",
+ "pixels": "{{value}} pixel"
+ },
"locale": {
"name": "Italiano",
"short": "IT"
diff --git a/src/i18n/locales/it/launch.json b/src/i18n/locales/it/launch.json
index 14993fe3a..7136316a1 100644
--- a/src/i18n/locales/it/launch.json
+++ b/src/i18n/locales/it/launch.json
@@ -32,10 +32,6 @@
"mirror": "Specchia orizzontalmente"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} pixel/s",
- "pixels": "{{value}} pixel"
- },
"audio": {
"enableSystemAudio": "Abilita audio di sistema",
"disableSystemAudio": "Disabilita audio di sistema",
diff --git a/src/i18n/locales/ja-JP/common.json b/src/i18n/locales/ja-JP/common.json
index 74bd986ac..53b684bb1 100644
--- a/src/i18n/locales/ja-JP/common.json
+++ b/src/i18n/locales/ja-JP/common.json
@@ -43,6 +43,10 @@
"fullscreen": "全画面表示",
"exitFullscreen": "全画面表示を終了"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} px/秒",
+ "pixels": "{{value}} px"
+ },
"locale": {
"name": "日本語",
"short": "JA"
diff --git a/src/i18n/locales/ja-JP/launch.json b/src/i18n/locales/ja-JP/launch.json
index edbc0d19b..bb564e44b 100644
--- a/src/i18n/locales/ja-JP/launch.json
+++ b/src/i18n/locales/ja-JP/launch.json
@@ -32,10 +32,6 @@
"mirror": "左右反転"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} px/秒",
- "pixels": "{{value}} px"
- },
"audio": {
"enableSystemAudio": "システム音声を有効にする",
"disableSystemAudio": "システム音声を無効にする",
diff --git a/src/i18n/locales/ko-KR/common.json b/src/i18n/locales/ko-KR/common.json
index 8f8fb69bd..612f08bef 100644
--- a/src/i18n/locales/ko-KR/common.json
+++ b/src/i18n/locales/ko-KR/common.json
@@ -43,6 +43,10 @@
"fullscreen": "전체화면",
"exitFullscreen": "전체화면 종료"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} px/초",
+ "pixels": "{{value}} px"
+ },
"locale": {
"name": "한국어",
"short": "KO"
diff --git a/src/i18n/locales/ko-KR/launch.json b/src/i18n/locales/ko-KR/launch.json
index 6037709d5..bd297c0c7 100644
--- a/src/i18n/locales/ko-KR/launch.json
+++ b/src/i18n/locales/ko-KR/launch.json
@@ -32,10 +32,6 @@
"mirror": "좌우 반전"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} px/초",
- "pixels": "{{value}} px"
- },
"audio": {
"enableSystemAudio": "시스템 오디오 활성화",
"disableSystemAudio": "시스템 오디오 비활성화",
diff --git a/src/i18n/locales/pt-BR/common.json b/src/i18n/locales/pt-BR/common.json
index bebd54d16..ee06d2391 100644
--- a/src/i18n/locales/pt-BR/common.json
+++ b/src/i18n/locales/pt-BR/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Tela Cheia",
"exitFullscreen": "Sair da Tela Cheia"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} pixels/s",
+ "pixels": "{{value}} pixels"
+ },
"locale": {
"name": "Português Brasileiro",
"short": "PT-BR"
diff --git a/src/i18n/locales/pt-BR/launch.json b/src/i18n/locales/pt-BR/launch.json
index e24dedb60..1470d4cce 100644
--- a/src/i18n/locales/pt-BR/launch.json
+++ b/src/i18n/locales/pt-BR/launch.json
@@ -32,10 +32,6 @@
"mirror": "Espelhar horizontalmente"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} pixels/s",
- "pixels": "{{value}} pixels"
- },
"audio": {
"enableSystemAudio": "Ativar áudio do sistema",
"disableSystemAudio": "Desativar áudio do sistema",
diff --git a/src/i18n/locales/ru/common.json b/src/i18n/locales/ru/common.json
index e001a5f6b..6e2d97186 100644
--- a/src/i18n/locales/ru/common.json
+++ b/src/i18n/locales/ru/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Полный экран",
"exitFullscreen": "Выход из полного экрана"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} пикс/с",
+ "pixels": "{{value}} пикс"
+ },
"locale": {
"name": "Русский",
"short": "RU"
diff --git a/src/i18n/locales/ru/launch.json b/src/i18n/locales/ru/launch.json
index 1a105fefc..7836e4b87 100644
--- a/src/i18n/locales/ru/launch.json
+++ b/src/i18n/locales/ru/launch.json
@@ -32,10 +32,6 @@
"mirror": "Отразить по горизонтали"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} пикс/с",
- "pixels": "{{value}} пикс"
- },
"audio": {
"enableSystemAudio": "Включить системное аудио",
"disableSystemAudio": "Отключить системное аудио",
diff --git a/src/i18n/locales/tr/common.json b/src/i18n/locales/tr/common.json
index 69face446..cdac32a81 100644
--- a/src/i18n/locales/tr/common.json
+++ b/src/i18n/locales/tr/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Tam Ekran",
"exitFullscreen": "Tam Ekrandan Çık"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} piks/sn",
+ "pixels": "{{value}} piks"
+ },
"locale": {
"name": "Türkçe",
"short": "TR"
diff --git a/src/i18n/locales/tr/launch.json b/src/i18n/locales/tr/launch.json
index 97a3f3401..05e415afb 100644
--- a/src/i18n/locales/tr/launch.json
+++ b/src/i18n/locales/tr/launch.json
@@ -32,10 +32,6 @@
"mirror": "Yatay aynala"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} piks/sn",
- "pixels": "{{value}} piks"
- },
"audio": {
"enableSystemAudio": "Sistem sesini etkinleştir",
"disableSystemAudio": "Sistem sesini devre dışı bırak",
diff --git a/src/i18n/locales/vi/common.json b/src/i18n/locales/vi/common.json
index 50c1f8150..f9f9fd067 100644
--- a/src/i18n/locales/vi/common.json
+++ b/src/i18n/locales/vi/common.json
@@ -43,6 +43,10 @@
"fullscreen": "Toàn màn hình",
"exitFullscreen": "Thoát toàn màn hình"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} px/giây",
+ "pixels": "{{value}} px"
+ },
"locale": {
"name": "Tiếng Việt",
"short": "VI"
diff --git a/src/i18n/locales/vi/launch.json b/src/i18n/locales/vi/launch.json
index 7b1b6141c..e1488e425 100644
--- a/src/i18n/locales/vi/launch.json
+++ b/src/i18n/locales/vi/launch.json
@@ -32,10 +32,6 @@
"mirror": "Lật ngang"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} px/giây",
- "pixels": "{{value}} px"
- },
"audio": {
"enableSystemAudio": "Bật âm thanh hệ thống",
"disableSystemAudio": "Tắt âm thanh hệ thống",
diff --git a/src/i18n/locales/zh-CN/common.json b/src/i18n/locales/zh-CN/common.json
index e1b8ffc50..1d72f32be 100644
--- a/src/i18n/locales/zh-CN/common.json
+++ b/src/i18n/locales/zh-CN/common.json
@@ -43,6 +43,10 @@
"fullscreen": "全屏",
"exitFullscreen": "退出全屏"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} 像素/秒",
+ "pixels": "{{value}} 像素"
+ },
"locale": {
"name": "简体中文",
"short": "简中"
diff --git a/src/i18n/locales/zh-CN/launch.json b/src/i18n/locales/zh-CN/launch.json
index 3fe856e2d..f67815fce 100644
--- a/src/i18n/locales/zh-CN/launch.json
+++ b/src/i18n/locales/zh-CN/launch.json
@@ -32,10 +32,6 @@
"mirror": "水平镜像"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} 像素/秒",
- "pixels": "{{value}} 像素"
- },
"audio": {
"enableSystemAudio": "启用系统音频",
"disableSystemAudio": "禁用系统音频",
diff --git a/src/i18n/locales/zh-TW/common.json b/src/i18n/locales/zh-TW/common.json
index 39e78cdda..92401c80a 100644
--- a/src/i18n/locales/zh-TW/common.json
+++ b/src/i18n/locales/zh-TW/common.json
@@ -43,6 +43,10 @@
"fullscreen": "全螢幕",
"exitFullscreen": "退出全螢幕"
},
+ "units": {
+ "pixelsPerSecond": "{{value}} 像素/秒",
+ "pixels": "{{value}} 像素"
+ },
"locale": {
"name": "繁體中文",
"short": "繁中"
diff --git a/src/i18n/locales/zh-TW/launch.json b/src/i18n/locales/zh-TW/launch.json
index d34acfebf..5e8fbf10d 100644
--- a/src/i18n/locales/zh-TW/launch.json
+++ b/src/i18n/locales/zh-TW/launch.json
@@ -32,10 +32,6 @@
"mirror": "水平鏡像"
}
},
- "units": {
- "pixelsPerSecond": "{{value}} 像素/秒",
- "pixels": "{{value}} 像素"
- },
"audio": {
"enableSystemAudio": "啟用系統音訊",
"disableSystemAudio": "停用系統音訊",