From e952cf0a424f8d068439c8f6549f9711246aa78c Mon Sep 17 00:00:00 2001 From: simosmik Date: Tue, 18 Nov 2025 20:29:30 +0000 Subject: [PATCH] feat(terminal): add clickable web links support Replace ClipboardAddon with WebLinksAddon to enable automatic detection and clickable handling of URLs in terminal output. This improves user experience by allowing direct interaction with links displayed in the terminal. --- package-lock.json | 10 ++++++++++ package.json | 1 + src/components/Shell.jsx | 9 +++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5be5e68..f1fddf2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "@uiw/react-codemirror": "^4.23.13", "@xterm/addon-clipboard": "^0.1.0", "@xterm/addon-fit": "^0.10.0", + "@xterm/addon-web-links": "^0.11.0", "@xterm/addon-webgl": "^0.18.0", "@xterm/xterm": "^5.5.0", "bcrypt": "^6.0.0", @@ -3024,6 +3025,15 @@ "@xterm/xterm": "^5.0.0" } }, + "node_modules/@xterm/addon-web-links": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@xterm/addon-web-links/-/addon-web-links-0.11.0.tgz", + "integrity": "sha512-nIHQ38pQI+a5kXnRaTgwqSHnX7KE6+4SVoceompgHL26unAxdfP6IPqUTSYPQgSwM56hsElfoNrrW5V7BUED/Q==", + "license": "MIT", + "peerDependencies": { + "@xterm/xterm": "^5.0.0" + } + }, "node_modules/@xterm/addon-webgl": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.18.0.tgz", diff --git a/package.json b/package.json index 394a2bc..74c62fc 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "@uiw/react-codemirror": "^4.23.13", "@xterm/addon-clipboard": "^0.1.0", "@xterm/addon-fit": "^0.10.0", + "@xterm/addon-web-links": "^0.11.0", "@xterm/addon-webgl": "^0.18.0", "@xterm/xterm": "^5.5.0", "bcrypt": "^6.0.0", diff --git a/src/components/Shell.jsx b/src/components/Shell.jsx index cbf54a7..c095836 100644 --- a/src/components/Shell.jsx +++ b/src/components/Shell.jsx @@ -1,8 +1,8 @@ import React, { useEffect, useRef, useState, useCallback, useMemo } from 'react'; import { Terminal } from '@xterm/xterm'; import { FitAddon } from '@xterm/addon-fit'; -import { ClipboardAddon } from '@xterm/addon-clipboard'; import { WebglAddon } from '@xterm/addon-webgl'; +import { WebLinksAddon } from '@xterm/addon-web-links'; import '@xterm/xterm/css/xterm.css'; const xtermStyles = ` @@ -267,11 +267,12 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell }); fitAddon.current = new FitAddon(); - const clipboardAddon = new ClipboardAddon(); const webglAddon = new WebglAddon(); - + const webLinksAddon = new WebLinksAddon(); + terminal.current.loadAddon(fitAddon.current); - terminal.current.loadAddon(clipboardAddon); + terminal.current.loadAddon(webLinksAddon); + // Note: ClipboardAddon removed - we handle clipboard operations manually in attachCustomKeyEventHandler try { terminal.current.loadAddon(webglAddon);