html: add empty check for copy

This commit is contained in:
Shuanglei Tao
2019-07-07 20:04:06 +08:00
parent 218b14943d
commit 39f89ce3ce
2 changed files with 2 additions and 1 deletions

View File

@@ -141,6 +141,7 @@ export class Xterm extends Component<Props> {
terminal.onResize(this.onTerminalResize);
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
terminal.onSelectionChange(() => {
if (terminal.getSelection() === '') return;
overlayAddon.showOverlay('\u2702', 200);
document.execCommand('copy');
});