diff --git a/package.json b/package.json index 57d48d7c0..5c7af1f47 100644 --- a/package.json +++ b/package.json @@ -101,6 +101,7 @@ "@vercel/functions": "^3.4.3", "@vercel/otel": "^2.1.1", "@workos-inc/node": "catalog:", + "@xterm/addon-clipboard": "^0.2.0", "@xterm/addon-fit": "^0.11.0", "@xterm/addon-web-links": "^0.12.0", "@xterm/xterm": "^6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a1527016..aff0884b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -282,6 +282,9 @@ importers: '@workos-inc/node': specifier: 'catalog:' version: 8.9.0 + '@xterm/addon-clipboard': + specifier: ^0.2.0 + version: 0.2.0 '@xterm/addon-fit': specifier: ^0.11.0 version: 0.11.0 @@ -7855,6 +7858,9 @@ packages: engines: {node: '>=10.0.0'} deprecated: this version has critical issues, please update to the latest version + '@xterm/addon-clipboard@0.2.0': + resolution: {integrity: sha512-Dl31BCtBhLaUEECUbEiVcCLvLBbaeGYdT7NofB8OJkGTD3MWgBsaLjXvfGAD4tQNHhm6mbKyYkR7XD8kiZsdNg==} + '@xterm/addon-fit@0.11.0': resolution: {integrity: sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==} @@ -22047,6 +22053,8 @@ snapshots: '@xmldom/xmldom@0.8.11': {} + '@xterm/addon-clipboard@0.2.0': {} + '@xterm/addon-fit@0.11.0': {} '@xterm/addon-web-links@0.12.0': {} diff --git a/src/components/gastown/useXtermPty.ts b/src/components/gastown/useXtermPty.ts index 8725a1af8..538f0b4f4 100644 --- a/src/components/gastown/useXtermPty.ts +++ b/src/components/gastown/useXtermPty.ts @@ -292,11 +292,14 @@ export function useXtermPty({ if (!container) return; // Lazy-load xterm.js to avoid SSR issues and minimize bundle impact - const [{ Terminal }, { FitAddon }, { WebLinksAddon }] = await Promise.all([ - import('@xterm/xterm'), - import('@xterm/addon-fit'), - import('@xterm/addon-web-links'), - ]); + const [{ Terminal }, { FitAddon }, { WebLinksAddon }, { ClipboardAddon }] = await Promise.all( + [ + import('@xterm/xterm'), + import('@xterm/addon-fit'), + import('@xterm/addon-web-links'), + import('@xterm/addon-clipboard'), + ] + ); if (disposed) return; @@ -305,6 +308,7 @@ export function useXtermPty({ const fitAddon = new FitAddon(); const webLinksAddon = new WebLinksAddon(); + const clipboardAddon = new ClipboardAddon(); const term = new Terminal({ cursorBlink: true, @@ -323,6 +327,7 @@ export function useXtermPty({ term.loadAddon(fitAddon); term.loadAddon(webLinksAddon); + term.loadAddon(clipboardAddon); term.open(container); attachKittyEnterHandler(term, wsRef); fitAddon.fit();