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

This commit is contained in:
2026-09-07 14:03:54 -07:00
committed by GitHub
parent c14c690875
commit 1e5d7747b4
24 changed files with 624 additions and 3 deletions
+5 -1
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { contextBridge, ipcRenderer, IpcRendererEvent, webUtils } from 'electron';
import { clipboard, contextBridge, ipcRenderer, IpcRendererEvent, webUtils } from 'electron';
import { resolveOverlayLayerFromArgv } from './preload-args';
import type {
SubtitleData,
@@ -301,6 +301,10 @@ const electronAPI: ElectronAPI = {
ipcRenderer.invoke(IPC_CHANNELS.request.getSubtitleSidebarOpen),
getSubtitleSidebarSnapshot: () =>
ipcRenderer.invoke(IPC_CHANNELS.request.getSubtitleSidebarSnapshot),
copySubtitleSidebarSelection: async (text: unknown) => {
if (typeof text !== 'string') throw new TypeError('Subtitle selection must be text.');
clipboard.writeText(text);
},
getPlaybackPaused: (): Promise<boolean | null> =>
ipcRenderer.invoke(IPC_CHANNELS.request.getPlaybackPaused),
onSubtitleAss: (callback: (assText: string) => void) => {