@electerm/electerm-react 1.37.80 → 1.37.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,6 +14,14 @@ export const readClipboard = () => {
|
|
|
14
14
|
return window.pre.readClipboard()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export const readClipboardAsync = () => {
|
|
18
|
+
const {
|
|
19
|
+
readClipboardSync,
|
|
20
|
+
readClipboard
|
|
21
|
+
} = window.pre
|
|
22
|
+
return readClipboardSync ? readClipboardSync() : Promise.resolve(readClipboard())
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
export const copy = (str) => {
|
|
18
26
|
message.success({
|
|
19
27
|
content: 'Copied',
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
rendererTypes
|
|
29
29
|
} from '../../common/constants'
|
|
30
30
|
import deepCopy from 'json-deep-copy'
|
|
31
|
-
import {
|
|
31
|
+
import { readClipboardAsync, copy } from '../../common/clipboard'
|
|
32
32
|
import { FitAddon } from 'xterm-addon-fit'
|
|
33
33
|
import AttachAddon from './attach-addon-custom'
|
|
34
34
|
import { SearchAddon } from 'xterm-addon-search'
|
|
@@ -646,12 +646,12 @@ class Term extends Component {
|
|
|
646
646
|
this.props.tab?.type !== terminalSshConfigType
|
|
647
647
|
}
|
|
648
648
|
|
|
649
|
-
onPaste = () => {
|
|
650
|
-
let selected =
|
|
649
|
+
onPaste = async () => {
|
|
650
|
+
let selected = await readClipboardAsync()
|
|
651
651
|
if (isWin && this.isRemote()) {
|
|
652
652
|
selected = selected.replace(/\r\n/g, '\n')
|
|
653
653
|
}
|
|
654
|
-
this.term.paste(selected)
|
|
654
|
+
this.term.paste(selected || '')
|
|
655
655
|
this.term.focus()
|
|
656
656
|
}
|
|
657
657
|
|
|
@@ -680,7 +680,7 @@ class Term extends Component {
|
|
|
680
680
|
|
|
681
681
|
renderContext = () => {
|
|
682
682
|
const hasSlected = this.term.hasSelection()
|
|
683
|
-
const copyed =
|
|
683
|
+
const copyed = true
|
|
684
684
|
const copyShortcut = this.getShortcut('terminal_copy')
|
|
685
685
|
const pasteShortcut = this.getShortcut('terminal_paste')
|
|
686
686
|
const clearShortcut = this.getShortcut('terminal_clear')
|