@electerm/electerm-react 1.37.126 → 1.38.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.
Files changed (38) hide show
  1. package/client/common/constants.js +2 -1
  2. package/client/common/default-setting.js +1 -1
  3. package/client/common/pre.js +1 -1
  4. package/client/components/batch-op/batch-op.jsx +7 -1
  5. package/client/components/common/logo-elem.jsx +4 -3
  6. package/client/components/common/logo.styl +9 -0
  7. package/client/components/footer/footer-entry.jsx +1 -1
  8. package/client/components/footer/footer.styl +11 -2
  9. package/client/components/main/main.jsx +1 -0
  10. package/client/components/main/wrapper.styl +0 -2
  11. package/client/components/quick-commands/qm.styl +3 -0
  12. package/client/components/quick-commands/quick-commands-box.jsx +1 -1
  13. package/client/components/quick-commands/quick-commands-select.jsx +3 -1
  14. package/client/components/session/session.jsx +7 -1
  15. package/client/components/session/sessions.jsx +7 -0
  16. package/client/components/setting-panel/setting-common.jsx +5 -5
  17. package/client/components/setting-panel/setting-modal.jsx +3 -1
  18. package/client/components/setting-panel/setting-wrap.jsx +10 -0
  19. package/client/components/setting-panel/setting-wrap.styl +28 -1
  20. package/client/components/setting-panel/setting.styl +8 -1
  21. package/client/components/shortcuts/shortcut-handler.js +11 -0
  22. package/client/components/shortcuts/shortcuts-defaults.js +5 -0
  23. package/client/components/sidebar/sidebar.styl +4 -1
  24. package/client/components/tabs/index.jsx +9 -2
  25. package/client/components/tabs/tab.jsx +17 -6
  26. package/client/components/tabs/tabs.styl +13 -6
  27. package/client/components/tabs/window-control.jsx +4 -1
  28. package/client/components/terminal/attach-addon-custom.js +11 -2
  29. package/client/components/terminal/fs.js +59 -0
  30. package/client/components/terminal/index.jsx +245 -126
  31. package/client/components/terminal/xterm-zmodem.js +40 -33
  32. package/client/css/basic.styl +1 -1
  33. package/client/css/mobile.styl +8 -0
  34. package/client/entry/basic.js +1 -0
  35. package/client/store/index.js +0 -5
  36. package/client/store/init-state.js +2 -1
  37. package/package.json +1 -1
  38. package/client/components/terminal/zmodem-transfer.jsx +0 -98
@@ -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 + 46
38
+ export const sftpControlHeight = 28 + 42 + 33 + 36
39
39
  export const sidebarWidth = 43
40
40
  export const maxHistory = 50
41
41
  export const maxTransport = 5
@@ -339,3 +339,4 @@ export const instSftpKeys = [
339
339
  'writeFile'
340
340
  ]
341
341
  export const cwdId = '=__+__'
342
+ export const zmodemTransferPackSize = 1024 * 1024 * 2
@@ -31,7 +31,7 @@ export default {
31
31
  checkUpdateOnStart: true,
32
32
  cursorBlink: false,
33
33
  cursorStyle: 'block',
34
- useSystemTitleBar: false,
34
+ useSystemTitleBar: window.pre.isLinux || window.et.isLinux || false,
35
35
  opacity: 1,
36
36
  defaultEditor: '',
37
37
  terminalWordSeparator: './\\()"\'-:,.;<>~!@#$%^&*|+=[]{}`~ ?',
@@ -104,7 +104,7 @@ const fs = {
104
104
  const cb = args.pop()
105
105
  window.fs.readCustom(
106
106
  p1,
107
- encodeUint8Array(arr),
107
+ arr.length,
108
108
  ...args
109
109
  )
110
110
  .then((data) => {
@@ -540,6 +540,11 @@ export default class BatchOp extends Component {
540
540
 
541
541
  renderTab = (tab) => {
542
542
  const data = this.state[tab]
543
+ const keeps = [
544
+ 'index',
545
+ 'host',
546
+ 'state'
547
+ ]
543
548
  const columns = [
544
549
  'index',
545
550
  'host',
@@ -556,7 +561,8 @@ export default class BatchOp extends Component {
556
561
  title: this.translate(k),
557
562
  dataIndex: k,
558
563
  key: k,
559
- render: (k) => k || ''
564
+ render: (k) => k || '',
565
+ responsive: keeps.includes(k) ? undefined : ['md', 'lg', 'xl', 'xxl']
560
566
  }
561
567
  })
562
568
  if (tab === 'tasks') {
@@ -5,16 +5,17 @@ import {
5
5
  packInfo
6
6
  } from '../../common/constants'
7
7
  import { Tag } from 'antd'
8
+ import './logo.styl'
8
9
 
9
10
  export default function LogoElem () {
10
11
  return (
11
12
  <h1 className='mg3y font50'>
12
13
  <span className='iblock pd3 morph-shape mg1l mg1r'>
13
- <img src={logoPath2} height={80} className='iblock mwm-100 mg1l mg1r logo-filter' />
14
+ <img src={logoPath2} className='iblock mwm-100 mg1l mg1r logo-filter logo-img' />
14
15
  </span>
15
- <img src={logoPath3} height={80} className='hide' />
16
+ <img src={logoPath3} className='hide logo-img' />
16
17
  <sup>
17
- <img src={logoPath1} height={28} className='iblock mwm-100 mg1r' />
18
+ <img src={logoPath1} className='iblock mwm-100 mg1r logo-img-small' />
18
19
  </sup>
19
20
  <Tag color='#08c'>{packInfo.version}</Tag>
20
21
  </h1>
@@ -0,0 +1,9 @@
1
+ .logo-img
2
+ height 80px
3
+ .logo-img-small
4
+ height 28px
5
+ @media (max-width: 500px)
6
+ .logo-img
7
+ height 40px
8
+ .logo-img-small
9
+ height 20px
@@ -80,7 +80,7 @@ export default class SystemMenu extends Component {
80
80
  <div className='terminal-footer-unit terminal-footer-info'>
81
81
  <div className='fleft relative'>
82
82
  <Select
83
- style={{ minWidth: 100 }}
83
+ style={{ minWidth: 30 }}
84
84
  placeholder={f('encode')}
85
85
  defaultValue={this.props.currentTab?.encode}
86
86
  onSelect={this.handleSwitchEncoding}
@@ -21,7 +21,7 @@
21
21
  line-height 24px
22
22
  .terminal-footer-unit
23
23
  margin-left 10px
24
- line-height 34px
24
+ line-height 39px
25
25
  textarea.ant-input
26
26
  min-height 26px
27
27
  height 26px
@@ -44,4 +44,13 @@
44
44
  .bi-compact
45
45
  display none
46
46
  .batch-input-holder
47
- width 100px
47
+ width 100px
48
+ @media (max-width: 500px)
49
+ .batch-input-outer
50
+ &.bi-show
51
+ position fixed
52
+ left 100px
53
+ right 0
54
+ bottom 0
55
+ z-index 100
56
+ background main
@@ -73,6 +73,7 @@ export default class Index extends Component {
73
73
  const cls = classnames({
74
74
  loaded: configLoaded,
75
75
  'system-ui': store.config.useSystemTitleBar,
76
+ 'not-system-ui': !store.config.useSystemTitleBar,
76
77
  'is-mac': isMac,
77
78
  'is-win': isWin,
78
79
  pinned,
@@ -1,6 +1,4 @@
1
1
  @require '../../css/includes/theme-default'
2
- #container
3
- min-width 600px
4
2
  .common-err-desc
5
3
  &:hover
6
4
  text-overflow clip
@@ -27,3 +27,6 @@
27
27
  &.label-match
28
28
  font-weight bold
29
29
  opacity 1
30
+ @media (max-width: 500px)
31
+ .qm-search-input
32
+ width 100px
@@ -193,7 +193,7 @@ export default class QuickCommandsFooterBox extends Component {
193
193
  value={this.state.keyword}
194
194
  onChange={this.handleChange}
195
195
  placeholder=''
196
- className='iblock'
196
+ className='iblock qm-search-input'
197
197
  />
198
198
  </span>
199
199
  <span className='fleft mg1l'>
@@ -29,8 +29,10 @@ export default class QuickCommandsFooter extends PureComponent {
29
29
  size='small'
30
30
  onMouseEnter={this.handleOpen}
31
31
  onMouseLeave={this.handleMouseLeave}
32
+ type='ghost'
32
33
  >
33
- {e('quickCommands')}
34
+ <span className='w500'>{e('quickCommands')}</span>
35
+ <span className='l500'>Q</span>
34
36
  </Button>
35
37
  </div>
36
38
  )
@@ -506,6 +506,11 @@ export default class SessionWrapper extends Component {
506
506
  }
507
507
  )
508
508
  }
509
+ const simpleMapper = {
510
+ [paneMap.terminal]: 'T',
511
+ [paneMap.fileManager]: 'F',
512
+ [paneMap.ssh]: 'T'
513
+ }
509
514
  return (
510
515
  <div
511
516
  className='terminal-control fix'
@@ -527,7 +532,8 @@ export default class SessionWrapper extends Component {
527
532
  onClick={() => this.onChangePane(types[i])}
528
533
  >
529
534
  <span className='type-tab-txt'>
530
- {e(type)}
535
+ <span className='w500'>{e(type)}</span>
536
+ <span className='l500'>{simpleMapper[type]}</span>
531
537
  <span className='type-tab-line' />
532
538
  </span>
533
539
  </span>
@@ -49,6 +49,13 @@ class Sessions extends Component {
49
49
  )
50
50
  }
51
51
 
52
+ reloadCurrentTabShortcut = (e) => {
53
+ e.stopPropagation()
54
+ this.reloadTab(
55
+ this.getCurrentTab()
56
+ )
57
+ }
58
+
52
59
  watch = () => {
53
60
  window.addEventListener('message', this.onEvent)
54
61
  }
@@ -251,7 +251,7 @@ export default class SettingCommon extends Component {
251
251
  )
252
252
  }
253
253
 
254
- renderNumber = (name, options, title = '', width = 136) => {
254
+ renderNumber = (name, options, title = '', width = '100%') => {
255
255
  let value = this.props.config[name]
256
256
  if (options.valueParser) {
257
257
  value = options.valueParser(value)
@@ -286,7 +286,7 @@ export default class SettingCommon extends Component {
286
286
  return vv
287
287
  }
288
288
  opts.style = {
289
- width: width + 'px'
289
+ width
290
290
  }
291
291
  }
292
292
  return (
@@ -554,7 +554,7 @@ export default class SettingCommon extends Component {
554
554
  step: 200,
555
555
  min: 100,
556
556
  cls: 'timeout-desc'
557
- }, e('timeoutDesc'), 400)
557
+ }, e('timeoutDesc'))
558
558
  }
559
559
  {
560
560
  this.renderNumber('keepaliveInterval', {
@@ -563,7 +563,7 @@ export default class SettingCommon extends Component {
563
563
  max: 20000000,
564
564
  cls: 'keepalive-interval-desc',
565
565
  extraDesc: '(ms)'
566
- }, e('keepaliveIntervalDesc'), 400)
566
+ }, e('keepaliveIntervalDesc'))
567
567
  }
568
568
  {
569
569
  this.renderNumber('opacity', {
@@ -571,7 +571,7 @@ export default class SettingCommon extends Component {
571
571
  min: 0,
572
572
  max: 1,
573
573
  cls: 'opacity'
574
- }, e('opacity'), 400)
574
+ }, e('opacity'))
575
575
  }
576
576
 
577
577
  <div className='pd2b'>
@@ -144,7 +144,8 @@ export default class SettingModalWrap extends Component {
144
144
  const {
145
145
  showModal,
146
146
  hideSettingModal,
147
- innerWidth
147
+ innerWidth,
148
+ useSystemTitleBar
148
149
  } = this.props.store
149
150
  const show = showModal === modals.setting
150
151
  if (!show) {
@@ -154,6 +155,7 @@ export default class SettingModalWrap extends Component {
154
155
  <SettingModal
155
156
  onCancel={hideSettingModal}
156
157
  visible={show}
158
+ useSystemTitleBar={useSystemTitleBar}
157
159
  innerWidth={innerWidth}
158
160
  >
159
161
  {this.renderTabs()}
@@ -6,9 +6,16 @@ import { Component } from 'react'
6
6
  import { Drawer } from 'antd'
7
7
  import { CloseCircleOutlined } from '@ant-design/icons'
8
8
  import { sidebarWidth } from '../../common/constants'
9
+ import AppDrag from '../tabs/app-drag'
9
10
  import './setting-wrap.styl'
10
11
 
11
12
  export default class SettingWrap extends Component {
13
+ renderDrag () {
14
+ return (
15
+ <AppDrag />
16
+ )
17
+ }
18
+
12
19
  render () {
13
20
  const pops = {
14
21
  open: this.props.visible,
@@ -32,6 +39,9 @@ export default class SettingWrap extends Component {
32
39
  className='close-setting-wrap'
33
40
  onClick={this.props.onCancel}
34
41
  />
42
+ {
43
+ this.props.useSystemTitleBar ? null : <AppDrag />
44
+ }
35
45
  {this.props.visible ? this.props.children : null}
36
46
  </Drawer>
37
47
  )
@@ -47,4 +47,31 @@ body .ant-drawer .ant-drawer-content-wrapper
47
47
  padding 55px 20px 0 50px
48
48
  .setting-col
49
49
  ::-webkit-scrollbar
50
- width 0
50
+ width 0
51
+ @media (max-width: 1100px)
52
+ .setting-col
53
+ position fixed
54
+ top 128px
55
+ bottom 0
56
+ left 43px
57
+ right 0
58
+ overflow-y scroll
59
+ .setting-row
60
+ position static
61
+ top auto
62
+ .setting-row-left
63
+ left auto
64
+ width auto
65
+ bottom auto
66
+ padding 138px 10px 10px 10px
67
+ .setting-row-right
68
+ left auto
69
+ right auto
70
+ bottom auto
71
+ top auto
72
+ padding 10px
73
+ .setting-tabs-bookmarks
74
+ .setting-row-left
75
+ width auto
76
+ .setting-row-right
77
+ left auto
@@ -3,4 +3,11 @@
3
3
  padding 0
4
4
  margin 5px 5px 0 0
5
5
  .font-sel
6
- min-width 200px
6
+ min-width 200px
7
+ .setting-wrap .app-drag
8
+ position fixed
9
+ top 0
10
+ left 43px
11
+ height 60px
12
+ right 0
13
+ z-index 888
@@ -75,6 +75,17 @@ export function shortcutExtend (Cls) {
75
75
  ) {
76
76
  return true
77
77
  }
78
+ if (
79
+ this.term &&
80
+ key === 'c' &&
81
+ type === 'keydown' &&
82
+ !altKey &&
83
+ !shiftKey &&
84
+ ctrlKey &&
85
+ this.onZmodem
86
+ ) {
87
+ this.onZmodemEnd()
88
+ }
78
89
  const codeName = event instanceof window.WheelEvent
79
90
  ? (wheelDeltaY > 0 ? 'mouseWheelUp' : 'mouseWheelDown')
80
91
  : code
@@ -5,6 +5,11 @@ export default () => {
5
5
  shortcut: 'alt+w',
6
6
  shortcutMac: 'alt+w'
7
7
  },
8
+ {
9
+ name: 'app_reloadCurrentTab',
10
+ shortcut: 'alt+r',
11
+ shortcutMac: 'alt+r'
12
+ },
8
13
  {
9
14
  name: 'app_newBookmark',
10
15
  shortcut: 'ctrl+n',
@@ -26,6 +26,9 @@
26
26
  box-shadow 0px 0px 3px 3px alpha(main, .1)
27
27
  .item-list
28
28
  padding-right 0
29
+ .not-system-ui.is-mac
30
+ .sidebar-bar
31
+ margin-top 20px
29
32
  .type-bookmarks
30
33
  .bookmarks-panel
31
34
  width 100%
@@ -50,7 +53,7 @@
50
53
  .sidebar-list
51
54
  position absolute
52
55
  left 43px
53
- top 45px
56
+ top 36px
54
57
  bottom 0
55
58
  z-index 200
56
59
  width 0
@@ -18,7 +18,13 @@ import {
18
18
  import { Dropdown, Menu, Popover } from 'antd'
19
19
  import Tab from './tab'
20
20
  import './tabs.styl'
21
- import { tabWidth, tabMargin, extraTabWidth, windowControlWidth } from '../../common/constants'
21
+ import {
22
+ tabWidth,
23
+ tabMargin,
24
+ extraTabWidth,
25
+ windowControlWidth,
26
+ isMacJs
27
+ } from '../../common/constants'
22
28
  import findParentBySel from '../../common/find-parent'
23
29
  import WindowControl from './window-control'
24
30
  import BookmarksList from '../sidebar/bookmark-select'
@@ -239,8 +245,9 @@ export default class Tabs extends React.Component {
239
245
  const left = overflow
240
246
  ? '100%'
241
247
  : tabsWidthAll
248
+ const w1 = isMacJs ? 30 : windowControlWidth
242
249
  const style = {
243
- width: width - windowControlWidth - 136
250
+ width: width - w1 - 136
244
251
  }
245
252
  return (
246
253
  <div
@@ -2,7 +2,7 @@
2
2
  * file section
3
3
  */
4
4
 
5
- import React from 'react'
5
+ import { Component } from 'react'
6
6
  import runIdle from '../../common/run-idle'
7
7
  import {
8
8
  CloseOutlined,
@@ -21,7 +21,7 @@ import {
21
21
  terminalSshConfigType,
22
22
  commonActions
23
23
  } from '../../common/constants'
24
- import TabTitle from './tab-title'
24
+ import { shortcutDescExtend } from '../shortcuts/shortcut-handler.js'
25
25
 
26
26
  const { prefix } = window
27
27
  const e = prefix('tabs')
@@ -29,7 +29,7 @@ const m = prefix('menu')
29
29
  const onDragCls = 'ondrag-tab'
30
30
  const onDragOverCls = 'dragover-tab'
31
31
 
32
- export default class Tab extends React.Component {
32
+ class Tab extends Component {
33
33
  constructor (props) {
34
34
  super(props)
35
35
  this.state = {
@@ -245,13 +245,14 @@ export default class Tab extends React.Component {
245
245
  setTabs(tabs)
246
246
  }
247
247
 
248
- renderContext () {
248
+ renderContext = () => {
249
249
  const { tabs, tab } = this.props
250
250
  const len = tabs.length
251
251
  const index = findIndex(tabs, t => t.id === tab.id)
252
252
  const noRight = index >= len - 1
253
253
  const isSshConfig = tab.type === terminalSshConfigType
254
254
  const res = []
255
+ const reloadShortcut = this.getShortcut('app_reloadCurrentTab')
255
256
  res.push({
256
257
  func: 'handleClose',
257
258
  icon: 'CloseOutlined',
@@ -288,7 +289,8 @@ export default class Tab extends React.Component {
288
289
  res.push({
289
290
  func: 'handleReloadTab',
290
291
  icon: 'Loading3QuartersOutlined',
291
- text: m('reload')
292
+ text: m('reload'),
293
+ subText: reloadShortcut
292
294
  })
293
295
  return res
294
296
  }
@@ -379,6 +381,10 @@ export default class Tab extends React.Component {
379
381
  if (isEditting) {
380
382
  return this.renderEditting(tab, cls)
381
383
  }
384
+ const { tabCount, color } = tab
385
+ const styleTag = color
386
+ ? { borderTop: `1px solid ${color}` }
387
+ : {}
382
388
  return (
383
389
  <Tooltip
384
390
  title={title}
@@ -404,6 +410,7 @@ export default class Tab extends React.Component {
404
410
  className='tab-title elli pd1x'
405
411
  onClick={this.handleClick}
406
412
  onDoubleClick={this.handleDup}
413
+ style={styleTag}
407
414
  onContextMenu={this.handleContextMenu}
408
415
  >
409
416
  <Loading3QuartersOutlined
@@ -411,7 +418,9 @@ export default class Tab extends React.Component {
411
418
  onClick={this.handleReloadTab}
412
419
  title={m('reload')}
413
420
  />
414
- <TabTitle tab={tab} />
421
+ <span className='tab-title'>
422
+ {tabCount}. {title}
423
+ </span>
415
424
  </div>
416
425
  <div className={'tab-status ' + status} />
417
426
  <div className='tab-traffic' />
@@ -424,3 +433,5 @@ export default class Tab extends React.Component {
424
433
  )
425
434
  }
426
435
  }
436
+
437
+ export default shortcutDescExtend(Tab)
@@ -1,17 +1,24 @@
1
1
  @require '../../css/includes/theme-default'
2
2
  .tabs
3
3
  position relative
4
- height 45px
4
+ height 36px
5
5
  overflow hidden
6
6
  background main-dark
7
-
7
+ ::-webkit-scrollbar
8
+ width 0
9
+ display none
10
+ .not-system-ui.is-mac
11
+ .tabs-inner
12
+ margin-left 72px
13
+ .tabs-extra
14
+ right 0
8
15
  .tabs-inner
9
16
  position relative
10
17
  z-index 2
11
18
  padding 0
12
19
  margin-top 0
13
20
  display inline-block
14
- height 63px
21
+ height 36px
15
22
  overflow-x scroll
16
23
  overflow-y hidden
17
24
  margin-left 42px
@@ -25,7 +32,7 @@
25
32
  min-width 100px
26
33
  max-width 200px
27
34
  line-height 36px
28
- margin 10px 1px 0 0
35
+ margin 0 1px 0 0
29
36
  border-radius 3px 3px 0 0
30
37
  background main-dark
31
38
  text-align center
@@ -118,13 +125,13 @@
118
125
  .tabs-add-btn
119
126
  display inline-block
120
127
  vertical-align middle
121
- margin 10px 3px 0 3px
128
+ margin 0 3px 0 3px
122
129
  -webkit-app-region no-drag
123
130
  color text
124
131
  &.empty
125
132
  font-size 20px
126
133
  margin-left 20px
127
- margin-top 20px
134
+ margin-top 10px
128
135
  &:hover
129
136
  color text-light
130
137
  .tabs-extra
@@ -4,6 +4,9 @@
4
4
 
5
5
  import { CloseOutlined, MinusOutlined } from '@ant-design/icons'
6
6
  import { Component } from '../common/react-subx'
7
+ import {
8
+ isMacJs
9
+ } from '../../common/constants'
7
10
 
8
11
  const { prefix } = window
9
12
  const m = prefix('menu')
@@ -14,7 +17,7 @@ export default class WindowControl extends Component {
14
17
  isMaximized,
15
18
  config
16
19
  } = this.props.store
17
- if (config.useSystemTitleBar) {
20
+ if (config.useSystemTitleBar || isMacJs) {
18
21
  return null
19
22
  }
20
23
  const minimize = () => {
@@ -7,12 +7,16 @@ import strip from '@electerm/strip-ansi'
7
7
  export default class AttachAddonCustom extends AttachAddon {
8
8
  constructor (term, options, encode, isWindowsShell) {
9
9
  super(term, options)
10
+ this.term = term
10
11
  this.decoder = new TextDecoder(encode)
11
12
  this.isWindowsShell = isWindowsShell
12
13
  }
13
14
 
14
- activate (terminal) {
15
+ activate (terminal = this.term) {
15
16
  const writeToTerminal = (data) => {
17
+ if (terminal.parent?.onZmodem) {
18
+ return
19
+ }
16
20
  if (typeof data === 'string') {
17
21
  return terminal.write(data)
18
22
  }
@@ -79,6 +83,12 @@ export default class AttachAddonCustom extends AttachAddon {
79
83
  this._disposables.push(addSocketListener(this._socket, 'close', () => this.dispose()))
80
84
  this._disposables.push(addSocketListener(this._socket, 'error', () => this.dispose()))
81
85
  }
86
+
87
+ dispose () {
88
+ this.term = null
89
+ this._disposables.forEach(d => d.dispose())
90
+ this._disposables.length = 0
91
+ }
82
92
  }
83
93
 
84
94
  function addSocketListener (socket, type, handler) {
@@ -86,7 +96,6 @@ function addSocketListener (socket, type, handler) {
86
96
  return {
87
97
  dispose: () => {
88
98
  if (!handler) {
89
- // Already disposed
90
99
  return
91
100
  }
92
101
  socket.removeEventListener(type, handler)