update to xterm.js 4.0.2

This commit is contained in:
Bill Church 2019-10-03 09:00:56 -05:00
parent 0df64ec76b
commit 129c1be53c
7 changed files with 8201 additions and 11760 deletions

View file

@ -1,4 +1,9 @@
# Change Log # Change Log
## [0.3.0] 2019-10-01
### Changes
- Update to xterm.js 4.0.2
- path to socket.io has changed to /ssh/socket.io **potentially breaking**
- Update Webpack
## [0.2.9] 2019-06-13 ## [0.2.9] 2019-06-13
### Changes ### Changes
- Missing require('fs') in `server/app.js` See issue [#135](../../issues/135) - Missing require('fs') in `server/app.js` See issue [#135](../../issues/135)

File diff suppressed because one or more lines are too long

View file

@ -55,7 +55,7 @@
* The z-index of the helpers must be higher than the canvases in order for * The z-index of the helpers must be higher than the canvases in order for
* IMEs to appear on top. * IMEs to appear on top.
*/ */
z-index: 10; z-index: 5;
} }
.xterm .xterm-helper-textarea { .xterm .xterm-helper-textarea {
@ -69,7 +69,7 @@
top: 0; top: 0;
width: 0; width: 0;
height: 0; height: 0;
z-index: -10; z-index: -5;
/** Prevent wrapping so the IME appears against the textarea at the correct position */ /** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -150,7 +150,7 @@
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
z-index: 100; z-index: 10;
color: transparent; color: transparent;
} }

View file

@ -1,18 +1,17 @@
'use strict' 'use strict'
import io from 'socket.io-client' import io from 'socket.io-client'
import * as Terminal from 'xterm/dist/xterm' import { Terminal } from 'xterm';
import * as fit from 'xterm/dist/addons/fit/fit' import { FitAddon } from 'xterm-addon-fit';
import { library, dom } from '@fortawesome/fontawesome-svg-core' import { library, dom } from '@fortawesome/fontawesome-svg-core'
import { faBars, faClipboard, faDownload, faKey, faCog } from '@fortawesome/free-solid-svg-icons' import { faBars, faClipboard, faDownload, faKey, faCog } from '@fortawesome/free-solid-svg-icons'
library.add(faBars, faClipboard, faDownload, faKey, faCog) library.add(faBars, faClipboard, faDownload, faKey, faCog)
dom.watch() dom.watch()
require('xterm/dist/xterm.css') require('xterm/css/xterm.css')
require('../css/style.css') require('../css/style.css')
Terminal.applyAddon(fit)
/* global Blob, logBtn, credentialsBtn, reauthBtn, downloadLogBtn */ /* global Blob, logBtn, credentialsBtn, reauthBtn, downloadLogBtn */
var sessionLogEnable = false var sessionLogEnable = false
var loggedData = false var loggedData = false
@ -23,19 +22,21 @@ var termid // eslint-disable-line
// change path here and in the /app/server/app.js line 115 // change path here and in the /app/server/app.js line 115
var socket = io({path: '/ssh/socket.io'}) var socket = io({path: '/ssh/socket.io'})
var term = new Terminal() var term = new Terminal()
const fitAddon = new FitAddon();
// DOM properties // DOM properties
var status = document.getElementById('status') var status = document.getElementById('status')
var header = document.getElementById('header') var header = document.getElementById('header')
var dropupContent = document.getElementById('dropupContent') var dropupContent = document.getElementById('dropupContent')
var footer = document.getElementById('footer') var footer = document.getElementById('footer')
var terminalContainer = document.getElementById('terminal-container') var terminalContainer = document.getElementById('terminal-container')
term.loadAddon(fitAddon);
term.open(terminalContainer) term.open(terminalContainer)
term.focus() term.focus()
term.fit() fitAddon.fit();
window.addEventListener('resize', resizeScreen, false) window.addEventListener('resize', resizeScreen, false)
function resizeScreen () { function resizeScreen () {
term.fit() fitAddon.fit();
socket.emit('resize', { cols: term.cols, rows: term.rows }) socket.emit('resize', { cols: term.cols, rows: term.rows })
} }
@ -55,9 +56,7 @@ function resizeScreen () {
// socket.connect() // socket.connect()
} */ } */
term.on('data', function (data) { term.onData(data => socket.emit('data', data));
socket.emit('data', data)
})
socket.on('data', function (data) { socket.on('data', function (data) {
term.write(data) term.write(data)
@ -160,9 +159,7 @@ socket.on('reauth', function () {
(allowreauth) && reauthSession() (allowreauth) && reauthSession()
}) })
term.on('title', function (title) { term.onTitleChange(title => document.title = title)
document.title = title
})
// draw/re-draw menu and reattach listeners // draw/re-draw menu and reattach listeners
// when dom is changed, listeners are abandonded // when dom is changed, listeners are abandonded

7302
app/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -73,12 +73,13 @@
"snazzy": "^8.0.0", "snazzy": "^8.0.0",
"standard": "^12.0.1", "standard": "^12.0.1",
"style-loader": "^0.23.1", "style-loader": "^0.23.1",
"uglifyjs-webpack-plugin": "^2.1.1", "terser-webpack-plugin": "^2.1.2",
"url-loader": "^1.1.2", "url-loader": "^1.1.2",
"webpack": "^4.28.4", "webpack": "^4.28.4",
"webpack-cli": "^3.2.1", "webpack-cli": "^3.2.1",
"webpack-merge": "^4.2.1", "webpack-merge": "^4.2.1",
"webpack-stream": "^5.2.1", "webpack-stream": "^5.2.1",
"xterm": "^3.10.1" "xterm": "^4.0.2",
"xterm-addon-fit": "^0.2.1"
} }
} }

View file

@ -1,18 +1,28 @@
const merge = require('webpack-merge') const merge = require('webpack-merge')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const common = require('./webpack.common.js') const common = require('./webpack.common.js')
const TerserPlugin = require('terser-webpack-plugin');
module.exports = merge(common, { module.exports = merge(common,{
plugins: [ optimization: {
new UglifyJSPlugin({ minimize: true,
uglifyOptions: { minimizer: [
ie8: false, new TerserPlugin({
dead_code: true, terserOptions: {
output: { ecma: 6,
comments: false, warnings: false,
beautify: false parse: {},
} compress: {},
} mangle: true, // Note `mangle.properties` is `false` by default.
}) module: false,
] output: null,
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: undefined,
keep_fnames: false,
safari10: false,
},
}),
],
}
}) })