+2
-2
@@ -54,13 +54,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.terminal .xterm-helper-textarea {
|
.terminal .xterm-helper-textarea {
|
||||||
position: absolute;
|
|
||||||
/*
|
/*
|
||||||
* HACK: to fix IE's blinking cursor
|
* HACK: to fix IE's blinking cursor
|
||||||
* Move textarea out of the screen to the far left, so that the cursor is not visible.
|
* Move textarea out of the screen to the far left, so that the cursor is not visible.
|
||||||
*/
|
*/
|
||||||
left: -9999em;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
left: -9999em;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
z-index: -10;
|
z-index: -10;
|
||||||
|
|||||||
@@ -967,6 +967,57 @@ Terminal.prototype.bindMouse = function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle right-click
|
||||||
|
on(el, 'contextmenu', function (ev) {
|
||||||
|
var s = document.getSelection(),
|
||||||
|
sText = Terminal.prepareCopiedTextForClipboard(s.toString()),
|
||||||
|
r = s.getRangeAt(0);
|
||||||
|
|
||||||
|
var x = ev.clientX,
|
||||||
|
y = ev.clientY;
|
||||||
|
|
||||||
|
var cr = r.getClientRects(),
|
||||||
|
clickIsOnSelection = false,
|
||||||
|
i, rect;
|
||||||
|
|
||||||
|
for (i=0; i<cr.length; i++) {
|
||||||
|
rect = cr[i];
|
||||||
|
clickIsOnSelection = (
|
||||||
|
(x > rect.left) && (x < rect.right) &&
|
||||||
|
(y > rect.top) && (y < rect.bottom)
|
||||||
|
)
|
||||||
|
// If we clicked on selection and selection is not a single space,
|
||||||
|
// then mark the right click as copy-only. We check for the single
|
||||||
|
// space selection, as this can happen when clicking on an
|
||||||
|
// and there is not much pointing in copying a single space.
|
||||||
|
// Single space is char
|
||||||
|
if (clickIsOnSelection && (sText !== ' ')) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bring textarea at the cursor position
|
||||||
|
if (!clickIsOnSelection) {
|
||||||
|
term.textarea.style.position = 'fixed';
|
||||||
|
term.textarea.style.width = '10px';
|
||||||
|
term.textarea.style.height = '10px';
|
||||||
|
term.textarea.style.left = x + 'px';
|
||||||
|
term.textarea.style.top = y + 'px';
|
||||||
|
term.textarea.style.zIndex = 1000;
|
||||||
|
term.textarea.focus();
|
||||||
|
|
||||||
|
// Reset the terminal textarea's styling
|
||||||
|
setTimeout(function () {
|
||||||
|
term.textarea.style.position = null;
|
||||||
|
term.textarea.style.width = null;
|
||||||
|
term.textarea.style.height = null;
|
||||||
|
term.textarea.style.left = null;
|
||||||
|
term.textarea.style.top = null;
|
||||||
|
term.textarea.style.zIndex = null;
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
on(el, 'mousedown', function(ev) {
|
on(el, 'mousedown', function(ev) {
|
||||||
if (!self.mouseEvents) return;
|
if (!self.mouseEvents) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user