From: Shuanglei Tao Date: Sun, 7 Jul 2019 12:04:06 +0000 (+0800) Subject: html: add empty check for copy X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=39f89ce3ce814c431751fbc288b52bd94af7a6ea;p=ttyd.git html: add empty check for copy --- 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