Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Terminal from 'xterm';
import 'xterm/dist/xterm.css';
import './term.css';
// monkey patching so xterm doesn't need a textarea
Terminal.prototype.focus = function() {
this.textarea.dispatchEvent(new FocusEvent('focus'));
};
Terminal.prototype.blur = function() {
this.textarea.dispatchEvent(new FocusEvent('blur'));
};
window.term = new Terminal();
// there is no public interface to disable linkifying
term.linkifier._linkMatchers = [];
term.open(document.getElementById('terminal'), true);
term.on('focus', function() {
webkit.messageHandlers.focus.postMessage('focus');
});
term.on('resize', function(size) {
webkit.messageHandlers.resize.postMessage('resize');
});
// copied from the fit addon, but without subtracting 17 pixels for a nonexistent scrollbar
function fit() {
import Terminal from 'xterm';
import 'xterm/dist/xterm.css';
import './term.css';
// monkey patching so xterm doesn't need a textarea
Terminal.prototype.focus = function() {
this.textarea.dispatchEvent(new FocusEvent('focus'));
};
Terminal.prototype.blur = function() {
this.textarea.dispatchEvent(new FocusEvent('blur'));
};
window.term = new Terminal();
// there is no public interface to disable linkifying
term.linkifier._linkMatchers = [];
term.open(document.getElementById('terminal'), true);
term.on('focus', function() {
webkit.messageHandlers.focus.postMessage('focus');
});
term.on('resize', function(size) {
webkit.messageHandlers.resize.postMessage('resize');
});