How to use the xterm/dist/addons/webLinks/webLinks.webLinksInit function in xterm

To help you get started, we’ve selected a few xterm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / ice / packages / iceworks-client / src / utils / termManager.js View on Github external
create(id, container, options = {}) {
    const opts = deepmerge(defaultOptions, options);
    if (!this.terms[id]) {
      this.terms[id] = new Terminal(opts);
      this.terms[id].writeChunk = writeChunkFn(this.terms[id]);
      this.terms[id].writeLog = writeLog(this.terms[id]);
    } else {
      this.terms[id]._core.options.theme = opts.theme;
    }

    // initialize the web links addon, registering the link matcher
    webLinks.webLinksInit(this.terms[id], (event, uri) => {
      window.open(uri, 'blank');
    });

    // opens the terminal within an element.
    this.terms[id].open(container);

    // Note: need to initialize the fit plugin when the component is re-rendered
    // make the terminal's size and geometry fit the size of #terminal-container
    this.terms[id].fit();

    return this.terms[id];
  }
github vuejs / vue-cli / packages / @vue / cli-ui / src / components / content / TerminalView.vue View on Github external
initTerminal () {
      let term = this.$_terminal = new Terminal({
        cols: this.cols,
        rows: this.rows,
        theme: this.theme,
        ...this.options
      })
      webLinks.webLinksInit(term, this.handleLink)
      term.open(this.$refs.render)

      term.on('blur', () => this.$emit('blur'))
      term.on('focus', () => this.$emit('focus'))

      if (this.autoSize) {
        this.$nextTick(this.fit)
      }
    },