mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-28 16:09:44 +00:00
Restore paste
This commit is contained in:
@@ -25,7 +25,7 @@ class Terminal
|
||||
@rows = 24
|
||||
@scrollback = 100000
|
||||
@visualBell = 100
|
||||
@debug = true
|
||||
@debug = not true
|
||||
|
||||
@convertEol = false
|
||||
@termName = 'xterm'
|
||||
@@ -90,6 +90,13 @@ class Terminal
|
||||
@element.classList.add('blur')
|
||||
@element.classList.remove('focus')
|
||||
|
||||
paste: (ev) ->
|
||||
if ev.clipboardData
|
||||
@send(ev.clipboardData.getData('text/plain'))
|
||||
else if window.clipboardData
|
||||
@send(window.clipboardData.getData('Text'))
|
||||
cancel(ev)
|
||||
|
||||
open: (parent) ->
|
||||
@parent = parent or @parent
|
||||
throw new Error('Terminal requires a parent element') unless @parent
|
||||
@@ -124,6 +131,7 @@ class Terminal
|
||||
addEventListener('keypress', @keyPress.bind(@))
|
||||
addEventListener('focus', @focus.bind(@))
|
||||
addEventListener('blur', @blur.bind(@))
|
||||
addEventListener('paste', @paste.bind(@))
|
||||
|
||||
destroy: ->
|
||||
@readable = false
|
||||
@@ -886,13 +894,8 @@ class Terminal
|
||||
return true if ev.keyCode > 15 and ev.keyCode < 19
|
||||
|
||||
# Handle shift insert and ctrl insert copy/paste usefull for typematrix keyboard
|
||||
# TODO
|
||||
# if ev.shiftKey and ev.keyCode is 45
|
||||
# @emit "paste"
|
||||
# return true
|
||||
# if ev.ctrlKey and ev.keyCode is 45
|
||||
# @emit "copy"
|
||||
# return true
|
||||
if (ev.shiftKey or ev.ctrlKey) and ev.keyCode is 45
|
||||
return true
|
||||
|
||||
# Alt-z works as an escape to relay the following keys to the browser.
|
||||
# usefull to trigger browser shortcuts, i.e.: Alt+Z F5 to reload
|
||||
|
||||
@@ -216,7 +216,7 @@ Terminal = (function() {
|
||||
this.rows = 24;
|
||||
this.scrollback = 100000;
|
||||
this.visualBell = 100;
|
||||
this.debug = true;
|
||||
this.debug = !true;
|
||||
this.convertEol = false;
|
||||
this.termName = 'xterm';
|
||||
this.cursorBlink = true;
|
||||
@@ -285,6 +285,15 @@ Terminal = (function() {
|
||||
return this.element.classList.remove('focus');
|
||||
};
|
||||
|
||||
Terminal.prototype.paste = function(ev) {
|
||||
if (ev.clipboardData) {
|
||||
this.send(ev.clipboardData.getData('text/plain'));
|
||||
} else if (window.clipboardData) {
|
||||
this.send(window.clipboardData.getData('Text'));
|
||||
}
|
||||
return cancel(ev);
|
||||
};
|
||||
|
||||
Terminal.prototype.open = function(parent) {
|
||||
var div, i, _i, _ref;
|
||||
this.parent = parent || this.parent;
|
||||
@@ -311,7 +320,8 @@ Terminal = (function() {
|
||||
addEventListener('keydown', this.keyDown.bind(this));
|
||||
addEventListener('keypress', this.keyPress.bind(this));
|
||||
addEventListener('focus', this.focus.bind(this));
|
||||
return addEventListener('blur', this.blur.bind(this));
|
||||
addEventListener('blur', this.blur.bind(this));
|
||||
return addEventListener('paste', this.paste.bind(this));
|
||||
};
|
||||
|
||||
Terminal.prototype.destroy = function() {
|
||||
@@ -1022,6 +1032,9 @@ Terminal = (function() {
|
||||
if (ev.keyCode > 15 && ev.keyCode < 19) {
|
||||
return true;
|
||||
}
|
||||
if ((ev.shiftKey || ev.ctrlKey) && ev.keyCode === 45) {
|
||||
return true;
|
||||
}
|
||||
if (ev.altKey && ev.keyCode === 90 && !this.skipNextKey) {
|
||||
this.skipNextKey = true;
|
||||
return cancel(ev);
|
||||
|
||||
Reference in New Issue
Block a user