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.
This commit is contained in:
simosmik
2025-11-18 20:29:30 +00:00
parent 18d0874142
commit e952cf0a42
3 changed files with 16 additions and 4 deletions

10
package-lock.json generated
View File

@@ -24,6 +24,7 @@
"@uiw/react-codemirror": "^4.23.13", "@uiw/react-codemirror": "^4.23.13",
"@xterm/addon-clipboard": "^0.1.0", "@xterm/addon-clipboard": "^0.1.0",
"@xterm/addon-fit": "^0.10.0", "@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.11.0",
"@xterm/addon-webgl": "^0.18.0", "@xterm/addon-webgl": "^0.18.0",
"@xterm/xterm": "^5.5.0", "@xterm/xterm": "^5.5.0",
"bcrypt": "^6.0.0", "bcrypt": "^6.0.0",
@@ -3024,6 +3025,15 @@
"@xterm/xterm": "^5.0.0" "@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": { "node_modules/@xterm/addon-webgl": {
"version": "0.18.0", "version": "0.18.0",
"resolved": "https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.18.0.tgz", "resolved": "https://registry.npmjs.org/@xterm/addon-webgl/-/addon-webgl-0.18.0.tgz",

View File

@@ -55,6 +55,7 @@
"@uiw/react-codemirror": "^4.23.13", "@uiw/react-codemirror": "^4.23.13",
"@xterm/addon-clipboard": "^0.1.0", "@xterm/addon-clipboard": "^0.1.0",
"@xterm/addon-fit": "^0.10.0", "@xterm/addon-fit": "^0.10.0",
"@xterm/addon-web-links": "^0.11.0",
"@xterm/addon-webgl": "^0.18.0", "@xterm/addon-webgl": "^0.18.0",
"@xterm/xterm": "^5.5.0", "@xterm/xterm": "^5.5.0",
"bcrypt": "^6.0.0", "bcrypt": "^6.0.0",

View File

@@ -1,8 +1,8 @@
import React, { useEffect, useRef, useState, useCallback, useMemo } from 'react'; import React, { useEffect, useRef, useState, useCallback, useMemo } from 'react';
import { Terminal } from '@xterm/xterm'; import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit'; import { FitAddon } from '@xterm/addon-fit';
import { ClipboardAddon } from '@xterm/addon-clipboard';
import { WebglAddon } from '@xterm/addon-webgl'; import { WebglAddon } from '@xterm/addon-webgl';
import { WebLinksAddon } from '@xterm/addon-web-links';
import '@xterm/xterm/css/xterm.css'; import '@xterm/xterm/css/xterm.css';
const xtermStyles = ` const xtermStyles = `
@@ -267,11 +267,12 @@ function Shell({ selectedProject, selectedSession, initialCommand, isPlainShell
}); });
fitAddon.current = new FitAddon(); fitAddon.current = new FitAddon();
const clipboardAddon = new ClipboardAddon();
const webglAddon = new WebglAddon(); const webglAddon = new WebglAddon();
const webLinksAddon = new WebLinksAddon();
terminal.current.loadAddon(fitAddon.current); terminal.current.loadAddon(fitAddon.current);
terminal.current.loadAddon(clipboardAddon); terminal.current.loadAddon(webLinksAddon);
// Note: ClipboardAddon removed - we handle clipboard operations manually in attachCustomKeyEventHandler
try { try {
terminal.current.loadAddon(webglAddon); terminal.current.loadAddon(webglAddon);