mirror of
https://git.proxmox.com/git/mirror_xterm.js
synced 2025-10-04 15:58:27 +00:00
Bump version to 2.3.0
Signed-off-by: Paris Kasidiaris <paris@sourcelair.com>
This commit is contained in:
parent
795cdb52dc
commit
8dd11f5587
7
AUTHORS
7
AUTHORS
@ -7,7 +7,10 @@ Anton Skshidlevsky <meefik@gmail.com>
|
|||||||
Anton Yurovskykh <anton.yurovskykh@gmail.com>
|
Anton Yurovskykh <anton.yurovskykh@gmail.com>
|
||||||
Austin Robertson <austinrobertson@gmail.com>
|
Austin Robertson <austinrobertson@gmail.com>
|
||||||
ayapi <colors.aya@gmail.com>
|
ayapi <colors.aya@gmail.com>
|
||||||
|
Ben Hall <ben@benhall.me.uk>
|
||||||
Benjamin Fischer <benjamin.fischer@rwth-aachen.de>
|
Benjamin Fischer <benjamin.fischer@rwth-aachen.de>
|
||||||
|
Bill Church <billchurch@users.noreply.github.com>
|
||||||
|
Bob Reid <bobreid@Bobs-MacBook-Pro.local>
|
||||||
bottleofwater <nison.mael+bottleofwater@gmail.com>
|
bottleofwater <nison.mael+bottleofwater@gmail.com>
|
||||||
Carson Anderson <carson@betterservers.com>
|
Carson Anderson <carson@betterservers.com>
|
||||||
Christian Budde Christensen <budde377@gmail.com>
|
Christian Budde Christensen <budde377@gmail.com>
|
||||||
@ -22,13 +25,17 @@ Ian Lewis <ianlewis@google.com>
|
|||||||
imoses <ido@twiggle.com>
|
imoses <ido@twiggle.com>
|
||||||
Jean Bruenn <himself@jeanbruenn.info>
|
Jean Bruenn <himself@jeanbruenn.info>
|
||||||
Jörg Breitbart <jerch@rockborn.de>
|
Jörg Breitbart <jerch@rockborn.de>
|
||||||
|
Lucian Buzzo <lucian.buzzo@gmail.com>
|
||||||
Maël Nison <nison.mael@gmail.com>
|
Maël Nison <nison.mael@gmail.com>
|
||||||
Mikko Karvonen <mikko.karvonen@arm.com>
|
Mikko Karvonen <mikko.karvonen@arm.com>
|
||||||
Paris Kasidiaris <pariskasidiaris@gmail.com>
|
Paris Kasidiaris <pariskasidiaris@gmail.com>
|
||||||
Paris Kasidiaris <paris@sourcelair.com>
|
Paris Kasidiaris <paris@sourcelair.com>
|
||||||
runarberg <runar@greenqloud.com>
|
runarberg <runar@greenqloud.com>
|
||||||
|
Saswat Das <saswatds@users.noreply.github.com>
|
||||||
Shuanglei Tao <tsl0922@gmail.com>
|
Shuanglei Tao <tsl0922@gmail.com>
|
||||||
Steven Silvester <steven.silvester@ieee.org>
|
Steven Silvester <steven.silvester@ieee.org>
|
||||||
Thanasis Daglis <thanasis@sourcelair.com>
|
Thanasis Daglis <thanasis@sourcelair.com>
|
||||||
Tine Jozelj <tine.jozelj@outlook.com>
|
Tine Jozelj <tine.jozelj@outlook.com>
|
||||||
|
Tyler Jewell <tjewell@codenvy.com>
|
||||||
|
Vincent Woo <me@vincentwoo.com>
|
||||||
YuviPanda <yuvipanda@gmail.com>
|
YuviPanda <yuvipanda@gmail.com>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm.js",
|
"name": "xterm.js",
|
||||||
"version": "2.2.3",
|
"version": "2.3.0",
|
||||||
"ignore": ["demo", "test", ".gitignore"],
|
"ignore": ["demo", "test", ".gitignore"],
|
||||||
"main": [
|
"main": [
|
||||||
"dist/xterm.js",
|
"dist/xterm.js",
|
||||||
|
30
dist/addons/attach/attach.js
vendored
30
dist/addons/attach/attach.js
vendored
@ -3,20 +3,19 @@
|
|||||||
* @module xterm/addons/attach/attach
|
* @module xterm/addons/attach/attach
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (attach) {
|
(function (attach) {
|
||||||
if (typeof exports === 'object' && typeof module === 'object') {
|
if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
/*
|
/*
|
||||||
* CommonJS environment
|
* CommonJS environment
|
||||||
*/
|
*/
|
||||||
module.exports = attach(require('../../xterm'));
|
module.exports = attach(require('../../xterm'));
|
||||||
}
|
} else if (typeof define == 'function') {
|
||||||
else if (typeof define == 'function') {
|
|
||||||
/*
|
/*
|
||||||
* Require.js is available
|
* Require.js is available
|
||||||
*/
|
*/
|
||||||
define(['../../xterm'], attach);
|
define(['../../xterm'], attach);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Plain browser environment
|
* Plain browser environment
|
||||||
*/
|
*/
|
||||||
@ -24,7 +23,9 @@
|
|||||||
}
|
}
|
||||||
})(function (Xterm) {
|
})(function (Xterm) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches the given terminal to the given socket.
|
* Attaches the given terminal to the given socket.
|
||||||
*
|
*
|
||||||
@ -39,39 +40,45 @@
|
|||||||
exports.attach = function (term, socket, bidirectional, buffered) {
|
exports.attach = function (term, socket, bidirectional, buffered) {
|
||||||
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
||||||
term.socket = socket;
|
term.socket = socket;
|
||||||
|
|
||||||
term._flushBuffer = function () {
|
term._flushBuffer = function () {
|
||||||
term.write(term._attachSocketBuffer);
|
term.write(term._attachSocketBuffer);
|
||||||
term._attachSocketBuffer = null;
|
term._attachSocketBuffer = null;
|
||||||
clearTimeout(term._attachSocketBufferTimer);
|
clearTimeout(term._attachSocketBufferTimer);
|
||||||
term._attachSocketBufferTimer = null;
|
term._attachSocketBufferTimer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
term._pushToBuffer = function (data) {
|
term._pushToBuffer = function (data) {
|
||||||
if (term._attachSocketBuffer) {
|
if (term._attachSocketBuffer) {
|
||||||
term._attachSocketBuffer += data;
|
term._attachSocketBuffer += data;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
term._attachSocketBuffer = data;
|
term._attachSocketBuffer = data;
|
||||||
setTimeout(term._flushBuffer, 10);
|
setTimeout(term._flushBuffer, 10);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
term._getMessage = function (ev) {
|
term._getMessage = function (ev) {
|
||||||
if (buffered) {
|
if (buffered) {
|
||||||
term._pushToBuffer(ev.data);
|
term._pushToBuffer(ev.data);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
term.write(ev.data);
|
term.write(ev.data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
term._sendData = function (data) {
|
term._sendData = function (data) {
|
||||||
socket.send(data);
|
socket.send(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.addEventListener('message', term._getMessage);
|
socket.addEventListener('message', term._getMessage);
|
||||||
|
|
||||||
if (bidirectional) {
|
if (bidirectional) {
|
||||||
term.on('data', term._sendData);
|
term.on('data', term._sendData);
|
||||||
}
|
}
|
||||||
|
|
||||||
socket.addEventListener('close', term.detach.bind(term, socket));
|
socket.addEventListener('close', term.detach.bind(term, socket));
|
||||||
socket.addEventListener('error', term.detach.bind(term, socket));
|
socket.addEventListener('error', term.detach.bind(term, socket));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detaches the given terminal from the given socket
|
* Detaches the given terminal from the given socket
|
||||||
*
|
*
|
||||||
@ -81,12 +88,16 @@
|
|||||||
*/
|
*/
|
||||||
exports.detach = function (term, socket) {
|
exports.detach = function (term, socket) {
|
||||||
term.off('data', term._sendData);
|
term.off('data', term._sendData);
|
||||||
|
|
||||||
socket = (typeof socket == 'undefined') ? term.socket : socket;
|
socket = (typeof socket == 'undefined') ? term.socket : socket;
|
||||||
|
|
||||||
if (socket) {
|
if (socket) {
|
||||||
socket.removeEventListener('message', term._getMessage);
|
socket.removeEventListener('message', term._getMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete term.socket;
|
delete term.socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches the current terminal to the given socket
|
* Attaches the current terminal to the given socket
|
||||||
*
|
*
|
||||||
@ -100,6 +111,7 @@
|
|||||||
Xterm.prototype.attach = function (socket, bidirectional, buffered) {
|
Xterm.prototype.attach = function (socket, bidirectional, buffered) {
|
||||||
return exports.attach(this, socket, bidirectional, buffered);
|
return exports.attach(this, socket, bidirectional, buffered);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detaches the current terminal from the given socket.
|
* Detaches the current terminal from the given socket.
|
||||||
*
|
*
|
||||||
@ -109,6 +121,6 @@
|
|||||||
Xterm.prototype.detach = function (socket) {
|
Xterm.prototype.detach = function (socket) {
|
||||||
return exports.detach(this, socket);
|
return exports.detach(this, socket);
|
||||||
};
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=attach.js.map
|
|
36
dist/addons/fit/fit.js
vendored
36
dist/addons/fit/fit.js
vendored
@ -10,20 +10,19 @@
|
|||||||
* @module xterm/addons/fit/fit
|
* @module xterm/addons/fit/fit
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (fit) {
|
(function (fit) {
|
||||||
if (typeof exports === 'object' && typeof module === 'object') {
|
if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
/*
|
/*
|
||||||
* CommonJS environment
|
* CommonJS environment
|
||||||
*/
|
*/
|
||||||
module.exports = fit(require('../../xterm'));
|
module.exports = fit(require('../../xterm'));
|
||||||
}
|
} else if (typeof define == 'function') {
|
||||||
else if (typeof define == 'function') {
|
|
||||||
/*
|
/*
|
||||||
* Require.js is available
|
* Require.js is available
|
||||||
*/
|
*/
|
||||||
define(['../../xterm'], fit);
|
define(['../../xterm'], fit);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Plain browser environment
|
* Plain browser environment
|
||||||
*/
|
*/
|
||||||
@ -31,29 +30,52 @@
|
|||||||
}
|
}
|
||||||
})(function (Xterm) {
|
})(function (Xterm) {
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
exports.proposeGeometry = function (term) {
|
exports.proposeGeometry = function (term) {
|
||||||
var parentElementStyle = window.getComputedStyle(term.element.parentElement), parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')), parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17), elementStyle = window.getComputedStyle(term.element), elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')), elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')), availableHeight = parentElementHeight - elementPaddingVer, availableWidth = parentElementWidth - elementPaddingHor, container = term.rowContainer, subjectRow = term.rowContainer.firstElementChild, contentBuffer = subjectRow.innerHTML, characterHeight, rows, characterWidth, cols, geometry;
|
var parentElementStyle = window.getComputedStyle(term.element.parentElement),
|
||||||
|
parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')),
|
||||||
|
parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')) - 17),
|
||||||
|
elementStyle = window.getComputedStyle(term.element),
|
||||||
|
elementPaddingVer = parseInt(elementStyle.getPropertyValue('padding-top')) + parseInt(elementStyle.getPropertyValue('padding-bottom')),
|
||||||
|
elementPaddingHor = parseInt(elementStyle.getPropertyValue('padding-right')) + parseInt(elementStyle.getPropertyValue('padding-left')),
|
||||||
|
availableHeight = parentElementHeight - elementPaddingVer,
|
||||||
|
availableWidth = parentElementWidth - elementPaddingHor,
|
||||||
|
container = term.rowContainer,
|
||||||
|
subjectRow = term.rowContainer.firstElementChild,
|
||||||
|
contentBuffer = subjectRow.innerHTML,
|
||||||
|
characterHeight,
|
||||||
|
rows,
|
||||||
|
characterWidth,
|
||||||
|
cols,
|
||||||
|
geometry;
|
||||||
|
|
||||||
subjectRow.style.display = 'inline';
|
subjectRow.style.display = 'inline';
|
||||||
subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace
|
subjectRow.innerHTML = 'W'; // Common character for measuring width, although on monospace
|
||||||
characterWidth = subjectRow.getBoundingClientRect().width;
|
characterWidth = subjectRow.getBoundingClientRect().width;
|
||||||
subjectRow.style.display = ''; // Revert style before calculating height, since they differ.
|
subjectRow.style.display = ''; // Revert style before calculating height, since they differ.
|
||||||
characterHeight = parseInt(subjectRow.offsetHeight);
|
characterHeight = parseInt(subjectRow.offsetHeight);
|
||||||
subjectRow.innerHTML = contentBuffer;
|
subjectRow.innerHTML = contentBuffer;
|
||||||
|
|
||||||
rows = parseInt(availableHeight / characterHeight);
|
rows = parseInt(availableHeight / characterHeight);
|
||||||
cols = parseInt(availableWidth / characterWidth);
|
cols = parseInt(availableWidth / characterWidth);
|
||||||
geometry = { cols: cols, rows: rows };
|
|
||||||
|
geometry = {cols: cols, rows: rows};
|
||||||
return geometry;
|
return geometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.fit = function (term) {
|
exports.fit = function (term) {
|
||||||
var geometry = exports.proposeGeometry(term);
|
var geometry = exports.proposeGeometry(term);
|
||||||
|
|
||||||
term.resize(geometry.cols, geometry.rows);
|
term.resize(geometry.cols, geometry.rows);
|
||||||
};
|
};
|
||||||
|
|
||||||
Xterm.prototype.proposeGeometry = function () {
|
Xterm.prototype.proposeGeometry = function () {
|
||||||
return exports.proposeGeometry(this);
|
return exports.proposeGeometry(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Xterm.prototype.fit = function () {
|
Xterm.prototype.fit = function () {
|
||||||
return exports.fit(this);
|
return exports.fit(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=fit.js.map
|
|
18
dist/addons/fullscreen/fullscreen.js
vendored
18
dist/addons/fullscreen/fullscreen.js
vendored
@ -9,14 +9,12 @@
|
|||||||
* CommonJS environment
|
* CommonJS environment
|
||||||
*/
|
*/
|
||||||
module.exports = fullscreen(require('../../xterm'));
|
module.exports = fullscreen(require('../../xterm'));
|
||||||
}
|
} else if (typeof define == 'function') {
|
||||||
else if (typeof define == 'function') {
|
|
||||||
/*
|
/*
|
||||||
* Require.js is available
|
* Require.js is available
|
||||||
*/
|
*/
|
||||||
define(['../../xterm'], fullscreen);
|
define(['../../xterm'], fullscreen);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Plain browser environment
|
* Plain browser environment
|
||||||
*/
|
*/
|
||||||
@ -24,6 +22,7 @@
|
|||||||
}
|
}
|
||||||
})(function (Xterm) {
|
})(function (Xterm) {
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the given terminal's fullscreen mode.
|
* Toggle the given terminal's fullscreen mode.
|
||||||
* @param {Xterm} term - The terminal to toggle full screen mode
|
* @param {Xterm} term - The terminal to toggle full screen mode
|
||||||
@ -31,20 +30,21 @@
|
|||||||
*/
|
*/
|
||||||
exports.toggleFullScreen = function (term, fullscreen) {
|
exports.toggleFullScreen = function (term, fullscreen) {
|
||||||
var fn;
|
var fn;
|
||||||
|
|
||||||
if (typeof fullscreen == 'undefined') {
|
if (typeof fullscreen == 'undefined') {
|
||||||
fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add';
|
fn = (term.element.classList.contains('fullscreen')) ? 'remove' : 'add';
|
||||||
}
|
} else if (!fullscreen) {
|
||||||
else if (!fullscreen) {
|
|
||||||
fn = 'remove';
|
fn = 'remove';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fn = 'add';
|
fn = 'add';
|
||||||
}
|
}
|
||||||
|
|
||||||
term.element.classList[fn]('fullscreen');
|
term.element.classList[fn]('fullscreen');
|
||||||
};
|
};
|
||||||
|
|
||||||
Xterm.prototype.toggleFullscreen = function (fullscreen) {
|
Xterm.prototype.toggleFullscreen = function (fullscreen) {
|
||||||
exports.toggleFullScreen(this, fullscreen);
|
exports.toggleFullScreen(this, fullscreen);
|
||||||
};
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=fullscreen.js.map
|
|
74
dist/addons/linkify/linkify.js
vendored
74
dist/addons/linkify/linkify.js
vendored
@ -3,20 +3,19 @@
|
|||||||
* @module xterm/addons/linkify/linkify
|
* @module xterm/addons/linkify/linkify
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (linkify) {
|
(function (linkify) {
|
||||||
if (typeof exports === 'object' && typeof module === 'object') {
|
if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
/*
|
/*
|
||||||
* CommonJS environment
|
* CommonJS environment
|
||||||
*/
|
*/
|
||||||
module.exports = linkify(require('../../xterm'));
|
module.exports = linkify(require('../../xterm'));
|
||||||
}
|
} else if (typeof define == 'function') {
|
||||||
else if (typeof define == 'function') {
|
|
||||||
/*
|
/*
|
||||||
* Require.js is available
|
* Require.js is available
|
||||||
*/
|
*/
|
||||||
define(['../../xterm'], linkify);
|
define(['../../xterm'], linkify);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Plain browser environment
|
* Plain browser environment
|
||||||
*/
|
*/
|
||||||
@ -24,7 +23,26 @@
|
|||||||
}
|
}
|
||||||
})(function (Xterm) {
|
})(function (Xterm) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var exports = {}, protocolClause = '(https?:\\/\\/)', domainCharacterSet = '[\\da-z\\.-]+', negatedDomainCharacterSet = '[^\\da-z\\.-]+', domainBodyClause = '(' + domainCharacterSet + ')', tldClause = '([a-z\\.]{2,6})', ipClause = '((\\d{1,3}\\.){3}\\d{1,3})', portClause = '(:\\d{1,5})', hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + ')' + portClause + '?', pathClause = '(\\/[\\/\\w\\.-]*)*', negatedPathCharacterSet = '[^\\/\\w\\.-]+', bodyClause = hostClause + pathClause, start = '(?:^|' + negatedDomainCharacterSet + ')(', end = ')($|' + negatedPathCharacterSet + ')', lenientUrlClause = start + protocolClause + '?' + bodyClause + end, strictUrlClause = start + protocolClause + bodyClause + end, lenientUrlRegex = new RegExp(lenientUrlClause), strictUrlRegex = new RegExp(strictUrlClause);
|
|
||||||
|
var exports = {},
|
||||||
|
protocolClause = '(https?:\\/\\/)',
|
||||||
|
domainCharacterSet = '[\\da-z\\.-]+',
|
||||||
|
negatedDomainCharacterSet = '[^\\da-z\\.-]+',
|
||||||
|
domainBodyClause = '(' + domainCharacterSet + ')',
|
||||||
|
tldClause = '([a-z\\.]{2,6})',
|
||||||
|
ipClause = '((\\d{1,3}\\.){3}\\d{1,3})',
|
||||||
|
portClause = '(:\\d{1,5})',
|
||||||
|
hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + ')' + portClause + '?',
|
||||||
|
pathClause = '(\\/[\\/\\w\\.-]*)*',
|
||||||
|
negatedPathCharacterSet = '[^\\/\\w\\.-]+',
|
||||||
|
bodyClause = hostClause + pathClause,
|
||||||
|
start = '(?:^|' + negatedDomainCharacterSet + ')(',
|
||||||
|
end = ')($|' + negatedPathCharacterSet + ')',
|
||||||
|
lenientUrlClause = start + protocolClause + '?' + bodyClause + end,
|
||||||
|
strictUrlClause = start + protocolClause + bodyClause + end,
|
||||||
|
lenientUrlRegex = new RegExp(lenientUrlClause),
|
||||||
|
strictUrlRegex = new RegExp(strictUrlClause);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts all valid URLs found in the given terminal line into
|
* Converts all valid URLs found in the given terminal line into
|
||||||
* hyperlinks. The terminal line can be either the HTML element itself
|
* hyperlinks. The terminal line can be either the HTML element itself
|
||||||
@ -44,21 +62,26 @@
|
|||||||
exports.linkifyTerminalLine = function (terminal, line, lenient, target) {
|
exports.linkifyTerminalLine = function (terminal, line, lenient, target) {
|
||||||
if (typeof line == 'number') {
|
if (typeof line == 'number') {
|
||||||
line = terminal.rowContainer.children[line];
|
line = terminal.rowContainer.children[line];
|
||||||
}
|
} else if (! (line instanceof HTMLDivElement)) {
|
||||||
else if (!(line instanceof HTMLDivElement)) {
|
|
||||||
var message = 'The "line" argument should be either a number';
|
var message = 'The "line" argument should be either a number';
|
||||||
message += ' or an HTMLDivElement';
|
message += ' or an HTMLDivElement';
|
||||||
|
|
||||||
throw new TypeError(message);
|
throw new TypeError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof target === 'undefined') {
|
if (typeof target === 'undefined') {
|
||||||
target = '';
|
target = '';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
target = 'target="' + target + '"';
|
target = 'target="' + target + '"';
|
||||||
}
|
}
|
||||||
var buffer = document.createElement('span'), nodes = line.childNodes;
|
|
||||||
for (var j = 0; j < nodes.length; j++) {
|
var buffer = document.createElement('span'),
|
||||||
var node = nodes[j], match;
|
nodes = line.childNodes;
|
||||||
|
|
||||||
|
for (var j=0; j<nodes.length; j++) {
|
||||||
|
var node = nodes[j],
|
||||||
|
match;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since we cannot access the TextNode's HTML representation
|
* Since we cannot access the TextNode's HTML representation
|
||||||
* from the instance itself, we assign its data as textContent
|
* from the instance itself, we assign its data as textContent
|
||||||
@ -66,20 +89,31 @@
|
|||||||
* HTML representation from the buffer's innerHTML.
|
* HTML representation from the buffer's innerHTML.
|
||||||
*/
|
*/
|
||||||
buffer.textContent = node.data;
|
buffer.textContent = node.data;
|
||||||
|
|
||||||
var nodeHTML = buffer.innerHTML;
|
var nodeHTML = buffer.innerHTML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply function only on TextNodes
|
* Apply function only on TextNodes
|
||||||
*/
|
*/
|
||||||
if (node.nodeType != node.TEXT_NODE) {
|
if (node.nodeType != node.TEXT_NODE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = exports.findLinkMatch(node.data, lenient);
|
var url = exports.findLinkMatch(node.data, lenient);
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var startsWithProtocol = new RegExp('^' + protocolClause), urlHasProtocol = url.match(startsWithProtocol), href = (urlHasProtocol) ? url : 'http://' + url, link = '<a href="' + href + '" ' + target + '>' + url + '</a>', newHTML = nodeHTML.replace(url, link);
|
|
||||||
|
var startsWithProtocol = new RegExp('^' + protocolClause),
|
||||||
|
urlHasProtocol = url.match(startsWithProtocol),
|
||||||
|
href = (urlHasProtocol) ? url : 'http://' + url,
|
||||||
|
link = '<a href="' + href + '" ' + target + '>' + url + '</a>',
|
||||||
|
newHTML = nodeHTML.replace(url, link);
|
||||||
|
|
||||||
line.innerHTML = line.innerHTML.replace(nodeHTML, newHTML);
|
line.innerHTML = line.innerHTML.replace(nodeHTML, newHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event gets emitted when conversion of all URL susbtrings
|
* This event gets emitted when conversion of all URL susbtrings
|
||||||
* to HTML anchor elements (links) has finished, for a specific
|
* to HTML anchor elements (links) has finished, for a specific
|
||||||
@ -89,6 +123,7 @@
|
|||||||
*/
|
*/
|
||||||
terminal.emit('linkify:line', line);
|
terminal.emit('linkify:line', line);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a link within a block of text.
|
* Finds a link within a block of text.
|
||||||
*
|
*
|
||||||
@ -102,7 +137,8 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return match[1];
|
return match[1];
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts all valid URLs found in the terminal view into hyperlinks.
|
* Converts all valid URLs found in the terminal view into hyperlinks.
|
||||||
*
|
*
|
||||||
@ -116,11 +152,14 @@
|
|||||||
*/
|
*/
|
||||||
exports.linkify = function (terminal, lenient, target) {
|
exports.linkify = function (terminal, lenient, target) {
|
||||||
var rows = terminal.rowContainer.children;
|
var rows = terminal.rowContainer.children;
|
||||||
|
|
||||||
lenient = (typeof lenient == "boolean") ? lenient : true;
|
lenient = (typeof lenient == "boolean") ? lenient : true;
|
||||||
for (var i = 0; i < rows.length; i++) {
|
for (var i=0; i<rows.length; i++) {
|
||||||
var line = rows[i];
|
var line = rows[i];
|
||||||
|
|
||||||
exports.linkifyTerminalLine(terminal, line, lenient, target);
|
exports.linkifyTerminalLine(terminal, line, lenient, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event gets emitted when conversion of all URL substrings to
|
* This event gets emitted when conversion of all URL substrings to
|
||||||
* HTML anchor elements (links) has finished for the current Xterm
|
* HTML anchor elements (links) has finished for the current Xterm
|
||||||
@ -130,9 +169,11 @@
|
|||||||
*/
|
*/
|
||||||
terminal.emit('linkify');
|
terminal.emit('linkify');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend Xterm prototype.
|
* Extend Xterm prototype.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts all valid URLs found in the current terminal linte into
|
* Converts all valid URLs found in the current terminal linte into
|
||||||
* hyperlinks.
|
* hyperlinks.
|
||||||
@ -148,6 +189,7 @@
|
|||||||
Xterm.prototype.linkifyTerminalLine = function (line, lenient, target) {
|
Xterm.prototype.linkifyTerminalLine = function (line, lenient, target) {
|
||||||
return exports.linkifyTerminalLine(this, line, lenient, target);
|
return exports.linkifyTerminalLine(this, line, lenient, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts all valid URLs found in the current terminal into hyperlinks.
|
* Converts all valid URLs found in the current terminal into hyperlinks.
|
||||||
*
|
*
|
||||||
@ -160,6 +202,6 @@
|
|||||||
Xterm.prototype.linkify = function (lenient, target) {
|
Xterm.prototype.linkify = function (lenient, target) {
|
||||||
return exports.linkify(this, lenient, target);
|
return exports.linkify(this, lenient, target);
|
||||||
};
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=linkify.js.map
|
|
35
dist/addons/terminado/terminado.js
vendored
35
dist/addons/terminado/terminado.js
vendored
@ -4,20 +4,19 @@
|
|||||||
* @module xterm/addons/terminado/terminado
|
* @module xterm/addons/terminado/terminado
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (attach) {
|
(function (attach) {
|
||||||
if (typeof exports === 'object' && typeof module === 'object') {
|
if (typeof exports === 'object' && typeof module === 'object') {
|
||||||
/*
|
/*
|
||||||
* CommonJS environment
|
* CommonJS environment
|
||||||
*/
|
*/
|
||||||
module.exports = attach(require('../../xterm'));
|
module.exports = attach(require('../../xterm'));
|
||||||
}
|
} else if (typeof define == 'function') {
|
||||||
else if (typeof define == 'function') {
|
|
||||||
/*
|
/*
|
||||||
* Require.js is available
|
* Require.js is available
|
||||||
*/
|
*/
|
||||||
define(['../../xterm'], attach);
|
define(['../../xterm'], attach);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Plain browser environment
|
* Plain browser environment
|
||||||
*/
|
*/
|
||||||
@ -25,7 +24,9 @@
|
|||||||
}
|
}
|
||||||
})(function (Xterm) {
|
})(function (Xterm) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches the given terminal to the given socket.
|
* Attaches the given terminal to the given socket.
|
||||||
*
|
*
|
||||||
@ -40,46 +41,53 @@
|
|||||||
exports.terminadoAttach = function (term, socket, bidirectional, buffered) {
|
exports.terminadoAttach = function (term, socket, bidirectional, buffered) {
|
||||||
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
bidirectional = (typeof bidirectional == 'undefined') ? true : bidirectional;
|
||||||
term.socket = socket;
|
term.socket = socket;
|
||||||
|
|
||||||
term._flushBuffer = function () {
|
term._flushBuffer = function () {
|
||||||
term.write(term._attachSocketBuffer);
|
term.write(term._attachSocketBuffer);
|
||||||
term._attachSocketBuffer = null;
|
term._attachSocketBuffer = null;
|
||||||
clearTimeout(term._attachSocketBufferTimer);
|
clearTimeout(term._attachSocketBufferTimer);
|
||||||
term._attachSocketBufferTimer = null;
|
term._attachSocketBufferTimer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
term._pushToBuffer = function (data) {
|
term._pushToBuffer = function (data) {
|
||||||
if (term._attachSocketBuffer) {
|
if (term._attachSocketBuffer) {
|
||||||
term._attachSocketBuffer += data;
|
term._attachSocketBuffer += data;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
term._attachSocketBuffer = data;
|
term._attachSocketBuffer = data;
|
||||||
setTimeout(term._flushBuffer, 10);
|
setTimeout(term._flushBuffer, 10);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
term._getMessage = function (ev) {
|
term._getMessage = function (ev) {
|
||||||
var data = JSON.parse(ev.data);
|
var data = JSON.parse(ev.data)
|
||||||
if (data[0] == "stdout") {
|
if( data[0] == "stdout" ) {
|
||||||
if (buffered) {
|
if (buffered) {
|
||||||
term._pushToBuffer(data[1]);
|
term._pushToBuffer(data[1]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
term.write(data[1]);
|
term.write(data[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
term._sendData = function (data) {
|
term._sendData = function (data) {
|
||||||
socket.send(JSON.stringify(['stdin', data]));
|
socket.send(JSON.stringify(['stdin', data]));
|
||||||
};
|
};
|
||||||
|
|
||||||
term._setSize = function (size) {
|
term._setSize = function (size) {
|
||||||
socket.send(JSON.stringify(['set_size', size.rows, size.cols]));
|
socket.send(JSON.stringify(['set_size', size.rows, size.cols]));
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.addEventListener('message', term._getMessage);
|
socket.addEventListener('message', term._getMessage);
|
||||||
|
|
||||||
if (bidirectional) {
|
if (bidirectional) {
|
||||||
term.on('data', term._sendData);
|
term.on('data', term._sendData);
|
||||||
}
|
}
|
||||||
term.on('resize', term._setSize);
|
term.on('resize', term._setSize);
|
||||||
|
|
||||||
socket.addEventListener('close', term.terminadoDetach.bind(term, socket));
|
socket.addEventListener('close', term.terminadoDetach.bind(term, socket));
|
||||||
socket.addEventListener('error', term.terminadoDetach.bind(term, socket));
|
socket.addEventListener('error', term.terminadoDetach.bind(term, socket));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detaches the given terminal from the given socket
|
* Detaches the given terminal from the given socket
|
||||||
*
|
*
|
||||||
@ -89,12 +97,16 @@
|
|||||||
*/
|
*/
|
||||||
exports.terminadoDetach = function (term, socket) {
|
exports.terminadoDetach = function (term, socket) {
|
||||||
term.off('data', term._sendData);
|
term.off('data', term._sendData);
|
||||||
|
|
||||||
socket = (typeof socket == 'undefined') ? term.socket : socket;
|
socket = (typeof socket == 'undefined') ? term.socket : socket;
|
||||||
|
|
||||||
if (socket) {
|
if (socket) {
|
||||||
socket.removeEventListener('message', term._getMessage);
|
socket.removeEventListener('message', term._getMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete term.socket;
|
delete term.socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attaches the current terminal to the given socket
|
* Attaches the current terminal to the given socket
|
||||||
*
|
*
|
||||||
@ -108,6 +120,7 @@
|
|||||||
Xterm.prototype.terminadoAttach = function (socket, bidirectional, buffered) {
|
Xterm.prototype.terminadoAttach = function (socket, bidirectional, buffered) {
|
||||||
return exports.terminadoAttach(this, socket, bidirectional, buffered);
|
return exports.terminadoAttach(this, socket, bidirectional, buffered);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detaches the current terminal from the given socket.
|
* Detaches the current terminal from the given socket.
|
||||||
*
|
*
|
||||||
@ -117,6 +130,6 @@
|
|||||||
Xterm.prototype.terminadoDetach = function (socket) {
|
Xterm.prototype.terminadoDetach = function (socket) {
|
||||||
return exports.terminadoDetach(this, socket);
|
return exports.terminadoDetach(this, socket);
|
||||||
};
|
};
|
||||||
|
|
||||||
return exports;
|
return exports;
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=terminado.js.map
|
|
44
dist/xterm.css
vendored
44
dist/xterm.css
vendored
@ -71,7 +71,7 @@
|
|||||||
resize: none;
|
resize: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal .terminal-cursor {
|
.terminal:not(.xterm-cursor-style-underline):not(.xterm-cursor-style-bar) .terminal-cursor {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
@ -82,11 +82,11 @@
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminal.focus .terminal-cursor.blinking {
|
.terminal:not(.xterm-cursor-style-underline):not(.xterm-cursor-style-bar).focus.xterm-cursor-blink .terminal-cursor {
|
||||||
animation: blink-cursor 1.2s infinite step-end;
|
animation: xterm-cursor-blink 1.2s infinite step-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes blink-cursor {
|
@keyframes xterm-cursor-blink {
|
||||||
0% {
|
0% {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #000;
|
color: #000;
|
||||||
@ -97,6 +97,38 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.terminal.xterm-cursor-style-bar .terminal-cursor,
|
||||||
|
.terminal.xterm-cursor-style-underline .terminal-cursor {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.terminal.xterm-cursor-style-bar .terminal-cursor::before,
|
||||||
|
.terminal.xterm-cursor-style-underline .terminal-cursor::before {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.terminal.xterm-cursor-style-bar .terminal-cursor::before {
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 1px;
|
||||||
|
}
|
||||||
|
.terminal.xterm-cursor-style-underline .terminal-cursor::before {
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 1px;
|
||||||
|
}
|
||||||
|
.terminal.xterm-cursor-style-bar.focus.xterm-cursor-blink .terminal-cursor::before,
|
||||||
|
.terminal.xterm-cursor-style-underline.focus.xterm-cursor-blink .terminal-cursor::before {
|
||||||
|
animation: xterm-cursor-non-bar-blink 1.2s infinite step-end;
|
||||||
|
}
|
||||||
|
@keyframes xterm-cursor-non-bar-blink {
|
||||||
|
0% { background-color: #fff; }
|
||||||
|
50% { background-color: transparent; }
|
||||||
|
}
|
||||||
|
|
||||||
.terminal .composition-view {
|
.terminal .composition-view {
|
||||||
background: #000;
|
background: #000;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
@ -116,6 +148,10 @@
|
|||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.terminal .xterm-wide-char {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.terminal .xterm-rows {
|
.terminal .xterm-rows {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
8746
dist/xterm.js
vendored
8746
dist/xterm.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/xterm.js.map
vendored
2
dist/xterm.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm",
|
"name": "xterm",
|
||||||
"description": "Full xterm terminal, in your browser",
|
"description": "Full xterm terminal, in your browser",
|
||||||
"version": "2.2.3",
|
"version": "2.3.0",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"demo",
|
"demo",
|
||||||
"test",
|
"test",
|
||||||
|
Loading…
Reference in New Issue
Block a user