Unverified Commit d272a5dc authored by BaiJiangJie's avatar BaiJiangJie Committed by GitHub

Merge pull request #126 from jumpserver/dev

Dev
parents 580c1486 7c357ae5
......@@ -2,6 +2,7 @@ import {Component, Input, OnInit, OnChanges} from '@angular/core';
import {Terminal} from 'xterm';
import {HttpService, LogService} from '@app/services';
import {Replay} from '@app/model';
import {newTerminal} from '@app/utils/common';
function zeroPad(num, minLength) {
let str = num.toString();
......@@ -80,14 +81,7 @@ export class ElementReplayJsonComponent implements OnInit {
constructor(private _http: HttpService) {}
ngOnInit() {
this.term = new Terminal({
fontFamily: '"Monaco", "Consolas", "monospace"',
fontSize: 14,
rightClickSelectsWord: true,
theme: {
background: '#1f1b1b'
}
});
this.term = newTerminal(14);
if (this.replay.src !== 'READY') {
this._http.getReplayData(this.replay.src)
.subscribe(
......
......@@ -4,6 +4,7 @@ import {View} from '@app/model';
import {LogService, SettingService, UUIDService} from '@app/services';
import {Socket} from '@app/utils/socket';
import {getWsSocket, translate} from '@app/globals';
import {newTerminal} from '@app/utils/common';
@Component({
......@@ -38,15 +39,7 @@ export class ElementSshTermComponent implements OnInit, OnDestroy {
newTerm() {
const fontSize = this.settingSvc.setting.fontSize;
this.term = new Terminal({
fontFamily: 'monaco, Consolas, "Lucida Console", monospace',
lineHeight: 1.2,
fontSize: fontSize,
rightClickSelectsWord: true,
theme: {
background: '#1f1b1b'
}
});
this.term = newTerminal(fontSize);
this.view.Term = this.term;
this.term.attachCustomKeyEventHandler(e => {
if (e.ctrlKey && e.key === 'c' && this.term.hasSelection()) {
......
import {Terminal} from 'xterm';
export function groupBy(array, f) {
const groups = {};
array.forEach( function( o ) {
......@@ -9,3 +11,23 @@ export function groupBy(array, f) {
return groups[group];
});
}
export function newTerminal(fontSize?: number) {
if (!fontSize || fontSize < 5 || fontSize > 50) {
fontSize = 13;
}
const ua = navigator.userAgent.toLowerCase();
let lineHeight = 1;
if (ua.indexOf('windows') !== -1) {
lineHeight = 1.2;
}
return new Terminal({
fontFamily: 'monaco, Consolas, "Lucida Console", monospace',
lineHeight: lineHeight,
fontSize: fontSize,
rightClickSelectsWord: true,
theme: {
background: '#1f1b1b'
}
});
}
src/favicon.ico

3.92 KB | W: | H:

src/favicon.ico

2.88 KB | W: | H:

src/favicon.ico
src/favicon.ico
src/favicon.ico
src/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment