Use xterm webLinks addon (#2810)

Fixes #2809
This commit is contained in:
CHaBou 2018-04-05 22:45:18 +02:00 committed by GitHub
parent e181e1eb8d
commit f5d48ee38a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,12 +2,14 @@
import React from 'react';
import {Terminal} from 'xterm';
import * as fit from 'xterm/lib/addons/fit/fit';
import * as webLinks from 'xterm/lib/addons/webLinks/webLinks';
import {clipboard} from 'electron';
import * as Color from 'color';
import terms from '../terms';
import processClipboard from '../utils/paste';
Terminal.applyAddon(fit);
Terminal.applyAddon(webLinks);
// map old hterm constants to xterm.js
const CURSOR_STYLES = {
@ -79,6 +81,8 @@ export default class Term extends React.PureComponent {
this.term = props.term || new Terminal(this.termOptions);
this.term.attachCustomKeyEventHandler(this.keyboardHandler);
this.term.open(this.termRef);
this.term.webLinksInit();
if (props.term) {
//We need to set options again after reattaching an existing term
Object.keys(this.termOptions).forEach(option => this.term.setOption(option, this.termOptions[option]));