@electerm/electerm-react 1.34.68 → 1.35.6
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.
- package/client/common/constants.js +3 -1
- package/client/common/key-pressed.js +1 -1
- package/client/common/rand-hex-color.js +28 -0
- package/client/components/batch-op/batch-op.jsx +6 -2
- package/client/components/bookmark-form/color-picker-item.jsx +14 -0
- package/client/components/bookmark-form/color-picker.jsx +90 -0
- package/client/components/bookmark-form/color-picker.styl +20 -0
- package/client/components/bookmark-form/form-ssh-common.jsx +4 -0
- package/client/components/bookmark-form/hex-input.jsx +39 -0
- package/client/components/bookmark-form/local-form-ui.jsx +1 -0
- package/client/components/bookmark-form/serial-form-ui.jsx +12 -8
- package/client/components/bookmark-form/ssh-form-ui.jsx +3 -0
- package/client/components/bookmark-form/telnet-form-ui.jsx +1 -0
- package/client/components/bookmark-form/use-ui.jsx +11 -1
- package/client/components/context-menu/context-menu.styl +1 -1
- package/client/components/context-menu/menu-btn.jsx +6 -3
- package/client/components/main/custom-css.jsx +28 -0
- package/client/components/main/main.jsx +5 -2
- package/client/components/session/session.jsx +11 -35
- package/client/components/session/sessions.jsx +15 -15
- package/client/components/setting-panel/setting.jsx +20 -32
- package/client/components/setting-panel/tab-settings.jsx +13 -10
- package/client/components/sftp/transfer-tag.jsx +2 -2
- package/client/components/sftp/transport-action.jsx +1 -0
- package/client/components/shortcuts/get-key-char.js +45 -0
- package/client/components/shortcuts/shortcut-control.jsx +72 -0
- package/client/components/shortcuts/shortcut-editor.jsx +194 -0
- package/client/components/shortcuts/shortcut-handler.js +75 -0
- package/client/components/shortcuts/shortcut.styl +0 -0
- package/client/components/shortcuts/shortcuts-defaults.js +92 -0
- package/client/components/shortcuts/shortcuts.jsx +166 -0
- package/client/components/sidebar/index.jsx +1 -1
- package/client/components/sidebar/transfer-history-modal.jsx +14 -2
- package/client/components/tabs/index.jsx +0 -25
- package/client/components/tabs/tab.jsx +6 -5
- package/client/components/terminal/index.jsx +95 -112
- package/client/components/terminal/term-search.jsx +9 -21
- package/client/components/terminal-theme/index.jsx +4 -3
- package/client/store/index.js +17 -2
- package/client/store/init-state.js +1 -8
- package/client/store/item.js +3 -0
- package/client/store/session.js +0 -22
- package/client/store/watch.js +3 -1
- package/client/views/index.pug +2 -0
- package/package.json +1 -1
|
@@ -80,7 +80,8 @@ export const footerHeight = 36
|
|
|
80
80
|
export const quickCommandBoxHeight = 180
|
|
81
81
|
export const isWin = typeof window.et.isWin === 'undefined' ? window.pre.isWin : window.et.isWin
|
|
82
82
|
export const isMac = typeof window.et.isMac === 'undefined' ? window.pre.isMac : window.et.isMac
|
|
83
|
-
export const
|
|
83
|
+
export const isMacJs = /Macintosh|Mac|Mac OS|MacIntel|MacPPC|Mac68K/gi.test(window.navigator.userAgent)
|
|
84
|
+
export const ctrlOrCmd = isMacJs ? 'cmd' : 'ctrl'
|
|
84
85
|
export const typeMap = buildConst([
|
|
85
86
|
'remote',
|
|
86
87
|
'local'
|
|
@@ -215,6 +216,7 @@ export const syncTokenCreateUrls = {
|
|
|
215
216
|
custom: 'https://github.com/electerm/electerm/wiki/Custom-sync-server'
|
|
216
217
|
}
|
|
217
218
|
export const settingSyncId = 'setting-sync'
|
|
219
|
+
export const settingShortcutsId = 'setting-shortcuts'
|
|
218
220
|
export const settingCommonId = 'setting-common'
|
|
219
221
|
export const defaultEnvLang = 'en_US.UTF-8'
|
|
220
222
|
const defaultThemeLightConf = _get(
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function getRandomHexColor () {
|
|
2
|
+
let color = '#'
|
|
3
|
+
const hexValues = '0123456789ABCDEF'
|
|
4
|
+
|
|
5
|
+
for (let i = 0; i < 6; i++) {
|
|
6
|
+
const index = Math.floor(Math.random() * 16)
|
|
7
|
+
color += hexValues[index]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return color
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const defaultColors = [
|
|
14
|
+
'#0366d6',
|
|
15
|
+
'#28a745',
|
|
16
|
+
'#d73a49',
|
|
17
|
+
'#ffab4a',
|
|
18
|
+
'#ffd33d',
|
|
19
|
+
'#6f42c1',
|
|
20
|
+
'#e99695',
|
|
21
|
+
'#24292e',
|
|
22
|
+
'#6a737d'
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
export const getRandomDefaultColor = () => {
|
|
26
|
+
const index = Math.floor(Math.random() * defaultColors.length)
|
|
27
|
+
return defaultColors[index]
|
|
28
|
+
}
|
|
@@ -182,6 +182,8 @@ export default class BatchOp extends Component {
|
|
|
182
182
|
toPath: resolveFilePath(isDown ? conf.localPath : conf.remotePath, name),
|
|
183
183
|
typeFrom: isDown ? 'remote' : 'local',
|
|
184
184
|
typeTo: isDown ? 'local' : 'remote',
|
|
185
|
+
skipExpand: true,
|
|
186
|
+
zip: true,
|
|
185
187
|
skipConfirm: true
|
|
186
188
|
}
|
|
187
189
|
postMsg({
|
|
@@ -195,7 +197,9 @@ export default class BatchOp extends Component {
|
|
|
195
197
|
}, 1000 * 60 * 60)
|
|
196
198
|
this.ref1 = autoRun(store, () => {
|
|
197
199
|
const { transferHistory } = store
|
|
198
|
-
const first = transferHistory.find(t =>
|
|
200
|
+
const first = transferHistory.find(t => {
|
|
201
|
+
return (t.id === obj.id || t.originalId === obj.id) && t.unzip
|
|
202
|
+
})
|
|
199
203
|
if (first && first.sessionId === tab.sessionId) {
|
|
200
204
|
this.ref1 && this.ref1.stop()
|
|
201
205
|
delete this.ref1
|
|
@@ -315,7 +319,7 @@ export default class BatchOp extends Component {
|
|
|
315
319
|
}
|
|
316
320
|
const res = {
|
|
317
321
|
host,
|
|
318
|
-
port,
|
|
322
|
+
port: Number(port),
|
|
319
323
|
username,
|
|
320
324
|
password
|
|
321
325
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Popover } from 'antd'
|
|
3
|
+
import { HexColorPicker } from 'react-colorful'
|
|
4
|
+
import { defaultColors, getRandomHexColor } from '../../common/rand-hex-color.js'
|
|
5
|
+
import { HexInput } from './hex-input.jsx'
|
|
6
|
+
|
|
7
|
+
// Your Custom Color Picker component
|
|
8
|
+
export const ColorPicker = React.forwardRef((props, ref) => {
|
|
9
|
+
const { value, onChange } = props
|
|
10
|
+
const [visible, setVisible] = useState(false)
|
|
11
|
+
|
|
12
|
+
const handleChange = (color) => {
|
|
13
|
+
onChange(color)
|
|
14
|
+
setVisible(false)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const handleVisibleChange = (vis) => {
|
|
18
|
+
setVisible(vis)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function renderContent () {
|
|
22
|
+
return (
|
|
23
|
+
<div className='color-picker-box'>
|
|
24
|
+
<div className='fix'>
|
|
25
|
+
<div className='fleft color-picker-defaults'>
|
|
26
|
+
{
|
|
27
|
+
[...defaultColors, 'random'].map((color) => {
|
|
28
|
+
const style = color === 'random'
|
|
29
|
+
? {
|
|
30
|
+
color: '#000'
|
|
31
|
+
}
|
|
32
|
+
: {
|
|
33
|
+
color
|
|
34
|
+
}
|
|
35
|
+
const props = {
|
|
36
|
+
className: 'color-picker-unit',
|
|
37
|
+
style,
|
|
38
|
+
onClick: () => {
|
|
39
|
+
if (color === 'random') {
|
|
40
|
+
return handleChange(getRandomHexColor())
|
|
41
|
+
}
|
|
42
|
+
handleChange(color)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
{...props}
|
|
48
|
+
key={color}
|
|
49
|
+
>
|
|
50
|
+
♦ {color}
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
</div>
|
|
56
|
+
<div className='fright'>
|
|
57
|
+
<HexColorPicker
|
|
58
|
+
color={value}
|
|
59
|
+
onChange={handleChange}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<div className='pd1y'>
|
|
64
|
+
<HexInput
|
|
65
|
+
value={value}
|
|
66
|
+
onChange={handleChange}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Popover
|
|
75
|
+
content={renderContent()}
|
|
76
|
+
trigger='click'
|
|
77
|
+
visible={visible}
|
|
78
|
+
placement='bottomLeft'
|
|
79
|
+
onVisibleChange={handleVisibleChange}
|
|
80
|
+
>
|
|
81
|
+
<div
|
|
82
|
+
ref={ref}
|
|
83
|
+
className='color-picker-choose'
|
|
84
|
+
style={{
|
|
85
|
+
backgroundColor: value
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</Popover>
|
|
89
|
+
)
|
|
90
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.color-picker-unit
|
|
2
|
+
display inline-block
|
|
3
|
+
padding 5px
|
|
4
|
+
margin-right 5px
|
|
5
|
+
margin-bottom 5px
|
|
6
|
+
border 1px solid #ccc
|
|
7
|
+
border-radius 5px
|
|
8
|
+
cursor pointer
|
|
9
|
+
background #fff
|
|
10
|
+
width 92px
|
|
11
|
+
.color-picker-box
|
|
12
|
+
width 420px
|
|
13
|
+
.react-colorful
|
|
14
|
+
height 200px
|
|
15
|
+
.color-picker-defaults
|
|
16
|
+
width 200px
|
|
17
|
+
.color-picker-choose
|
|
18
|
+
width 18px
|
|
19
|
+
height 18px
|
|
20
|
+
cursor pointer
|
|
@@ -17,6 +17,8 @@ import InputAutoFocus from '../common/input-auto-focus'
|
|
|
17
17
|
import encodes from './encodes'
|
|
18
18
|
import formatBookmarkGroups from './bookmark-group-tree-format'
|
|
19
19
|
import renderRunScripts from './render-delayed-scripts.jsx'
|
|
20
|
+
import { ColorPickerItem } from './color-picker-item.jsx'
|
|
21
|
+
|
|
20
22
|
import './bookmark-form.styl'
|
|
21
23
|
|
|
22
24
|
const authTypes = Object.keys(authTypeMap).map(k => {
|
|
@@ -76,8 +78,10 @@ export default function renderCommon (props) {
|
|
|
76
78
|
<InputAutoFocus
|
|
77
79
|
autofocustrigger={autofocustrigger}
|
|
78
80
|
selectall='yes'
|
|
81
|
+
name='host'
|
|
79
82
|
onBlur={props.onBlur}
|
|
80
83
|
onPaste={e => props.onPaste(e, form)}
|
|
84
|
+
addonBefore={<ColorPickerItem />}
|
|
81
85
|
/>
|
|
82
86
|
</FormItem>
|
|
83
87
|
</FormItem>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Input } from 'antd'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
CheckOutlined
|
|
5
|
+
} from '@ant-design/icons'
|
|
6
|
+
|
|
7
|
+
export const HexInput = (props) => {
|
|
8
|
+
const [v, setV] = useState(props.value.replace('#', ''))
|
|
9
|
+
const handleChange = (event) => {
|
|
10
|
+
const vv = event.target.value
|
|
11
|
+
const hexRegex = /^[0-9a-fA-F]{0,6}$/
|
|
12
|
+
if (hexRegex.test(vv)) {
|
|
13
|
+
setV(vv)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function submit () {
|
|
17
|
+
props.onChange('#' + v)
|
|
18
|
+
}
|
|
19
|
+
function renderAfter () {
|
|
20
|
+
if (!/^[0-9a-fA-F]{6}$/.test(v)) {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
return (
|
|
24
|
+
<CheckOutlined
|
|
25
|
+
className='pointer'
|
|
26
|
+
onClick={submit}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
return (
|
|
31
|
+
<Input
|
|
32
|
+
addonBefore='#'
|
|
33
|
+
{...props}
|
|
34
|
+
value={v}
|
|
35
|
+
onChange={handleChange}
|
|
36
|
+
addonAfter={renderAfter()}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -32,6 +32,8 @@ import useUI from './use-ui'
|
|
|
32
32
|
import useQm from './use-quick-commands'
|
|
33
33
|
import copy from 'json-deep-copy'
|
|
34
34
|
import { defaults } from 'lodash-es'
|
|
35
|
+
import { getRandomDefaultColor } from '../../common/rand-hex-color.js'
|
|
36
|
+
import { ColorPickerItem } from './color-picker-item.jsx'
|
|
35
37
|
|
|
36
38
|
const FormItem = Form.Item
|
|
37
39
|
const { Option } = Select
|
|
@@ -68,6 +70,7 @@ export default function SerialFormUi (props) {
|
|
|
68
70
|
: currentBookmarkGroupId
|
|
69
71
|
let initialValues = copy(props.formData)
|
|
70
72
|
const defaultValues = {
|
|
73
|
+
color: getRandomDefaultColor(),
|
|
71
74
|
baudRate: 9600,
|
|
72
75
|
dataBits: 8,
|
|
73
76
|
lock: true,
|
|
@@ -79,6 +82,7 @@ export default function SerialFormUi (props) {
|
|
|
79
82
|
xany: false,
|
|
80
83
|
type: terminalSerialType,
|
|
81
84
|
term: defaultSettings.terminalType,
|
|
85
|
+
displayRaw: false,
|
|
82
86
|
category: initBookmarkGroupId,
|
|
83
87
|
runScripts: [{}],
|
|
84
88
|
ignoreKeyboardInteractive: false
|
|
@@ -93,6 +97,14 @@ export default function SerialFormUi (props) {
|
|
|
93
97
|
const tree = formatBookmarkGroups(bookmarkGroups)
|
|
94
98
|
return (
|
|
95
99
|
<div className='pd1x'>
|
|
100
|
+
<FormItem
|
|
101
|
+
{...formItemLayout}
|
|
102
|
+
label={e('title')}
|
|
103
|
+
name='title'
|
|
104
|
+
hasFeedback
|
|
105
|
+
>
|
|
106
|
+
<Input addonBefore={<ColorPickerItem />} />
|
|
107
|
+
</FormItem>
|
|
96
108
|
<FormItem
|
|
97
109
|
{...formItemLayout}
|
|
98
110
|
label='path'
|
|
@@ -232,14 +244,6 @@ export default function SerialFormUi (props) {
|
|
|
232
244
|
>
|
|
233
245
|
<Switch />
|
|
234
246
|
</FormItem>
|
|
235
|
-
<FormItem
|
|
236
|
-
{...formItemLayout}
|
|
237
|
-
label={e('title')}
|
|
238
|
-
name='title'
|
|
239
|
-
hasFeedback
|
|
240
|
-
>
|
|
241
|
-
<Input />
|
|
242
|
-
</FormItem>
|
|
243
247
|
<FormItem
|
|
244
248
|
{...formItemLayout}
|
|
245
249
|
label={e('description')}
|
|
@@ -25,6 +25,7 @@ import renderX11 from './x11'
|
|
|
25
25
|
import renderAuth from './render-auth-ssh'
|
|
26
26
|
import renderSshTunnel from './render-ssh-tunnel'
|
|
27
27
|
import renderConnectionHopping from './render-connection-hopping'
|
|
28
|
+
import { getRandomDefaultColor } from '../../common/rand-hex-color.js'
|
|
28
29
|
import './bookmark-form.styl'
|
|
29
30
|
|
|
30
31
|
export default function BookmarkFormUI (props) {
|
|
@@ -58,7 +59,9 @@ export default function BookmarkFormUI (props) {
|
|
|
58
59
|
port: 22,
|
|
59
60
|
authType: authTypeMap.password,
|
|
60
61
|
id: '',
|
|
62
|
+
color: getRandomDefaultColor(),
|
|
61
63
|
term: props.store.config.terminalType,
|
|
64
|
+
displayRaw: false,
|
|
62
65
|
encode: encodes[0],
|
|
63
66
|
envLang: defaultEnvLang,
|
|
64
67
|
enableSsh: true,
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
Input,
|
|
11
11
|
InputNumber,
|
|
12
12
|
AutoComplete,
|
|
13
|
-
Form
|
|
13
|
+
Form,
|
|
14
|
+
Switch
|
|
14
15
|
} from 'antd'
|
|
15
16
|
import { formItemLayout } from '../../common/form-layout'
|
|
16
17
|
import defaultSettings from '../../common/default-setting'
|
|
@@ -54,6 +55,15 @@ export default function useBookmarkFormUI (props) {
|
|
|
54
55
|
options={terminalTypes.map(mapper)}
|
|
55
56
|
/>
|
|
56
57
|
</FormItem>,
|
|
58
|
+
<FormItem
|
|
59
|
+
{...formItemLayout}
|
|
60
|
+
label={e('displayRaw')}
|
|
61
|
+
name='displayRaw'
|
|
62
|
+
key='displayRaw'
|
|
63
|
+
valuePropName='checked'
|
|
64
|
+
>
|
|
65
|
+
<Switch />
|
|
66
|
+
</FormItem>,
|
|
57
67
|
<FormItem
|
|
58
68
|
{...formItemLayout}
|
|
59
69
|
label={s('fontFamily')}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Component } from '../common/react-subx'
|
|
6
6
|
import logoRef from '@electerm/electerm-resource/res/imgs/electerm.svg'
|
|
7
|
-
import { commonActions
|
|
7
|
+
import { commonActions } from '../../common/constants'
|
|
8
|
+
import { shortcutDescExtend } from '../shortcuts/shortcut-handler.js'
|
|
8
9
|
import generate from '../../common/uid'
|
|
9
10
|
|
|
10
11
|
const { prefix } = window
|
|
@@ -15,7 +16,7 @@ const t = prefix('tabs')
|
|
|
15
16
|
const s = prefix('setting')
|
|
16
17
|
const logo = logoRef.replace(/^\//, '')
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
class MenuBtn extends Component {
|
|
19
20
|
state = {
|
|
20
21
|
opened: false
|
|
21
22
|
}
|
|
@@ -109,7 +110,7 @@ export default class MenuBtn extends Component {
|
|
|
109
110
|
func: 'onNewSsh',
|
|
110
111
|
icon: 'CodeFilled',
|
|
111
112
|
text: e('newBookmark'),
|
|
112
|
-
subText:
|
|
113
|
+
subText: this.getShortcut('app_newBookmark')
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
116
|
func: 'addTab',
|
|
@@ -222,3 +223,5 @@ export default class MenuBtn extends Component {
|
|
|
222
223
|
)
|
|
223
224
|
}
|
|
224
225
|
}
|
|
226
|
+
|
|
227
|
+
export default shortcutDescExtend(MenuBtn)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ui theme
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { useEffect } from 'react'
|
|
6
|
+
import { useDelta, useConditionalEffect } from 'react-delta'
|
|
7
|
+
import eq from 'fast-deep-equal'
|
|
8
|
+
|
|
9
|
+
const themeDomId = 'custom-css'
|
|
10
|
+
|
|
11
|
+
export default function CustomCss (props) {
|
|
12
|
+
const { customCss } = props
|
|
13
|
+
|
|
14
|
+
const delta = useDelta(customCss)
|
|
15
|
+
|
|
16
|
+
async function applyTheme () {
|
|
17
|
+
const stylus = document.getElementById(themeDomId)
|
|
18
|
+
stylus.innerHTML = customCss
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
applyTheme()
|
|
23
|
+
}, [])
|
|
24
|
+
useConditionalEffect(() => {
|
|
25
|
+
applyTheme()
|
|
26
|
+
}, delta && delta.prev && !eq(delta.prev, delta.curr))
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
@@ -10,8 +10,10 @@ import Sidebar from '../sidebar'
|
|
|
10
10
|
import BatchOp from '../batch-op/batch-op'
|
|
11
11
|
import CssOverwrite from './css-overwrite'
|
|
12
12
|
import UiTheme from './ui-theme'
|
|
13
|
+
import CustomCss from './custom-css.jsx'
|
|
13
14
|
import TerminalInteractive from '../terminal/terminal-interactive'
|
|
14
15
|
import classnames from 'classnames'
|
|
16
|
+
import ShortcutControl from '../shortcuts/shortcut-control.jsx'
|
|
15
17
|
import { isMac, isWin } from '../../common/constants'
|
|
16
18
|
import TermFullscreenControl from './term-fullscreen-control'
|
|
17
19
|
import { LoadingUI } from './loading'
|
|
@@ -50,7 +52,6 @@ export default class Index extends Component {
|
|
|
50
52
|
})
|
|
51
53
|
window.addEventListener('offline', store.setOffline)
|
|
52
54
|
window.addEventListener('mousewheel', store.onMouseWheel)
|
|
53
|
-
window.addEventListener('keydown', store.onKeyDown)
|
|
54
55
|
store.isSencondInstance = window.pre.runSync('isSencondInstance')
|
|
55
56
|
store.initData()
|
|
56
57
|
store.checkForDbUpgrade()
|
|
@@ -106,6 +107,7 @@ export default class Index extends Component {
|
|
|
106
107
|
theme={uiThemeConfig}
|
|
107
108
|
>
|
|
108
109
|
<div {...ext1}>
|
|
110
|
+
<ShortcutControl config={config} />
|
|
109
111
|
<LoadingUI
|
|
110
112
|
wsInited={wsInited}
|
|
111
113
|
/>
|
|
@@ -121,7 +123,8 @@ export default class Index extends Component {
|
|
|
121
123
|
{...themeProps}
|
|
122
124
|
buildTheme={store.buildTheme}
|
|
123
125
|
/>
|
|
124
|
-
<
|
|
126
|
+
<CustomCss customCss={config.customCss} />
|
|
127
|
+
<TextEditor customCss={cpConf.customCss} />
|
|
125
128
|
<UpdateCheck
|
|
126
129
|
skipVersion={cpConf.skipVersion}
|
|
127
130
|
upgradeInfo={upgradeInfo}
|
|
@@ -21,14 +21,11 @@ import {
|
|
|
21
21
|
terminalSplitDirectionMap,
|
|
22
22
|
termControlHeight,
|
|
23
23
|
paneMap,
|
|
24
|
-
ctrlOrCmd,
|
|
25
24
|
footerHeight,
|
|
26
25
|
terminalActions,
|
|
27
26
|
connectionMap
|
|
28
27
|
} from '../../common/constants'
|
|
29
28
|
import ResizeWrap from '../common/resize-wrap'
|
|
30
|
-
import keyControlPressed from '../../common/key-control-pressed'
|
|
31
|
-
import keyPressed from '../../common/key-pressed'
|
|
32
29
|
import safeName from '../../common/safe-name'
|
|
33
30
|
import TerminalInfoContent from '../terminal-info/content'
|
|
34
31
|
import uid from '../../common/id-with-stamp'
|
|
@@ -88,38 +85,17 @@ export default class SessionWrapper extends Component {
|
|
|
88
85
|
|
|
89
86
|
componentDidMount () {
|
|
90
87
|
this.updateTab()
|
|
91
|
-
this.initEvent()
|
|
88
|
+
// this.initEvent()
|
|
92
89
|
}
|
|
93
90
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
destroyEvent () {
|
|
103
|
-
window.removeEventListener('keydown', this.handleEvent)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
isActive () {
|
|
107
|
-
const {
|
|
108
|
-
tab,
|
|
109
|
-
currentTabId
|
|
110
|
-
} = this.props
|
|
111
|
-
return currentTabId === tab.id &&
|
|
112
|
-
tab.pane === paneMap.terminal
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
handleEvent = (e) => {
|
|
116
|
-
if (!this.isActive()) {
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
if (keyControlPressed(e) && keyPressed(e, '/')) {
|
|
120
|
-
this.handleSplit()
|
|
121
|
-
}
|
|
122
|
-
}
|
|
91
|
+
// isActive () {
|
|
92
|
+
// const {
|
|
93
|
+
// tab,
|
|
94
|
+
// currentTabId
|
|
95
|
+
// } = this.props
|
|
96
|
+
// return currentTabId === tab.id &&
|
|
97
|
+
// tab.pane === paneMap.terminal
|
|
98
|
+
// }
|
|
123
99
|
|
|
124
100
|
handleShowInfo = (infoPanelProps) => {
|
|
125
101
|
this.setState({
|
|
@@ -383,7 +359,7 @@ export default class SessionWrapper extends Component {
|
|
|
383
359
|
return (
|
|
384
360
|
<Tooltip title={title}>
|
|
385
361
|
<FullscreenOutlined
|
|
386
|
-
className='mg1r icon-info font16 iblock pointer spliter'
|
|
362
|
+
className='mg1r icon-info font16 iblock pointer spliter term-fullscreen-control1'
|
|
387
363
|
onClick={this.handleFullscreen}
|
|
388
364
|
/>
|
|
389
365
|
</Tooltip>
|
|
@@ -464,7 +440,7 @@ export default class SessionWrapper extends Component {
|
|
|
464
440
|
)
|
|
465
441
|
}
|
|
466
442
|
<Tooltip
|
|
467
|
-
title={`${e('split')}
|
|
443
|
+
title={`${e('split')}`}
|
|
468
444
|
>
|
|
469
445
|
<Icon1
|
|
470
446
|
className={cls1}
|
|
@@ -14,8 +14,6 @@ import {
|
|
|
14
14
|
statusMap
|
|
15
15
|
} from '../../common/constants'
|
|
16
16
|
import newTerm, { updateCount } from '../../common/new-terminal'
|
|
17
|
-
import keyControlPress from '../../common/key-control-pressed'
|
|
18
|
-
import keyPressed from '../../common/key-pressed'
|
|
19
17
|
import postMsg from '../../common/post-msg'
|
|
20
18
|
import TermSearch from '../terminal/term-search'
|
|
21
19
|
import Footer from '../footer/footer-entry'
|
|
@@ -23,12 +21,13 @@ import QuickCommandsFooterBox from '../quick-commands/quick-commands-box'
|
|
|
23
21
|
import LogoElem from '../common/logo-elem'
|
|
24
22
|
import { Button } from 'antd'
|
|
25
23
|
import toSimpleObj from '../../common/to-simple-obj'
|
|
24
|
+
import { shortcutExtend } from '../shortcuts/shortcut-handler.js'
|
|
26
25
|
|
|
27
26
|
const { prefix } = window
|
|
28
27
|
const e = prefix('tabs')
|
|
29
28
|
const c = prefix('control')
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
class Sessions extends Component {
|
|
32
31
|
state = {
|
|
33
32
|
tabs: [],
|
|
34
33
|
currentTabId: ''
|
|
@@ -40,16 +39,14 @@ export default class Sessions extends Component {
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
initShortcuts () {
|
|
43
|
-
window.addEventListener('keydown',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
})
|
|
42
|
+
window.addEventListener('keydown', this.handleKeyboardEvent.bind(this))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
closeCurrentTabShortcut = (e) => {
|
|
46
|
+
e.stopPropagation()
|
|
47
|
+
this.delTab(
|
|
48
|
+
this.state.currentTabId
|
|
49
|
+
)
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
watch = () => {
|
|
@@ -418,11 +415,12 @@ export default class Sessions extends Component {
|
|
|
418
415
|
}
|
|
419
416
|
|
|
420
417
|
render () {
|
|
421
|
-
const { store } = this.props
|
|
418
|
+
const { store, config } = this.props
|
|
422
419
|
const currentTab = this.getCurrentTab()
|
|
423
420
|
const termProps = {
|
|
424
421
|
currentTab,
|
|
425
|
-
store
|
|
422
|
+
store,
|
|
423
|
+
config
|
|
426
424
|
}
|
|
427
425
|
return [
|
|
428
426
|
this.renderTabs(),
|
|
@@ -443,3 +441,5 @@ export default class Sessions extends Component {
|
|
|
443
441
|
]
|
|
444
442
|
}
|
|
445
443
|
}
|
|
444
|
+
|
|
445
|
+
export default shortcutExtend(Sessions)
|