feat(sidebar): add dialogue selection and copying (#238)

This commit is contained in:
sudacode authored and GitHub committed 2026-09-07 14:03:54 -07:00
1 parent c14c690875
commit 1e5d7747b4
24 files changed
+624 -3

No files matched your search

@@ -239,6 +239,7 @@ test('subtitle sidebar modal opens from snapshot and clicking cue seeks playback
const modalNotifications: string[] = [];
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [
{ startTime: 1, endTime: 3.4, text: 'first' },
{ startTime: 3, endTime: 4, text: 'second' },
@@ -381,6 +382,7 @@ test('subtitle sidebar rows support keyboard activation', async () => {
const mpvCommands: Array<Array<string | number>> = [];
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [
{ startTime: 1, endTime: 2, text: 'first' },
{ startTime: 3, endTime: 4, text: 'second' },
@@ -487,6 +489,7 @@ test('subtitle sidebar renders hour-long cue timestamps as HH:MM:SS', async () =
const previousDocument = globals.document;
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 3665, endTime: 3670, text: 'long cue' }],
currentSubtitle: {
text: 'long cue',
@@ -580,6 +583,7 @@ test('subtitle sidebar does not open when the feature is disabled', async () =>
const previousWindow = globals.window;
const previousDocument = globals.document;
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [],
currentSubtitle: {
text: '',
@@ -676,6 +680,7 @@ test('subtitle sidebar auto-open on startup only opens when enabled and configur
const previousDocument = globals.document;
let snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -786,6 +791,7 @@ test('subtitle sidebar auto-open restores previously open sidebar after renderer
const previousDocument = globals.document;
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -884,6 +890,7 @@ test('subtitle sidebar refresh closes and clears state when config becomes disab
const previousDocument = globals.document;
const bodyClassList = createClassList();
let snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -1008,6 +1015,7 @@ test('subtitle sidebar keeps nearby repeated cue when subtitle update lacks timi
const previousDocument = globals.document;
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [
{ startTime: 1, endTime: 2, text: 'same' },
{ startTime: 3, endTime: 4, text: 'other' },
@@ -1125,6 +1133,7 @@ test('subtitle sidebar does not regress to previous cue on text-only transition
const previousDocument = globals.document;
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [
{ startTime: 1, endTime: 2, text: 'first' },
{ startTime: 3, endTime: 4, text: 'second' },
@@ -1233,6 +1242,7 @@ test('subtitle sidebar jumps to first resolved active cue, then resumes smooth a
const previousDocument = globals.document;
let snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: Array.from({ length: 12 }, (_, index) => ({
startTime: index * 2,
endTime: index * 2 + 1.5,
@@ -1403,6 +1413,7 @@ test('subtitle sidebar polling schedules serialized timeouts instead of interval
});
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -1515,6 +1526,7 @@ test('subtitle sidebar closes and resumes a hover pause', async () => {
const contentListeners = new Map<string, Array<() => void>>();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -1633,6 +1645,7 @@ test('subtitle sidebar hover pause ignores playback-state IPC failures', async (
const contentListeners = new Map<string, Array<() => Promise<void> | void>>();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -1752,6 +1765,7 @@ test('subtitle sidebar keeps hover pause while a Yomitan lookup popup remains op
const windowListeners = new Map<string, Array<() => Promise<void> | void>>();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -1881,6 +1895,7 @@ test('subtitle sidebar embedded layout reserves and releases mpv right margin',
const mpvCommands: Array<Array<string | number>> = [];
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -2040,6 +2055,7 @@ test('subtitle sidebar embedded layout measures reserved width after embedded cl
const contentClassList = createClassList();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -2161,6 +2177,7 @@ test('subtitle sidebar embedded layout restores macOS and Windows passthrough ou
const contentListeners = new Map<string, Array<() => void>>();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -2290,6 +2307,7 @@ test('subtitle sidebar overlay layout restores macOS and Windows passthrough out
const contentListeners = new Map<string, Array<() => void>>();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -2417,6 +2435,7 @@ test('subtitle sidebar overlay layout only stays interactive while focus remains
const contentListeners = new Map<string, Array<(event?: FocusEvent) => void>>();
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -2532,6 +2551,7 @@ test('closing embedded subtitle sidebar recomputes passthrough from remaining su
const ignoreMouseCalls: Array<[boolean, { forward?: boolean } | undefined]> = [];
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',
@@ -2640,6 +2660,7 @@ test('subtitle sidebar resets embedded mpv margin on startup while closed', asyn
const mpvCommands: Array<Array<string | number>> = [];
const snapshot: SubtitleSidebarSnapshot = {
sourceKey: 'test-subtitles',
cues: [{ startTime: 1, endTime: 2, text: 'first' }],
currentSubtitle: {
text: 'first',