mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
feat(subtitles): improve mpv hovered-token highlighting flow
- add subtitleStyle.hoverTokenColor config default + validation - normalize hover color payloads and propagate configured color to mpv runtime - refresh invisible overlay tokenization with current subtitle text and tighten hover overlay cleanup hooks - record TASK-98 and subagent coordination updates
This commit is contained in:
@@ -99,3 +99,16 @@ test('subtitle processing can refresh current subtitle without text change', asy
|
||||
{ text: 'same', tokens: [] },
|
||||
]);
|
||||
});
|
||||
|
||||
test('subtitle processing refresh can use explicit text override', async () => {
|
||||
const emitted: SubtitleData[] = [];
|
||||
const controller = createSubtitleProcessingController({
|
||||
tokenizeSubtitle: async (text) => ({ text, tokens: [] }),
|
||||
emitSubtitle: (payload) => emitted.push(payload),
|
||||
});
|
||||
|
||||
controller.refreshCurrentSubtitle('initial');
|
||||
await flushMicrotasks();
|
||||
|
||||
assert.deepEqual(emitted, [{ text: 'initial', tokens: [] }]);
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ export interface SubtitleProcessingControllerDeps {
|
||||
|
||||
export interface SubtitleProcessingController {
|
||||
onSubtitleChange: (text: string) => void;
|
||||
refreshCurrentSubtitle: () => void;
|
||||
refreshCurrentSubtitle: (textOverride?: string) => void;
|
||||
}
|
||||
|
||||
export function createSubtitleProcessingController(
|
||||
@@ -87,7 +87,10 @@ export function createSubtitleProcessingController(
|
||||
latestText = text;
|
||||
processLatest();
|
||||
},
|
||||
refreshCurrentSubtitle: () => {
|
||||
refreshCurrentSubtitle: (textOverride?: string) => {
|
||||
if (typeof textOverride === 'string') {
|
||||
latestText = textOverride;
|
||||
}
|
||||
if (!latestText.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user