@electerm/electerm-react 1.36.2 → 1.37.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 +4 -1
- package/client/common/default-setting.js +3 -1
- 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/setting-panel/setting-terminal.jsx +4 -3
- package/client/components/shortcuts/shortcut-control.jsx +9 -4
- package/client/components/shortcuts/shortcut-handler.js +3 -3
- package/client/components/shortcuts/shortcuts.jsx +12 -10
- 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 +39 -20
- package/client/components/terminal/terminal-apis.js +16 -0
- package/client/components/terminal-info/base.jsx +153 -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 +1 -1
- 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()
|
|
@@ -475,8 +475,12 @@ export default class SettingTerminal extends Component {
|
|
|
475
475
|
{
|
|
476
476
|
this.renderCursorStyleSelect()
|
|
477
477
|
}
|
|
478
|
+
{this.renderToggle('saveTerminalLogToFile', (
|
|
479
|
+
<ShowItem to={terminalLogPath} className='mg1l'>{p('open')}</ShowItem>
|
|
480
|
+
))}
|
|
478
481
|
{
|
|
479
482
|
[
|
|
483
|
+
'addTimeStampToTermLog',
|
|
480
484
|
'cursorBlink',
|
|
481
485
|
'rightClickSelectsWord',
|
|
482
486
|
'pasteWhenContextMenu',
|
|
@@ -484,9 +488,6 @@ export default class SettingTerminal extends Component {
|
|
|
484
488
|
'ctrlOrMetaOpenTerminalLink'
|
|
485
489
|
].map(this.renderToggle)
|
|
486
490
|
}
|
|
487
|
-
{this.renderToggle('saveTerminalLogToFile', (
|
|
488
|
-
<ShowItem to={terminalLogPath} className='mg1l'>{p('open')}</ShowItem>
|
|
489
|
-
))}
|
|
490
491
|
{this.renderReset()}
|
|
491
492
|
</div>
|
|
492
493
|
)
|
|
@@ -39,7 +39,7 @@ class ShortcutControl extends React.PureComponent {
|
|
|
39
39
|
e.stopPropagation()
|
|
40
40
|
const x = document.querySelector('.icon-split')
|
|
41
41
|
x && x.click()
|
|
42
|
-
},
|
|
42
|
+
}, 1200)
|
|
43
43
|
|
|
44
44
|
zoominShortcut = (e) => {
|
|
45
45
|
e.stopPropagation()
|
|
@@ -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 () {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
isMacJs
|
|
5
5
|
} from '../../common/constants'
|
|
6
6
|
|
|
7
|
-
function buildConfig (config) {
|
|
8
|
-
const defs = shortcutsDefaultsGen()
|
|
7
|
+
function buildConfig (config, filter = d => d) {
|
|
8
|
+
const defs = shortcutsDefaultsGen().filter(filter)
|
|
9
9
|
const { shortcuts = {} } = config
|
|
10
10
|
return defs.reduce((p, c) => {
|
|
11
11
|
const propName = isMacJs ? 'shortcutMac' : 'shortcut'
|
|
@@ -45,7 +45,7 @@ export function shortcutExtend (Cls) {
|
|
|
45
45
|
(shiftKey ? 'shift+' : '') +
|
|
46
46
|
(altKey ? 'alt+' : '') +
|
|
47
47
|
codeK.toLowerCase()
|
|
48
|
-
const shortcutsConfig = buildConfig(this.props.config)
|
|
48
|
+
const shortcutsConfig = buildConfig(this.props.config, d => !d.readonly)
|
|
49
49
|
const keys = Object.keys(shortcutsConfig)
|
|
50
50
|
const len = keys.length
|
|
51
51
|
for (let i = 0; i < len; i++) {
|
|
@@ -36,16 +36,18 @@ export default class Shortcuts extends Component {
|
|
|
36
36
|
|
|
37
37
|
getData () {
|
|
38
38
|
const { shortcuts = {} } = this.props.store.config
|
|
39
|
-
return shortcutsDefaults
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
return shortcutsDefaults
|
|
40
|
+
.filter(g => !g.readonly)
|
|
41
|
+
.map((c, i) => {
|
|
42
|
+
const propName = isMac ? 'shortcutMac' : 'shortcut'
|
|
43
|
+
const name = c.name + '_' + propName
|
|
44
|
+
return {
|
|
45
|
+
index: i + 1,
|
|
46
|
+
name,
|
|
47
|
+
readonly: c.readonly,
|
|
48
|
+
shortcut: c.readonly ? c[propName] : (shortcuts[name] || c[propName])
|
|
49
|
+
}
|
|
50
|
+
})
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
getKeysTakenData = () => {
|
|
@@ -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,8 @@ class Term extends Component {
|
|
|
77
77
|
loading: false,
|
|
78
78
|
promoteModalVisible: false,
|
|
79
79
|
savePassword: false,
|
|
80
|
+
saveTerminalLogToFile: !!this.props.config.saveTerminalLogToFile,
|
|
81
|
+
addTimeStampToTermLog: !!this.props.config.addTimeStampToTermLog,
|
|
80
82
|
tempPassword: '',
|
|
81
83
|
passType: 'password',
|
|
82
84
|
zmodemTransfer: null,
|
|
@@ -231,15 +233,15 @@ class Term extends Component {
|
|
|
231
233
|
this.term.selectAll()
|
|
232
234
|
}
|
|
233
235
|
|
|
234
|
-
copyShortcut = (e) => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
236
|
+
// copyShortcut = (e) => {
|
|
237
|
+
// const sel = this.term.getSelection()
|
|
238
|
+
// if (sel) {
|
|
239
|
+
// e.stopPropagation()
|
|
240
|
+
// e.preventDefault()
|
|
241
|
+
// this.copySelectionToClipboard()
|
|
242
|
+
// return false
|
|
243
|
+
// }
|
|
244
|
+
// }
|
|
243
245
|
|
|
244
246
|
searchShortcut = (e) => {
|
|
245
247
|
e.stopPropagation()
|
|
@@ -272,15 +274,19 @@ class Term extends Component {
|
|
|
272
274
|
options,
|
|
273
275
|
action,
|
|
274
276
|
encode,
|
|
275
|
-
|
|
277
|
+
saveTerminalLogToFile,
|
|
278
|
+
addTimeStampToTermLog,
|
|
276
279
|
type,
|
|
277
280
|
cmd,
|
|
278
281
|
activeSplitId,
|
|
282
|
+
pid,
|
|
279
283
|
toAll,
|
|
280
284
|
inputOnly,
|
|
281
285
|
zoomValue
|
|
282
286
|
} = e?.data || {}
|
|
287
|
+
|
|
283
288
|
const { id: propSplitId } = this.props
|
|
289
|
+
const { pid: statePid } = this.state
|
|
284
290
|
if (
|
|
285
291
|
action === terminalActions.zoom &&
|
|
286
292
|
propSplitId === activeSplitId
|
|
@@ -338,6 +344,26 @@ class Term extends Component {
|
|
|
338
344
|
)
|
|
339
345
|
) {
|
|
340
346
|
this.searchPrev(keyword, options)
|
|
347
|
+
} else if (
|
|
348
|
+
action === commonActions.getTermLogState &&
|
|
349
|
+
pid === statePid
|
|
350
|
+
) {
|
|
351
|
+
postMessage({
|
|
352
|
+
action: commonActions.returnTermLogState,
|
|
353
|
+
state: {
|
|
354
|
+
saveTerminalLogToFile: this.state.saveTerminalLogToFile,
|
|
355
|
+
addTimeStampToTermLog: this.state.addTimeStampToTermLog
|
|
356
|
+
},
|
|
357
|
+
pid: statePid
|
|
358
|
+
})
|
|
359
|
+
} else if (
|
|
360
|
+
action === commonActions.setTermLogState &&
|
|
361
|
+
pid === statePid
|
|
362
|
+
) {
|
|
363
|
+
this.setState({
|
|
364
|
+
addTimeStampToTermLog,
|
|
365
|
+
saveTerminalLogToFile
|
|
366
|
+
})
|
|
341
367
|
}
|
|
342
368
|
const isActiveTerminal = this.isActiveTerminal()
|
|
343
369
|
if (
|
|
@@ -644,14 +670,6 @@ class Term extends Component {
|
|
|
644
670
|
window.store.toggleTerminalSearch()
|
|
645
671
|
}
|
|
646
672
|
|
|
647
|
-
onLineFeed = e => {
|
|
648
|
-
// console.log(e, 'onLineFeed')
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
onTitleChange = e => {
|
|
652
|
-
log.debug(e, 'title change')
|
|
653
|
-
}
|
|
654
|
-
|
|
655
673
|
onSearchResultsChange = ({ resultIndex, resultCount }) => {
|
|
656
674
|
window.store.storeAssign({
|
|
657
675
|
termSearchMatchCount: resultCount,
|
|
@@ -808,8 +826,8 @@ class Term extends Component {
|
|
|
808
826
|
term.unicode.activeVersion = '11'
|
|
809
827
|
term.loadAddon(this.fitAddon)
|
|
810
828
|
term.loadAddon(this.searchAddon)
|
|
811
|
-
term.onLineFeed(this.onLineFeed)
|
|
812
|
-
term.onTitleChange(this.onTitleChange)
|
|
829
|
+
// term.onLineFeed(this.onLineFeed)
|
|
830
|
+
// term.onTitleChange(this.onTitleChange)
|
|
813
831
|
term.onSelectionChange(this.onSelection)
|
|
814
832
|
this.loadState(term)
|
|
815
833
|
term.open(document.getElementById(id), true)
|
|
@@ -933,6 +951,7 @@ class Term extends Component {
|
|
|
933
951
|
...extra,
|
|
934
952
|
logName,
|
|
935
953
|
...pick(config, [
|
|
954
|
+
'addTimeStampToTermLog',
|
|
936
955
|
'keepaliveInterval',
|
|
937
956
|
'keepaliveCountMax',
|
|
938
957
|
'execWindows',
|
|
@@ -29,3 +29,19 @@ export function resizeTerm (pid, sessionId, cols, rows) {
|
|
|
29
29
|
action: 'resize-terminal'
|
|
30
30
|
})
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
export function toggleTerminalLog (pid, sessionId) {
|
|
34
|
+
return fetch({
|
|
35
|
+
pid,
|
|
36
|
+
sessionId,
|
|
37
|
+
action: 'toggle-terminal-log'
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function toggleTerminalLogTimestamp (pid, sessionId) {
|
|
42
|
+
return fetch({
|
|
43
|
+
pid,
|
|
44
|
+
sessionId,
|
|
45
|
+
action: 'toggle-terminal-log-timestamp'
|
|
46
|
+
})
|
|
47
|
+
}
|
|
@@ -1,27 +1,163 @@
|
|
|
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, toggleTerminalLogTimestamp } 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
|
+
addTimeStampToTermLog: false
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
componentDidMount () {
|
|
26
|
+
this.getState()
|
|
27
|
+
window.addEventListener('message', this.onEvent)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
componentWillUnmount () {
|
|
31
|
+
this.exit()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
handleToggleTimestamp = () => {
|
|
35
|
+
const { saveTerminalLogToFile, addTimeStampToTermLog } = this.state
|
|
36
|
+
const {
|
|
37
|
+
pid,
|
|
38
|
+
sessionId
|
|
39
|
+
} = this.props
|
|
40
|
+
toggleTerminalLogTimestamp(
|
|
41
|
+
pid,
|
|
42
|
+
sessionId
|
|
43
|
+
)
|
|
44
|
+
const nv = !addTimeStampToTermLog
|
|
45
|
+
this.setState({
|
|
46
|
+
addTimeStampToTermLog: nv
|
|
47
|
+
})
|
|
48
|
+
postMsg({
|
|
49
|
+
action: commonActions.setTermLogState,
|
|
50
|
+
pid,
|
|
51
|
+
addTimeStampToTermLog: nv,
|
|
52
|
+
saveTerminalLogToFile,
|
|
53
|
+
sessionId
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
handleToggle = () => {
|
|
58
|
+
const { saveTerminalLogToFile, addTimeStampToTermLog } = this.state
|
|
59
|
+
const {
|
|
60
|
+
pid,
|
|
61
|
+
sessionId
|
|
62
|
+
} = this.props
|
|
63
|
+
toggleTerminalLog(
|
|
64
|
+
pid,
|
|
65
|
+
sessionId
|
|
66
|
+
)
|
|
67
|
+
const nv = !saveTerminalLogToFile
|
|
68
|
+
this.setState({
|
|
69
|
+
saveTerminalLogToFile: nv
|
|
70
|
+
})
|
|
71
|
+
postMsg({
|
|
72
|
+
action: commonActions.setTermLogState,
|
|
73
|
+
pid,
|
|
74
|
+
saveTerminalLogToFile: nv,
|
|
75
|
+
addTimeStampToTermLog,
|
|
76
|
+
sessionId
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onEvent = (e) => {
|
|
81
|
+
const {
|
|
82
|
+
action,
|
|
83
|
+
state,
|
|
84
|
+
pid: ppid
|
|
85
|
+
} = e.data || {}
|
|
86
|
+
if (
|
|
87
|
+
action === commonActions.returnTermLogState &&
|
|
88
|
+
this.props.pid === ppid
|
|
89
|
+
) {
|
|
90
|
+
this.setState(state)
|
|
91
|
+
window.removeEventListener('message', this.onEvent)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getState = () => {
|
|
96
|
+
const {
|
|
97
|
+
pid,
|
|
98
|
+
sessionId
|
|
99
|
+
} = this.props
|
|
100
|
+
postMsg({
|
|
101
|
+
action: commonActions.getTermLogState,
|
|
102
|
+
pid,
|
|
103
|
+
sessionId
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
exit = () => {
|
|
108
|
+
window.removeEventListener('message', this.onEvent)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
renderTimestamp () {
|
|
112
|
+
const { saveTerminalLogToFile, addTimeStampToTermLog } = this.state
|
|
113
|
+
if (!saveTerminalLogToFile) {
|
|
114
|
+
return null
|
|
115
|
+
}
|
|
116
|
+
const name = st('addTimeStampToTermLog')
|
|
117
|
+
return (
|
|
118
|
+
<Switch
|
|
119
|
+
checkedChildren={name}
|
|
120
|
+
unCheckedChildren={name}
|
|
121
|
+
checked={addTimeStampToTermLog}
|
|
122
|
+
onChange={this.handleToggleTimestamp}
|
|
123
|
+
/>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
render () {
|
|
128
|
+
const {
|
|
129
|
+
id,
|
|
130
|
+
logName,
|
|
131
|
+
appPath
|
|
132
|
+
} = this.props
|
|
133
|
+
const { saveTerminalLogToFile } = this.state
|
|
134
|
+
const base = appPath
|
|
135
|
+
? osResolve(appPath, 'electerm', 'session_logs')
|
|
136
|
+
: window.et.sessionLogPath
|
|
137
|
+
const path = osResolve(base, logName + '.log')
|
|
138
|
+
const name = st('saveTerminalLogToFile')
|
|
139
|
+
const to = saveTerminalLogToFile
|
|
140
|
+
? <ShowItem disabled={!saveTerminalLogToFile} to={path}>{path}</ShowItem>
|
|
141
|
+
: path
|
|
142
|
+
return (
|
|
143
|
+
<div className='terminal-info-section terminal-info-base'>
|
|
144
|
+
<div className='fix'>
|
|
145
|
+
<span className='fleft'><b>ID:</b> {id}</span>
|
|
146
|
+
<span className='fright'>
|
|
147
|
+
<Switch
|
|
148
|
+
checkedChildren={name}
|
|
149
|
+
unCheckedChildren={name}
|
|
150
|
+
checked={saveTerminalLogToFile}
|
|
151
|
+
onChange={this.handleToggle}
|
|
152
|
+
className='mg1r'
|
|
153
|
+
/>
|
|
154
|
+
{
|
|
155
|
+
this.renderTimestamp()
|
|
156
|
+
}
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
<p><b>log:</b> {to}</p>
|
|
160
|
+
</div>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
27
163
|
}
|
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
|
@@ -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,
|