@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.
@@ -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 + 56
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',
@@ -38,5 +38,6 @@ export default {
38
38
  confirmBeforeExit: false,
39
39
  initDefaultTabOnStart: true,
40
40
  screenReaderMode: false,
41
- autoRefreshWhenSwitchToSftp: false
41
+ autoRefreshWhenSwitchToSftp: false,
42
+ hideSshConfig: false
42
43
  }
@@ -15,6 +15,8 @@ import './login.styl'
15
15
  const { prefix } = window
16
16
  const f = prefix('form')
17
17
 
18
+ window.store = store
19
+
18
20
  export default class Login extends Component {
19
21
  state = {
20
22
  pass: '',
@@ -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()
@@ -21,7 +21,6 @@ export default function KeywordForm (props) {
21
21
  const {
22
22
  formData
23
23
  } = props
24
- console.log('formData', formData)
25
24
  const [formChild] = Form.useForm()
26
25
  function handleTrigger () {
27
26
  formChild.submit()
@@ -642,6 +642,7 @@ export default class SettingCommon extends Component {
642
642
  {
643
643
  [
644
644
  'autoRefreshWhenSwitchToSftp',
645
+ 'hideSshConfig',
645
646
  'screenReaderMode',
646
647
  'initDefaultTabOnStart',
647
648
  'disableSshHistory',
@@ -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 = event.wheelDeltaY > 0 ? 0.2 : -0.2
58
+ const plus = 0.2
59
59
  window.store.zoom(plus, true)
60
60
  }
61
61
  }
62
62
 
63
63
  zoomoutTerminalShortcut = (event) => {
64
- this.zoominTerminalShortcut(event)
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 56px
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
- .system-ui .sidebar-panel
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 { hasClass } from '../../common/class'
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 + 130 + tabsWidth
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
- >{createName(t)}
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
- <div
247
- className='tabs-inner'
248
- style={style}
249
- >
250
- <div
251
- style={{
252
- left
253
- }}
254
- />
231
+ <AppDrag>
255
232
  <div
256
- className='tabs-wrapper relative'
257
- style={{
258
- width: tabsWidthAll + extraTabWidth + 10
259
- }}
260
- onDoubleClick={this.handleAdd}
233
+ className='tabs-inner'
234
+ style={style}
261
235
  >
262
- {
263
- tabs.map((tab, i) => {
264
- const isLast = i === len - 1
265
- return (
266
- <Tab
267
- {...this.props}
268
- tab={tab}
269
- isLast={isLast}
270
- key={tab.id}
271
- />
272
- )
273
- })
274
- }
275
- {
276
- !overflow
277
- ? this.renderAddBtn()
278
- : null
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
- </div>
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, tabCount, color } = tab
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
- <span style={styleTag}>♦</span> {tabCount}. {title}
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 56px
4
+ height 45px
5
5
  overflow hidden
6
6
  background main-dark
7
- .app-drag-area
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 5px 0 0
21
- margin-top 10px
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 34px
141
- right 0
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
  }
@@ -29,7 +29,6 @@ export class KeywordHighlighterAddon {
29
29
  }
30
30
 
31
31
  highlightKeywords = (text) => {
32
- console.log('this.keywords', this.keywords)
33
32
  for (const obj of this.keywords) {
34
33
  const {
35
34
  keyword,
@@ -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
- // id,
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
- // console.log(e, 'onLineFeed')
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)
@@ -29,3 +29,11 @@ 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
+ }
@@ -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 function TerminalInfoBase (props) {
13
- const { id, saveTerminalLogToFile, logName } = props
14
- const base = props.appPath
15
- ? osResolve(props.appPath, 'electerm', 'session_logs')
16
- : window.et.sessionLogPath
17
- const path = osResolve(base, logName + '.log')
18
- const to = saveTerminalLogToFile
19
- ? <ShowItem disabled={!saveTerminalLogToFile} to={path}>{path}</ShowItem>
20
- : `-> ${c('setting')} -> ${st('saveTerminalLogToFile')}`
21
- return (
22
- <div className='terminal-info-section terminal-info-base'>
23
- <p><b>ID:</b> {id}</p>
24
- <p><b>log:</b> {to}</p>
25
- </div>
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
  }
@@ -6,7 +6,7 @@ html
6
6
  background rgba(0,0,0,.01)
7
7
 
8
8
  body
9
- color main
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
  {
@@ -40,6 +40,7 @@ export default Store => {
40
40
 
41
41
  Store.prototype.blur = function () {
42
42
  window.focused = false
43
+ window.pre.runSync('windowMove', false)
43
44
  postMessage({
44
45
  type: 'blur'
45
46
  })
@@ -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
- // common
58
- wsInited: false,
59
- configLoaded: false,
60
- loadTime: 0,
61
- lastDataUpdateTime: 0,
62
- _tabs: '[]',
63
- currentTabId: '',
64
- termFocused: false,
65
- _history: '[]',
66
- _bookmarks: '[]',
67
- _bookmarkGroups: JSON.stringify(
68
- getDefaultBookmarkGroups([])
69
- ),
70
- _config: '{}',
71
- _terminalThemes: JSON.stringify([
72
- buildDefaultThemes()
73
- ]),
74
- _itermThemes: '[]',
75
- currentBookmarkGroupId: defaultBookmarkGroupId,
76
- _expandedKeys: ls.getItem(expandedKeysLsKey) || JSON.stringify([
77
- defaultBookmarkGroupId
78
- ]),
79
- bookmarkSelectMode: false,
80
- _checkedKeys: ls.getItem(checkedKeysLsKey) || '[]',
81
- _addressBookmarks: '[]',
82
- _addressBookmarksLocal: ls.getItem(localAddrBookmarkLsKey) || '[]',
83
-
84
- // init session control
85
- selectedSessions: [],
86
- sessionModalVisible: false,
87
-
88
- // sftp
89
- fileOperation: fileOperationsMap.cp, // cp or mv
90
- transferTab: 'transfer',
91
- _transferHistory: '[]',
92
- _fileTransfers: '[]',
93
- _sftpSortSetting: ls.getItem(sftpDefaultSortSettingKey) || JSON.stringify({
94
- local: {
95
- prop: 'modifyTime',
96
- direction: 'asc'
97
- },
98
- remote: {
99
- prop: 'modifyTime',
100
- direction: 'desc'
101
- }
102
- }),
103
-
104
- // for settings related
105
- _setting: '',
106
- _settingItem: JSON.stringify(getInitItem([], settingMap.bookmarks)),
107
- settingTab: settingMap.bookmarks, // setting tab
108
- autofocustrigger: Date.now(),
109
- bookmarkId: undefined,
110
- showModal: 0,
111
- activeTerminalId: '',
112
-
113
- // setting sync related
114
- isSyncingSetting: false,
115
- isSyncUpload: false,
116
- isSyncDownload: false,
117
- syncSetting: {},
118
- syncType: syncTypes.github,
119
- _fonts: '[]',
120
-
121
- // term search
122
- termSearchOpen: false,
123
- termSearch: '',
124
- termSearchMatchCount: 0,
125
- termSearchMatchIndex: 0,
126
- _termSearchOptions: JSON.stringify({
127
- caseSensitive: false,
128
- wholeWord: false,
129
- regex: false,
130
- decorations: {
131
- activeMatchColorOverviewRuler: 'yellow'
132
- }
133
- }),
134
-
135
- // quick commands
136
- _quickCommands: '[]',
137
- quickCommandId: '',
138
- openQuickCommandBar: false,
139
- pinnedQuickCommandBar: false,
140
-
141
- // sidebar
142
- openedSideBar: ls.getItem(openedSidebarKey),
143
- menuOpened: false,
144
- pinned: ls.getItem(sidebarPinnedKey) === 'true',
145
-
146
- // info/help modal
147
- showInfoModal: false,
148
- infoModalTab: infoTabs.info,
149
- commandLineHelp: '',
150
-
151
- // editor
152
- showEditor: false,
153
-
154
- // file/info modal
155
- showFileModal: false,
156
-
157
- // update
158
- _upgradeInfo: '{}',
159
-
160
- // serial list related
161
- _serials: '[]',
162
- loaddingSerials: false,
163
-
164
- // transfer list
165
- transports: [],
166
-
167
- _sshConfigItems: '[]',
168
-
169
- appPath: '',
170
- exePath: '',
171
- isPortable: false,
172
- installSrc: '',
173
-
174
- _langs: '[]',
175
-
176
- // batch inputs
177
- batchInputs: ls.getItemJSON(batchInputLsKey, []),
178
-
179
- // ui
180
- innerWidth: window.innerWidth,
181
- height: 500,
182
- isMaximized: window.pre.runSync('isMaximized'),
183
- terminalFullScreen: false
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.fetchSshConfigItems()
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()
@@ -2,26 +2,11 @@
2
2
  * sessions not proper closed related functions
3
3
  */
4
4
 
5
- import { isMac, terminalActions } from '../common/constants'
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.36.1",
3
+ "version": "1.37.1",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",