Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit effcf64

Browse files
committed
web_netcat: implement copy with Ctrl + Shift + C
By default, modern browsers might start devtools when users press Ctrl + Shift + C. This commit prevents this behavior and do the copy with execCommand.
1 parent 4311cbf commit effcf64

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎web_netcat/static/index.html‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
letterSpacing: 0,
2626
fontFamily: 'monospace',
2727
});
28+
term.attachCustomKeyEventHandler((e) => {
29+
// Ctrl + Shift + C, to prevent browser from opening devtools
30+
if (e.ctrlKey && e.shiftKey && e.keyCode == 67) {
31+
e.preventDefault();
32+
const success = document.execCommand('copy');
33+
if (!success) {
34+
console.error('Failed to copy to clipboard');
35+
}
36+
}
37+
});
2838
const fitAddon = new FitAddon.FitAddon();
2939
term.loadAddon(fitAddon);
3040
term.open(document.getElementById("terminal"));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /