Issue 39: Clipboard not integrated with client operating system
o Patch for html5 drag-and-drop applied. From the poster, Here is a quick proof-of-concept patch against the current SVN head that adds support for dragging and dropping text into a shellinabox session if the browser supports HTML5 drag-and-drop. It has only been tested with shellinabox/demo/demo.html
This commit is contained in:
parent
da7c1b5ec1
commit
33a92e9c93
1 changed files with 25 additions and 0 deletions
|
@ -1047,6 +1047,24 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
this.addListener(this.scrollable,'mouseup', mouseEvent(this, 1 /* MOUSE_UP */));
|
this.addListener(this.scrollable,'mouseup', mouseEvent(this, 1 /* MOUSE_UP */));
|
||||||
this.addListener(this.scrollable,'click', mouseEvent(this, 2 /* MOUSE_CLICK */));
|
this.addListener(this.scrollable,'click', mouseEvent(this, 2 /* MOUSE_CLICK */));
|
||||||
|
|
||||||
|
// Check that browser supports drag and drop
|
||||||
|
if ('draggable' in document.createElement('span')) {
|
||||||
|
var dropEvent = function (vt100) {
|
||||||
|
return function(e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
if (e.preventDefault) e.preventDefault();
|
||||||
|
vt100.keysPressed(e.dataTransfer.getData('Text'));
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Tell the browser that we *can* drop on this target
|
||||||
|
this.addListener(this.scrollable, 'dragover', cancel);
|
||||||
|
this.addListener(this.scrollable, 'dragenter', cancel);
|
||||||
|
|
||||||
|
// Add a listener for the drop event
|
||||||
|
this.addListener(this.scrollable, 'drop', dropEvent(this));
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the blank terminal window.
|
// Initialize the blank terminal window.
|
||||||
this.currentScreen = 0;
|
this.currentScreen = 0;
|
||||||
this.cursorX = 0;
|
this.cursorX = 0;
|
||||||
|
@ -1060,6 +1078,13 @@ VT100.prototype.initializeElements = function(container) {
|
||||||
this.input.focus();
|
this.input.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function cancel(event) {
|
||||||
|
if (event.preventDefault) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
VT100.prototype.getChildById = function(parent, id) {
|
VT100.prototype.getChildById = function(parent, id) {
|
||||||
var nodeList = parent.all || parent.getElementsByTagName('*');
|
var nodeList = parent.all || parent.getElementsByTagName('*');
|
||||||
if (typeof nodeList.namedItem == 'undefined') {
|
if (typeof nodeList.namedItem == 'undefined') {
|
||||||
|
|
Loading…
Reference in a new issue