Skip to content

Commit

Permalink
support web links (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kun Chen authored May 3, 2023
1 parent e07486a commit 687d116
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions apps/terminal/components/Terminal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useEffect, useRef } from 'react';
import { Terminal as XTerm } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import { Unicode11Addon } from 'xterm-addon-unicode11';
import { WebLinksAddon } from 'xterm-addon-web-links';
import { WebglAddon } from 'xterm-addon-webgl';

import { useConfigContext } from '../../hooks/ConfigContext';
Expand Down Expand Up @@ -32,6 +33,11 @@ const Terminal = ({ active, shellName }: { active: boolean; shellName: string })
const xterm = new XTerm({
allowProposedApi: true,
});
xterm.loadAddon(
new WebLinksAddon((_e, url) => {
window.TerminalOne?.links.openExternalURL(url);
}),
);

const webglAddon = new WebglAddon();
xterm.loadAddon(webglAddon);
Expand Down
1 change: 1 addition & 0 deletions apps/terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"xterm-addon-canvas": "^0.3.0",
"xterm-addon-fit": "^0.7.0",
"xterm-addon-unicode11": "^0.5.0",
"xterm-addon-web-links": "^0.8.0",
"xterm-addon-webgl": "^0.14.0"
},
"devDependencies": {
Expand Down
13 changes: 11 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@terminalone/monorepo",
"productName": "Terminal One",
"version": "0.2.1",
"version": "0.3.0",
"description": "A fast, elegant and intelligent cross-platform terminal.",
"author": "Kun Chen",
"license": "MIT",
Expand Down

0 comments on commit 687d116

Please sign in to comment.