From 39f89ce3ce814c431751fbc288b52bd94af7a6ea Mon Sep 17 00:00:00 2001 From: Shuanglei Tao Date: Sun, 7 Jul 2019 20:04:06 +0800 Subject: [PATCH] html: add empty check for copy --- html/src/components/terminal/index.tsx | 1 + src/index.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/html/src/components/terminal/index.tsx b/html/src/components/terminal/index.tsx index f582083..42660ec 100644 --- a/html/src/components/terminal/index.tsx +++ b/html/src/components/terminal/index.tsx @@ -141,6 +141,7 @@ export class Xterm extends Component { terminal.onResize(this.onTerminalResize); if (document.queryCommandSupported && document.queryCommandSupported('copy')) { terminal.onSelectionChange(() => { + if (terminal.getSelection() === '') return; overlayAddon.showOverlay('\u2702', 200); document.execCommand('copy'); }); diff --git a/src/index.html b/src/index.html index 2ae309a..d5c6a3d 100644 --- a/src/index.html +++ b/src/index.html @@ -1 +1 @@ -ttyd - Terminal \ No newline at end of file +ttyd - Terminal \ No newline at end of file -- 2.43.4