@electerm/electerm-react 1.36.1 → 1.37.1
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 +4 -1
- package/client/common/default-setting.js +2 -1
- package/client/components/auth/login.jsx +2 -0
- package/client/components/main/main.jsx +0 -1
- package/client/components/setting-panel/keywords-form.jsx +0 -1
- package/client/components/setting-panel/setting-common.jsx +1 -0
- package/client/components/shortcuts/shortcut-control.jsx +8 -3
- package/client/components/sidebar/bookmark-select.jsx +4 -4
- package/client/components/sidebar/sidebar.styl +2 -3
- package/client/components/tabs/app-drag.jsx +50 -0
- package/client/components/tabs/index.jsx +44 -59
- package/client/components/tabs/tab-title.jsx +15 -0
- package/client/components/tabs/tab.jsx +3 -5
- package/client/components/tabs/tabs.styl +6 -22
- package/client/components/tabs/window-control.jsx +5 -1
- package/client/components/terminal/highlight-addon.js +0 -1
- package/client/components/terminal/index.jsx +35 -5
- package/client/components/terminal/terminal-apis.js +8 -0
- package/client/components/terminal-info/base.jsx +110 -17
- package/client/css/basic.styl +4 -1
- package/client/store/bookmark-group.js +1 -1
- package/client/store/event.js +1 -0
- package/client/store/index.js +3 -3
- package/client/store/init-state.js +130 -128
- package/client/store/load-data.js +3 -1
- package/client/store/session.js +1 -16
- package/package.json +1 -1
|
@@ -35,7 +35,7 @@ export const filePropMinWidth = 1
|
|
|
35
35
|
export const contextMenuHeight = 28
|
|
36
36
|
export const contextMenuWidth = 280
|
|
37
37
|
export const contextMenuPaddingTop = 10
|
|
38
|
-
export const sftpControlHeight = 28 + 42 + 33 +
|
|
38
|
+
export const sftpControlHeight = 28 + 42 + 33 + 46
|
|
39
39
|
export const sidebarWidth = 43
|
|
40
40
|
export const sidebarPanelWidth = 300
|
|
41
41
|
export const maxHistory = 50
|
|
@@ -258,6 +258,9 @@ export const tabActions = {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
export const commonActions = {
|
|
261
|
+
returnTermLogState: 'return-term-log-state',
|
|
262
|
+
getTermLogState: 'get-term-log-state',
|
|
263
|
+
setTermLogState: 'set-term-log-state',
|
|
261
264
|
batchOp: 'batch-op',
|
|
262
265
|
updateStore: 'update-store',
|
|
263
266
|
editWithSystemEditorDone: 'edit-with-system-editor-done',
|
|
@@ -51,7 +51,6 @@ export default class Index extends Component {
|
|
|
51
51
|
e.stopPropagation()
|
|
52
52
|
})
|
|
53
53
|
window.addEventListener('offline', store.setOffline)
|
|
54
|
-
window.addEventListener('mousewheel', store.onMouseWheel)
|
|
55
54
|
store.isSencondInstance = window.pre.runSync('isSencondInstance')
|
|
56
55
|
store.initData()
|
|
57
56
|
store.checkForDbUpgrade()
|
|
@@ -53,15 +53,20 @@ class ShortcutControl extends React.PureComponent {
|
|
|
53
53
|
|
|
54
54
|
zoominTerminalShortcut = (event) => {
|
|
55
55
|
if (window.store.inActiveTerminal) {
|
|
56
|
-
window.store.zoomTerminal(event.wheelDeltaY)
|
|
56
|
+
window.store.zoomTerminal(event.wheelDeltaY || 120)
|
|
57
57
|
} else {
|
|
58
|
-
const plus =
|
|
58
|
+
const plus = 0.2
|
|
59
59
|
window.store.zoom(plus, true)
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
zoomoutTerminalShortcut = (event) => {
|
|
64
|
-
|
|
64
|
+
if (window.store.inActiveTerminal) {
|
|
65
|
+
window.store.zoomTerminal(event.wheelDeltaY || -120)
|
|
66
|
+
} else {
|
|
67
|
+
const plus = -0.2
|
|
68
|
+
window.store.zoom(plus, true)
|
|
69
|
+
}
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
render () {
|
|
@@ -24,15 +24,15 @@ export default class BookmarkSelect extends Component {
|
|
|
24
24
|
}
|
|
25
25
|
const base = {
|
|
26
26
|
store,
|
|
27
|
-
bookmarks: [
|
|
28
|
-
...(store.getBookmarks() || []),
|
|
29
|
-
...store.sshConfigItems
|
|
30
|
-
],
|
|
27
|
+
bookmarks: store.getBookmarks() || [],
|
|
31
28
|
type: 'bookmarks',
|
|
32
29
|
onClickItem,
|
|
33
30
|
listStyle,
|
|
34
31
|
staticList: true
|
|
35
32
|
}
|
|
33
|
+
if (!store.config.hideSshConfig) {
|
|
34
|
+
base.bookmarks.push(...store.sshConfigItems)
|
|
35
|
+
}
|
|
36
36
|
const propsTree = {
|
|
37
37
|
...base,
|
|
38
38
|
shouldConfirmDel: true,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.sidebar-panel
|
|
5
5
|
position absolute
|
|
6
6
|
left 43px
|
|
7
|
-
top
|
|
7
|
+
top 46px
|
|
8
8
|
bottom 36px
|
|
9
9
|
z-index 200
|
|
10
10
|
width 0
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
.item-list-unit:hover
|
|
15
15
|
.list-item-remove
|
|
16
16
|
display none !important
|
|
17
|
-
|
|
18
|
-
top 45px
|
|
17
|
+
|
|
19
18
|
.pinned .sidebar-panel
|
|
20
19
|
bottom 0
|
|
21
20
|
.sidebar
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export default function AppDrag (props) {
|
|
2
|
+
function canOperate (e) {
|
|
3
|
+
const {
|
|
4
|
+
target
|
|
5
|
+
} = e
|
|
6
|
+
if (
|
|
7
|
+
target instanceof window.SVGElement ||
|
|
8
|
+
target.classList.contains('tab-title') ||
|
|
9
|
+
target.classList.contains('tab-title')
|
|
10
|
+
) {
|
|
11
|
+
window.pre.runSync('windowMove', false)
|
|
12
|
+
return false
|
|
13
|
+
}
|
|
14
|
+
return true
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function onMouseDown (e) {
|
|
18
|
+
if (canOperate(e)) {
|
|
19
|
+
window.pre.runSync('windowMove', true)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function onMouseUp (e) {
|
|
24
|
+
window.pre.runSync('windowMove', false)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onDoubleClick (e) {
|
|
28
|
+
if (!canOperate(e)) {
|
|
29
|
+
return window.pre.runSync('windowMove', false)
|
|
30
|
+
}
|
|
31
|
+
const {
|
|
32
|
+
isMaximized
|
|
33
|
+
} = window.store
|
|
34
|
+
if (isMaximized) {
|
|
35
|
+
window.pre.runGlobalAsync('unmaximize')
|
|
36
|
+
} else {
|
|
37
|
+
window.pre.runGlobalAsync('maximize')
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
className='app-drag'
|
|
43
|
+
onMouseDown={onMouseDown}
|
|
44
|
+
onMouseUp={onMouseUp}
|
|
45
|
+
onDoubleClick={onDoubleClick}
|
|
46
|
+
>
|
|
47
|
+
{props.children}
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react'
|
|
7
7
|
import { findIndex } from 'lodash-es'
|
|
8
|
-
|
|
8
|
+
import TabTitle from './tab-title'
|
|
9
9
|
import {
|
|
10
10
|
CodeFilled,
|
|
11
11
|
DownOutlined,
|
|
@@ -19,11 +19,10 @@ import { Dropdown, Menu, Popover } from 'antd'
|
|
|
19
19
|
import Tab from './tab'
|
|
20
20
|
import './tabs.styl'
|
|
21
21
|
import { tabWidth, tabMargin, extraTabWidth, windowControlWidth } from '../../common/constants'
|
|
22
|
-
import createName from '../../common/create-title'
|
|
23
22
|
import findParentBySel from '../../common/find-parent'
|
|
24
23
|
import WindowControl from './window-control'
|
|
25
24
|
import BookmarksList from '../sidebar/bookmark-select'
|
|
26
|
-
import
|
|
25
|
+
import AppDrag from './app-drag'
|
|
27
26
|
|
|
28
27
|
const { prefix } = window
|
|
29
28
|
const e = prefix('tabs')
|
|
@@ -42,7 +41,6 @@ export default class Tabs extends React.Component {
|
|
|
42
41
|
const {
|
|
43
42
|
tabsRef
|
|
44
43
|
} = this
|
|
45
|
-
tabsRef.current.addEventListener('dblclick', this.handleDblClickEvent)
|
|
46
44
|
tabsRef.current.addEventListener('mousedown', this.handleClickEvent)
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -70,7 +68,7 @@ export default class Tabs extends React.Component {
|
|
|
70
68
|
const len = tabs.length
|
|
71
69
|
const addBtnWidth = 22
|
|
72
70
|
const tabsWidth = this.tabsWidth()
|
|
73
|
-
const tabsWidthAll = tabMargin * len +
|
|
71
|
+
const tabsWidthAll = tabMargin * len + 216 + tabsWidth
|
|
74
72
|
return width < (tabsWidthAll + addBtnWidth)
|
|
75
73
|
}
|
|
76
74
|
|
|
@@ -84,23 +82,6 @@ export default class Tabs extends React.Component {
|
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
|
|
87
|
-
handleDblClickEvent = e => {
|
|
88
|
-
const t = e.target
|
|
89
|
-
if (
|
|
90
|
-
hasClass(t, 'app-drag-area') ||
|
|
91
|
-
hasClass(t, 'tabs-inner')
|
|
92
|
-
) {
|
|
93
|
-
const {
|
|
94
|
-
isMaximized
|
|
95
|
-
} = window.store
|
|
96
|
-
if (isMaximized) {
|
|
97
|
-
window.pre.runGlobalAsync('unmaximize')
|
|
98
|
-
} else {
|
|
99
|
-
window.pre.runGlobalAsync('maximize')
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
85
|
handleAdd = e => {
|
|
105
86
|
if (!e.target.className.includes('tabs-wrapper')) {
|
|
106
87
|
return
|
|
@@ -155,7 +136,8 @@ export default class Tabs extends React.Component {
|
|
|
155
136
|
return (
|
|
156
137
|
<MenuItem
|
|
157
138
|
key={i + '##' + t.id}
|
|
158
|
-
>
|
|
139
|
+
>
|
|
140
|
+
<TabTitle tab={t} />
|
|
159
141
|
</MenuItem>
|
|
160
142
|
)
|
|
161
143
|
})
|
|
@@ -194,6 +176,9 @@ export default class Tabs extends React.Component {
|
|
|
194
176
|
}
|
|
195
177
|
|
|
196
178
|
renderAddBtn = () => {
|
|
179
|
+
if (!this.props.tabs.length) {
|
|
180
|
+
return null
|
|
181
|
+
}
|
|
197
182
|
return (
|
|
198
183
|
<Popover
|
|
199
184
|
content={this.renderMenus()}
|
|
@@ -239,48 +224,48 @@ export default class Tabs extends React.Component {
|
|
|
239
224
|
? '100%'
|
|
240
225
|
: tabsWidthAll
|
|
241
226
|
const style = {
|
|
242
|
-
width: width - windowControlWidth
|
|
227
|
+
width: width - windowControlWidth - 86
|
|
243
228
|
}
|
|
244
229
|
return (
|
|
245
230
|
<div className='tabs' ref={this.tabsRef}>
|
|
246
|
-
<
|
|
247
|
-
className='tabs-inner'
|
|
248
|
-
style={style}
|
|
249
|
-
>
|
|
250
|
-
<div
|
|
251
|
-
style={{
|
|
252
|
-
left
|
|
253
|
-
}}
|
|
254
|
-
/>
|
|
231
|
+
<AppDrag>
|
|
255
232
|
<div
|
|
256
|
-
className='tabs-
|
|
257
|
-
style={
|
|
258
|
-
width: tabsWidthAll + extraTabWidth + 10
|
|
259
|
-
}}
|
|
260
|
-
onDoubleClick={this.handleAdd}
|
|
233
|
+
className='tabs-inner'
|
|
234
|
+
style={style}
|
|
261
235
|
>
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
236
|
+
<div
|
|
237
|
+
style={{
|
|
238
|
+
left
|
|
239
|
+
}}
|
|
240
|
+
/>
|
|
241
|
+
<div
|
|
242
|
+
className='tabs-wrapper relative'
|
|
243
|
+
style={{
|
|
244
|
+
width: tabsWidthAll + extraTabWidth + 10
|
|
245
|
+
}}
|
|
246
|
+
onDoubleClick={this.handleAdd}
|
|
247
|
+
>
|
|
248
|
+
{
|
|
249
|
+
tabs.map((tab, i) => {
|
|
250
|
+
const isLast = i === len - 1
|
|
251
|
+
return (
|
|
252
|
+
<Tab
|
|
253
|
+
{...this.props}
|
|
254
|
+
tab={tab}
|
|
255
|
+
isLast={isLast}
|
|
256
|
+
key={tab.id}
|
|
257
|
+
/>
|
|
258
|
+
)
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
{
|
|
262
|
+
!overflow
|
|
263
|
+
? this.renderAddBtn()
|
|
264
|
+
: null
|
|
265
|
+
}
|
|
266
|
+
</div>
|
|
280
267
|
</div>
|
|
281
|
-
</
|
|
282
|
-
<div className='app-drag' />
|
|
283
|
-
<div className='app-drag-area' />
|
|
268
|
+
</AppDrag>
|
|
284
269
|
<WindowControl
|
|
285
270
|
store={window.store}
|
|
286
271
|
/>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import createName from '../../common/create-title'
|
|
2
|
+
|
|
3
|
+
export default function tabTitle (props) {
|
|
4
|
+
const { tab } = props
|
|
5
|
+
const title = createName(tab)
|
|
6
|
+
const { tabCount, color } = props.tab
|
|
7
|
+
const styleTag = color
|
|
8
|
+
? { color }
|
|
9
|
+
: {}
|
|
10
|
+
return (
|
|
11
|
+
<span>
|
|
12
|
+
<span style={styleTag}>♦</span> {tabCount}. {title}
|
|
13
|
+
</span>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
terminalSshConfigType,
|
|
22
22
|
commonActions
|
|
23
23
|
} from '../../common/constants'
|
|
24
|
+
import TabTitle from './tab-title'
|
|
24
25
|
|
|
25
26
|
const { prefix } = window
|
|
26
27
|
const e = prefix('tabs')
|
|
@@ -357,7 +358,7 @@ export default class Tab extends React.Component {
|
|
|
357
358
|
} = this.props
|
|
358
359
|
const { isLast } = this.props
|
|
359
360
|
const { tab, terminalOnData } = this.state
|
|
360
|
-
const { id, isEditting, status, isTransporting
|
|
361
|
+
const { id, isEditting, status, isTransporting } = tab
|
|
361
362
|
const active = id === currentTabId
|
|
362
363
|
const cls = classnames(
|
|
363
364
|
`tab-${id}`,
|
|
@@ -378,9 +379,6 @@ export default class Tab extends React.Component {
|
|
|
378
379
|
if (isEditting) {
|
|
379
380
|
return this.renderEditting(tab, cls)
|
|
380
381
|
}
|
|
381
|
-
const styleTag = color
|
|
382
|
-
? { color }
|
|
383
|
-
: {}
|
|
384
382
|
return (
|
|
385
383
|
<Tooltip
|
|
386
384
|
title={title}
|
|
@@ -413,7 +411,7 @@ export default class Tab extends React.Component {
|
|
|
413
411
|
onClick={this.handleReloadTab}
|
|
414
412
|
title={m('reload')}
|
|
415
413
|
/>
|
|
416
|
-
<
|
|
414
|
+
<TabTitle tab={tab} />
|
|
417
415
|
</div>
|
|
418
416
|
<div className={'tab-status ' + status} />
|
|
419
417
|
<div className='tab-traffic' />
|
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
@require '../../css/includes/theme-default'
|
|
2
2
|
.tabs
|
|
3
3
|
position relative
|
|
4
|
-
height
|
|
4
|
+
height 45px
|
|
5
5
|
overflow hidden
|
|
6
6
|
background main-dark
|
|
7
|
-
|
|
8
|
-
.app-drag
|
|
9
|
-
position absolute
|
|
10
|
-
left 0
|
|
11
|
-
top 0
|
|
12
|
-
height 15px
|
|
13
|
-
right 0
|
|
14
|
-
z-index 1
|
|
15
|
-
.app-drag
|
|
16
|
-
-webkit-app-region drag
|
|
7
|
+
|
|
17
8
|
.tabs-inner
|
|
18
9
|
position relative
|
|
19
10
|
z-index 2
|
|
20
|
-
padding 0
|
|
21
|
-
margin-top
|
|
11
|
+
padding 0
|
|
12
|
+
margin-top 0
|
|
22
13
|
display inline-block
|
|
23
14
|
height 63px
|
|
24
15
|
overflow-x scroll
|
|
25
16
|
overflow-y hidden
|
|
26
17
|
margin-left 42px
|
|
27
|
-
-webkit-app-region drag
|
|
28
18
|
.tabs-wrapper
|
|
29
19
|
z-index 3
|
|
30
20
|
.tab
|
|
31
|
-
-webkit-app-region no-drag
|
|
32
21
|
display inline-block
|
|
33
22
|
vertical-align middle
|
|
34
23
|
cursor pointer
|
|
@@ -137,8 +126,8 @@
|
|
|
137
126
|
.tabs-extra
|
|
138
127
|
position absolute
|
|
139
128
|
height 20px
|
|
140
|
-
top
|
|
141
|
-
right
|
|
129
|
+
top 14px
|
|
130
|
+
right 96px
|
|
142
131
|
line-height 20px
|
|
143
132
|
z-index 20
|
|
144
133
|
-webkit-app-region no-drag
|
|
@@ -212,9 +201,4 @@
|
|
|
212
201
|
|
|
213
202
|
.system-ui
|
|
214
203
|
.window-controls
|
|
215
|
-
.app-drag
|
|
216
204
|
display none
|
|
217
|
-
.tabs
|
|
218
|
-
height 45px
|
|
219
|
-
.tabs-inner
|
|
220
|
-
margin-top 0
|
|
@@ -11,8 +11,12 @@ const m = prefix('menu')
|
|
|
11
11
|
export default class WindowControl extends Component {
|
|
12
12
|
render () {
|
|
13
13
|
const {
|
|
14
|
-
isMaximized
|
|
14
|
+
isMaximized,
|
|
15
|
+
config
|
|
15
16
|
} = this.props.store
|
|
17
|
+
if (config.useSystemTitleBar) {
|
|
18
|
+
return null
|
|
19
|
+
}
|
|
16
20
|
const minimize = () => {
|
|
17
21
|
window.pre.runGlobalAsync('minimize')
|
|
18
22
|
}
|
|
@@ -77,6 +77,7 @@ class Term extends Component {
|
|
|
77
77
|
loading: false,
|
|
78
78
|
promoteModalVisible: false,
|
|
79
79
|
savePassword: false,
|
|
80
|
+
saveTerminalLogToFile: !!this.props.config.saveTerminalLogToFile,
|
|
80
81
|
tempPassword: '',
|
|
81
82
|
passType: 'password',
|
|
82
83
|
zmodemTransfer: null,
|
|
@@ -272,15 +273,18 @@ class Term extends Component {
|
|
|
272
273
|
options,
|
|
273
274
|
action,
|
|
274
275
|
encode,
|
|
275
|
-
|
|
276
|
+
saveTerminalLogToFile,
|
|
276
277
|
type,
|
|
277
278
|
cmd,
|
|
278
279
|
activeSplitId,
|
|
280
|
+
pid,
|
|
279
281
|
toAll,
|
|
280
282
|
inputOnly,
|
|
281
283
|
zoomValue
|
|
282
284
|
} = e?.data || {}
|
|
285
|
+
|
|
283
286
|
const { id: propSplitId } = this.props
|
|
287
|
+
const { pid: statePid } = this.state
|
|
284
288
|
if (
|
|
285
289
|
action === terminalActions.zoom &&
|
|
286
290
|
propSplitId === activeSplitId
|
|
@@ -338,6 +342,32 @@ class Term extends Component {
|
|
|
338
342
|
)
|
|
339
343
|
) {
|
|
340
344
|
this.searchPrev(keyword, options)
|
|
345
|
+
} else if (
|
|
346
|
+
action === commonActions.getTermLogState &&
|
|
347
|
+
pid === statePid
|
|
348
|
+
) {
|
|
349
|
+
postMessage({
|
|
350
|
+
action: commonActions.returnTermLogState,
|
|
351
|
+
state: this.state.saveTerminalLogToFile,
|
|
352
|
+
pid: statePid
|
|
353
|
+
})
|
|
354
|
+
postMessage({
|
|
355
|
+
action: commonActions.returnTermLogState,
|
|
356
|
+
state: this.state.saveTerminalLogToFile,
|
|
357
|
+
pid: statePid
|
|
358
|
+
})
|
|
359
|
+
postMessage({
|
|
360
|
+
action: commonActions.returnTermLogState,
|
|
361
|
+
state: this.state.saveTerminalLogToFile,
|
|
362
|
+
pid: statePid
|
|
363
|
+
})
|
|
364
|
+
} else if (
|
|
365
|
+
action === commonActions.setTermLogState &&
|
|
366
|
+
pid === statePid
|
|
367
|
+
) {
|
|
368
|
+
this.setState({
|
|
369
|
+
saveTerminalLogToFile
|
|
370
|
+
})
|
|
341
371
|
}
|
|
342
372
|
const isActiveTerminal = this.isActiveTerminal()
|
|
343
373
|
if (
|
|
@@ -644,9 +674,9 @@ class Term extends Component {
|
|
|
644
674
|
window.store.toggleTerminalSearch()
|
|
645
675
|
}
|
|
646
676
|
|
|
647
|
-
onLineFeed = e => {
|
|
648
|
-
|
|
649
|
-
}
|
|
677
|
+
// onLineFeed = e => {
|
|
678
|
+
// // console.log(e, 'onLineFeed')
|
|
679
|
+
// }
|
|
650
680
|
|
|
651
681
|
onTitleChange = e => {
|
|
652
682
|
log.debug(e, 'title change')
|
|
@@ -808,7 +838,7 @@ class Term extends Component {
|
|
|
808
838
|
term.unicode.activeVersion = '11'
|
|
809
839
|
term.loadAddon(this.fitAddon)
|
|
810
840
|
term.loadAddon(this.searchAddon)
|
|
811
|
-
term.onLineFeed(this.onLineFeed)
|
|
841
|
+
// term.onLineFeed(this.onLineFeed)
|
|
812
842
|
term.onTitleChange(this.onTitleChange)
|
|
813
843
|
term.onSelectionChange(this.onSelection)
|
|
814
844
|
this.loadState(term)
|
|
@@ -1,27 +1,120 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* show base terminal info, id sessionID
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
import { Component } from 'react'
|
|
5
5
|
import { osResolve } from '../../common/resolve'
|
|
6
|
+
import {
|
|
7
|
+
commonActions
|
|
8
|
+
} from '../../common/constants'
|
|
9
|
+
import {
|
|
10
|
+
Switch
|
|
11
|
+
} from 'antd'
|
|
6
12
|
import ShowItem from '../common/show-item'
|
|
13
|
+
import postMsg from '../../common/post-msg'
|
|
14
|
+
import { toggleTerminalLog } from '../terminal/terminal-apis'
|
|
7
15
|
|
|
8
16
|
const { prefix } = window
|
|
9
|
-
const c = prefix('common')
|
|
10
17
|
const st = prefix('setting')
|
|
11
18
|
|
|
12
|
-
export default
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
19
|
+
export default class TerminalInfoBase extends Component {
|
|
20
|
+
state = {
|
|
21
|
+
saveTerminalLogToFile: false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
componentDidMount () {
|
|
25
|
+
this.getState()
|
|
26
|
+
window.addEventListener('message', this.onEvent)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentWillUnmount () {
|
|
30
|
+
this.exit()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
handleToggle = () => {
|
|
34
|
+
const { saveTerminalLogToFile } = this.state
|
|
35
|
+
const {
|
|
36
|
+
pid,
|
|
37
|
+
sessionId
|
|
38
|
+
} = this.props
|
|
39
|
+
toggleTerminalLog(
|
|
40
|
+
pid,
|
|
41
|
+
sessionId
|
|
42
|
+
)
|
|
43
|
+
const nv = !saveTerminalLogToFile
|
|
44
|
+
this.setState({
|
|
45
|
+
saveTerminalLogToFile: nv
|
|
46
|
+
})
|
|
47
|
+
postMsg({
|
|
48
|
+
action: commonActions.setTermLogState,
|
|
49
|
+
pid,
|
|
50
|
+
saveTerminalLogToFile: nv,
|
|
51
|
+
sessionId
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onEvent = (e) => {
|
|
56
|
+
const {
|
|
57
|
+
action,
|
|
58
|
+
state,
|
|
59
|
+
pid: ppid
|
|
60
|
+
} = e.data || {}
|
|
61
|
+
if (
|
|
62
|
+
action === commonActions.returnTermLogState &&
|
|
63
|
+
this.props.pid === ppid
|
|
64
|
+
) {
|
|
65
|
+
this.setState({
|
|
66
|
+
saveTerminalLogToFile: state
|
|
67
|
+
})
|
|
68
|
+
window.removeEventListener('message', this.onEvent)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getState = () => {
|
|
73
|
+
const {
|
|
74
|
+
pid,
|
|
75
|
+
sessionId
|
|
76
|
+
} = this.props
|
|
77
|
+
postMsg({
|
|
78
|
+
action: commonActions.getTermLogState,
|
|
79
|
+
pid,
|
|
80
|
+
sessionId
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
exit = () => {
|
|
85
|
+
window.removeEventListener('message', this.onEvent)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
render () {
|
|
89
|
+
const {
|
|
90
|
+
id,
|
|
91
|
+
logName,
|
|
92
|
+
appPath
|
|
93
|
+
} = this.props
|
|
94
|
+
const { saveTerminalLogToFile } = this.state
|
|
95
|
+
const base = appPath
|
|
96
|
+
? osResolve(appPath, 'electerm', 'session_logs')
|
|
97
|
+
: window.et.sessionLogPath
|
|
98
|
+
const path = osResolve(base, logName + '.log')
|
|
99
|
+
const name = st('saveTerminalLogToFile')
|
|
100
|
+
const to = saveTerminalLogToFile
|
|
101
|
+
? <ShowItem disabled={!saveTerminalLogToFile} to={path}>{path}</ShowItem>
|
|
102
|
+
: path
|
|
103
|
+
return (
|
|
104
|
+
<div className='terminal-info-section terminal-info-base'>
|
|
105
|
+
<div className='fix'>
|
|
106
|
+
<span className='fleft'><b>ID:</b> {id}</span>
|
|
107
|
+
<span className='fright'>
|
|
108
|
+
<Switch
|
|
109
|
+
checkedChildren={name}
|
|
110
|
+
unCheckedChildren={name}
|
|
111
|
+
checked={saveTerminalLogToFile}
|
|
112
|
+
onChange={this.handleToggle}
|
|
113
|
+
/>
|
|
114
|
+
</span>
|
|
115
|
+
</div>
|
|
116
|
+
<p><b>log:</b> {to}</p>
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
27
120
|
}
|
package/client/css/basic.styl
CHANGED
|
@@ -6,7 +6,7 @@ html
|
|
|
6
6
|
background rgba(0,0,0,.01)
|
|
7
7
|
|
|
8
8
|
body
|
|
9
|
-
color
|
|
9
|
+
color text
|
|
10
10
|
overflow hidden
|
|
11
11
|
background alpha(main, .3)
|
|
12
12
|
font-size 12px
|
|
@@ -36,3 +36,6 @@ body
|
|
|
36
36
|
word-break break-all
|
|
37
37
|
.hide-resize-observer
|
|
38
38
|
display: none !important
|
|
39
|
+
|
|
40
|
+
a
|
|
41
|
+
color primary
|
|
@@ -15,7 +15,7 @@ export default Store => {
|
|
|
15
15
|
}
|
|
16
16
|
Store.prototype.getBookmarkGroupsTotal = function () {
|
|
17
17
|
const { store } = window
|
|
18
|
-
return store.sshConfigItems.length
|
|
18
|
+
return store.sshConfigItems.length && !store.config.hideSshConfig
|
|
19
19
|
? [
|
|
20
20
|
...store.getBookmarkGroups(),
|
|
21
21
|
{
|
package/client/store/event.js
CHANGED
package/client/store/index.js
CHANGED
|
@@ -88,7 +88,7 @@ class Store {
|
|
|
88
88
|
constructor () {
|
|
89
89
|
Object.assign(
|
|
90
90
|
this,
|
|
91
|
-
initState
|
|
91
|
+
initState()
|
|
92
92
|
)
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -292,7 +292,7 @@ class Store {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
get tabsHeight () {
|
|
295
|
-
return window.store.config.useSystemTitleBar ? 45 : 56
|
|
295
|
+
return 45 // window.store.config.useSystemTitleBar ? 45 : 56
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
get langs () {
|
|
@@ -350,7 +350,7 @@ batchInputHistory(Store)
|
|
|
350
350
|
transferExtend(Store)
|
|
351
351
|
addressBookmarkExtend(Store)
|
|
352
352
|
|
|
353
|
+
export const StateStore = Store
|
|
353
354
|
const store = manage(new Store())
|
|
354
355
|
|
|
355
|
-
window.store = store
|
|
356
356
|
export default store
|
|
@@ -53,132 +53,134 @@ export const getInitItem = (arr, tab) => {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export default {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
56
|
+
export default () => {
|
|
57
|
+
return {
|
|
58
|
+
// common
|
|
59
|
+
wsInited: false,
|
|
60
|
+
configLoaded: false,
|
|
61
|
+
loadTime: 0,
|
|
62
|
+
lastDataUpdateTime: 0,
|
|
63
|
+
_tabs: '[]',
|
|
64
|
+
currentTabId: '',
|
|
65
|
+
termFocused: false,
|
|
66
|
+
_history: '[]',
|
|
67
|
+
_bookmarks: '[]',
|
|
68
|
+
_bookmarkGroups: JSON.stringify(
|
|
69
|
+
getDefaultBookmarkGroups([])
|
|
70
|
+
),
|
|
71
|
+
_config: '{}',
|
|
72
|
+
_terminalThemes: JSON.stringify([
|
|
73
|
+
buildDefaultThemes()
|
|
74
|
+
]),
|
|
75
|
+
_itermThemes: '[]',
|
|
76
|
+
currentBookmarkGroupId: defaultBookmarkGroupId,
|
|
77
|
+
_expandedKeys: ls.getItem(expandedKeysLsKey) || JSON.stringify([
|
|
78
|
+
defaultBookmarkGroupId
|
|
79
|
+
]),
|
|
80
|
+
bookmarkSelectMode: false,
|
|
81
|
+
_checkedKeys: ls.getItem(checkedKeysLsKey) || '[]',
|
|
82
|
+
_addressBookmarks: '[]',
|
|
83
|
+
_addressBookmarksLocal: ls.getItem(localAddrBookmarkLsKey) || '[]',
|
|
84
|
+
|
|
85
|
+
// init session control
|
|
86
|
+
selectedSessions: [],
|
|
87
|
+
sessionModalVisible: false,
|
|
88
|
+
|
|
89
|
+
// sftp
|
|
90
|
+
fileOperation: fileOperationsMap.cp, // cp or mv
|
|
91
|
+
transferTab: 'transfer',
|
|
92
|
+
_transferHistory: '[]',
|
|
93
|
+
_fileTransfers: '[]',
|
|
94
|
+
_sftpSortSetting: ls.getItem(sftpDefaultSortSettingKey) || JSON.stringify({
|
|
95
|
+
local: {
|
|
96
|
+
prop: 'modifyTime',
|
|
97
|
+
direction: 'asc'
|
|
98
|
+
},
|
|
99
|
+
remote: {
|
|
100
|
+
prop: 'modifyTime',
|
|
101
|
+
direction: 'desc'
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
|
|
105
|
+
// for settings related
|
|
106
|
+
_setting: '',
|
|
107
|
+
_settingItem: JSON.stringify(getInitItem([], settingMap.bookmarks)),
|
|
108
|
+
settingTab: settingMap.bookmarks, // setting tab
|
|
109
|
+
autofocustrigger: Date.now(),
|
|
110
|
+
bookmarkId: undefined,
|
|
111
|
+
showModal: 0,
|
|
112
|
+
activeTerminalId: '',
|
|
113
|
+
|
|
114
|
+
// setting sync related
|
|
115
|
+
isSyncingSetting: false,
|
|
116
|
+
isSyncUpload: false,
|
|
117
|
+
isSyncDownload: false,
|
|
118
|
+
syncSetting: {},
|
|
119
|
+
syncType: syncTypes.github,
|
|
120
|
+
_fonts: '[]',
|
|
121
|
+
|
|
122
|
+
// term search
|
|
123
|
+
termSearchOpen: false,
|
|
124
|
+
termSearch: '',
|
|
125
|
+
termSearchMatchCount: 0,
|
|
126
|
+
termSearchMatchIndex: 0,
|
|
127
|
+
_termSearchOptions: JSON.stringify({
|
|
128
|
+
caseSensitive: false,
|
|
129
|
+
wholeWord: false,
|
|
130
|
+
regex: false,
|
|
131
|
+
decorations: {
|
|
132
|
+
activeMatchColorOverviewRuler: 'yellow'
|
|
133
|
+
}
|
|
134
|
+
}),
|
|
135
|
+
|
|
136
|
+
// quick commands
|
|
137
|
+
_quickCommands: '[]',
|
|
138
|
+
quickCommandId: '',
|
|
139
|
+
openQuickCommandBar: false,
|
|
140
|
+
pinnedQuickCommandBar: false,
|
|
141
|
+
|
|
142
|
+
// sidebar
|
|
143
|
+
openedSideBar: ls.getItem(openedSidebarKey),
|
|
144
|
+
menuOpened: false,
|
|
145
|
+
pinned: ls.getItem(sidebarPinnedKey) === 'true',
|
|
146
|
+
|
|
147
|
+
// info/help modal
|
|
148
|
+
showInfoModal: false,
|
|
149
|
+
infoModalTab: infoTabs.info,
|
|
150
|
+
commandLineHelp: '',
|
|
151
|
+
|
|
152
|
+
// editor
|
|
153
|
+
showEditor: false,
|
|
154
|
+
|
|
155
|
+
// file/info modal
|
|
156
|
+
showFileModal: false,
|
|
157
|
+
|
|
158
|
+
// update
|
|
159
|
+
_upgradeInfo: '{}',
|
|
160
|
+
|
|
161
|
+
// serial list related
|
|
162
|
+
_serials: '[]',
|
|
163
|
+
loaddingSerials: false,
|
|
164
|
+
|
|
165
|
+
// transfer list
|
|
166
|
+
transports: [],
|
|
167
|
+
|
|
168
|
+
_sshConfigItems: '[]',
|
|
169
|
+
|
|
170
|
+
appPath: '',
|
|
171
|
+
exePath: '',
|
|
172
|
+
isPortable: false,
|
|
173
|
+
installSrc: '',
|
|
174
|
+
|
|
175
|
+
_langs: '[]',
|
|
176
|
+
|
|
177
|
+
// batch inputs
|
|
178
|
+
batchInputs: ls.getItemJSON(batchInputLsKey, []),
|
|
179
|
+
|
|
180
|
+
// ui
|
|
181
|
+
innerWidth: window.innerWidth,
|
|
182
|
+
height: 500,
|
|
183
|
+
isMaximized: window.pre.runSync('isMaximized'),
|
|
184
|
+
terminalFullScreen: false
|
|
185
|
+
}
|
|
184
186
|
}
|
|
@@ -180,7 +180,9 @@ export default (Store) => {
|
|
|
180
180
|
store.loadFontList()
|
|
181
181
|
store.fetchItermThemes()
|
|
182
182
|
store.openInitSessions()
|
|
183
|
-
store.
|
|
183
|
+
if (!store.config.hideSshConfig) {
|
|
184
|
+
store.fetchSshConfigItems()
|
|
185
|
+
}
|
|
184
186
|
store.initCommandLine().catch(store.onError)
|
|
185
187
|
if (store.config.checkUpdateOnStart) {
|
|
186
188
|
store.onCheckUpdate()
|
package/client/store/session.js
CHANGED
|
@@ -2,26 +2,11 @@
|
|
|
2
2
|
* sessions not proper closed related functions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { terminalActions } from '../common/constants'
|
|
6
6
|
import { debounce } from 'lodash-es'
|
|
7
7
|
import postMsg from '../common/post-msg'
|
|
8
8
|
|
|
9
9
|
export default Store => {
|
|
10
|
-
Store.prototype.onMouseWheel = function (event) {
|
|
11
|
-
if (
|
|
12
|
-
(isMac && event.metaKey) ||
|
|
13
|
-
(!isMac && event.ctrlKey)
|
|
14
|
-
) {
|
|
15
|
-
event.stopPropagation()
|
|
16
|
-
if (window.store.inActiveTerminal) {
|
|
17
|
-
window.store.zoomTerminal(event.wheelDeltaY)
|
|
18
|
-
} else {
|
|
19
|
-
const plus = event.wheelDeltaY > 0 ? 0.2 : -0.2
|
|
20
|
-
window.store.zoom(plus, true)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
10
|
Store.prototype.zoomTerminal = debounce(function (delta) {
|
|
26
11
|
postMsg({
|
|
27
12
|
action: terminalActions.zoom,
|