fix(web): allow pasting with cmd-v (#4321)
This commit is contained in:
parent
be20acaa3e
commit
aaa843eee0
2 changed files with 19 additions and 6 deletions
|
|
@ -2,7 +2,8 @@
|
|||
* Input handling for terminal events
|
||||
*/
|
||||
|
||||
import { encode_kitty_key } from './keyboard.js';
|
||||
import { encode_kitty_key } from "./keyboard.js";
|
||||
import { isMac } from "./utils.js";
|
||||
|
||||
/**
|
||||
* Set up all input handlers for the terminal
|
||||
|
|
@ -21,6 +22,11 @@ export function setupInputHandlers(term, sendFunction) {
|
|||
// pass ctrl-shift-v onwards so that paste is interpreted by xterm.js
|
||||
return;
|
||||
}
|
||||
if (isMac() && ev.key == "v" && ev.metaKey) {
|
||||
// pass cmd-v onwards so that paste is interpreted by xterm.js
|
||||
return;
|
||||
}
|
||||
|
||||
let modifiers_count = 0;
|
||||
let shift_keycode = 16;
|
||||
let alt_keycode = 17;
|
||||
|
|
@ -107,7 +113,7 @@ export function setupInputHandlers(term, sendFunction) {
|
|||
});
|
||||
|
||||
// Context menu handler
|
||||
document.addEventListener('contextmenu', function(event) {
|
||||
document.addEventListener("contextmenu", function (event) {
|
||||
if (event.altKey) {
|
||||
// this is so that when the user does an alt-right-click to ungroup panes, the context menu will not appear
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -9,3 +9,10 @@
|
|||
export function is_https() {
|
||||
return document.location.protocol === "https:";
|
||||
}
|
||||
|
||||
export function isMac() {
|
||||
if (navigator.userAgentData && navigator.userAgentData.platform) {
|
||||
return navigator.userAgentData.platform === "macOS";
|
||||
}
|
||||
return navigator.platform.toUpperCase().includes("MAC");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue