Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
901d8e2366 |
@ -67,16 +67,13 @@ class Term extends Component {
|
||||
this.setState({
|
||||
selection: selection
|
||||
})
|
||||
if (navigator.clipboard) {
|
||||
await navigator.clipboard.writeText(selection);
|
||||
}
|
||||
});
|
||||
|
||||
term.attachCustomKeyEventHandler((e) => {
|
||||
if (e.ctrlKey && e.key === 'c' && this.state.selection) {
|
||||
return false;
|
||||
}
|
||||
return !(e.ctrlKey && e.key === 'v');
|
||||
return true;
|
||||
});
|
||||
|
||||
document.body.oncopy = (event) => {
|
||||
@ -84,14 +81,8 @@ class Term extends Component {
|
||||
if (this.state.session['copy'] === '0') {
|
||||
// message.warn('禁止复制')
|
||||
return false;
|
||||
}else {
|
||||
if (event.clipboardData) {
|
||||
return event.clipboardData.setData('text', '');
|
||||
} else {
|
||||
// 兼容IE
|
||||
return window.clipboardData.setData("text", '');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
document.body.onpaste = (event) => {
|
||||
|
Loading…
Reference in New Issue
Block a user