ar08 commited on
Commit
8acffa8
1 Parent(s): fd6bc47

Update pyxtermjs/index.html

Browse files
Files changed (1) hide show
  1. pyxtermjs/index.html +26 -27
pyxtermjs/index.html CHANGED
@@ -154,35 +154,34 @@
154
  * Handle copy and paste events
155
  */
156
  function customKeyEventHandler(e) {
157
- if (e.type !== "keydown") {
158
- return true;
159
- }
160
- if (e.ctrlKey && e.shiftKey) {
161
- const key = e.key.toLowerCase();
162
- if (key === "v") {
163
- // ctrl+shift+v: paste whatever is in the clipboard
164
- navigator.clipboard.readText().then((toPaste) => {
165
- socket.emit("pty-input", { input: toPaste });
166
- });
167
-
168
- // Prevent default paste action
169
- e.preventDefault();
170
-
171
- return false;
172
- } else if (key === "c" || key === "x") {
173
- // ctrl+shift+x: copy whatever is highlighted to clipboard
174
- const toCopy = term.getSelection();
175
- if (toCopy) {
176
- navigator.clipboard.writeText(toCopy).then(() => {
177
- term.focus();
178
- });
179
  }
180
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
182
- }
183
- return true;
184
- }
185
-
186
 
187
  const wait_ms = 50;
188
  window.onresize = debounce(fitToscreen, wait_ms);
 
154
  * Handle copy and paste events
155
  */
156
  function customKeyEventHandler(e) {
157
+ if (e.type !== "keydown") {
158
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
+ if (e.ctrlKey && e.shiftKey) {
161
+ const key = e.key.toLowerCase();
162
+ if (key === "v") {
163
+ // ctrl+shift+v: paste whatever is in the clipboard
164
+ navigator.clipboard.readText().then((toPaste) => {
165
+ socket.emit("pty-input", { input: toPaste });
166
+ });
167
+
168
+ // Prevent default paste action
169
+ e.preventDefault();
170
+
171
+ return false;
172
+ } else if (key === "c" || key === "x") {
173
+ // ctrl+shift+x: copy whatever is highlighted to clipboard
174
+ const toCopy = term.getSelection();
175
+ if (toCopy) {
176
+ navigator.clipboard.writeText(toCopy).then(() => {
177
+ term.focus();
178
+ });
179
+ }
180
+ return false;
181
+ }
182
+ }
183
+ return true;
184
  }
 
 
 
 
185
 
186
  const wait_ms = 50;
187
  window.onresize = debounce(fitToscreen, wait_ms);