mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-13 08:12:54 -07:00
Restore multi-copy digit capture and add AniList selection (#56)
This commit is contained in:
@@ -12,6 +12,7 @@ export function createKeyboardHandlers(
|
||||
ctx: RendererContext,
|
||||
options: {
|
||||
handleRuntimeOptionsKeydown: (e: KeyboardEvent) => boolean;
|
||||
handleCharacterDictionaryKeydown: (e: KeyboardEvent) => boolean;
|
||||
handleSubsyncKeydown: (e: KeyboardEvent) => boolean;
|
||||
handleKikuKeydown: (e: KeyboardEvent) => boolean;
|
||||
handleJimakuKeydown: (e: KeyboardEvent) => boolean;
|
||||
@@ -360,6 +361,20 @@ export function createKeyboardHandlers(
|
||||
);
|
||||
}
|
||||
|
||||
function isPrimarySubtitleVisibilityToggle(e: KeyboardEvent): boolean {
|
||||
return e.code === 'KeyV' && !e.ctrlKey && !e.altKey && !e.metaKey && !e.shiftKey && !e.repeat;
|
||||
}
|
||||
|
||||
function togglePrimarySubtitleBarVisibility(): void {
|
||||
const visible = !ctx.state.primarySubtitleBarVisible;
|
||||
ctx.state.primarySubtitleBarVisible = visible;
|
||||
if (visible) {
|
||||
ctx.dom.subtitleContainer.classList.remove('primary-sub-hidden');
|
||||
} else {
|
||||
ctx.dom.subtitleContainer.classList.add('primary-sub-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
async function handleMarkWatched(): Promise<void> {
|
||||
const marked = await window.electronAPI.markActiveVideoWatched();
|
||||
if (marked) {
|
||||
@@ -1004,6 +1019,10 @@ export function createKeyboardHandlers(
|
||||
options.handleRuntimeOptionsKeydown(e);
|
||||
return;
|
||||
}
|
||||
if (ctx.state.characterDictionaryModalOpen) {
|
||||
options.handleCharacterDictionaryKeydown(e);
|
||||
return;
|
||||
}
|
||||
if (ctx.state.subsyncModalOpen) {
|
||||
options.handleSubsyncKeydown(e);
|
||||
return;
|
||||
@@ -1060,6 +1079,12 @@ export function createKeyboardHandlers(
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPrimarySubtitleVisibilityToggle(e)) {
|
||||
e.preventDefault();
|
||||
togglePrimarySubtitleBarVisibility();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.state.yomitanPopupVisible || isYomitanPopupVisible(document)) {
|
||||
if (handleYomitanPopupKeybind(e)) {
|
||||
e.preventDefault();
|
||||
@@ -1147,6 +1172,7 @@ export function createKeyboardHandlers(
|
||||
updateSessionBindings,
|
||||
syncKeyboardTokenSelection,
|
||||
handleSubtitleContentUpdated,
|
||||
togglePrimarySubtitleBarVisibility,
|
||||
handleKeyboardModeToggleRequested,
|
||||
handleLookupWindowToggleRequested,
|
||||
closeLookupWindow,
|
||||
|
||||
Reference in New Issue
Block a user