@electerm/electerm-react 1.37.58 → 1.37.60

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.
@@ -9,7 +9,10 @@ import {
9
9
  const { prefix } = window
10
10
  const p = prefix('sftp')
11
11
 
12
- export default (res = {}) => {
12
+ export default (res) => {
13
+ if (!res) {
14
+ return ''
15
+ }
13
16
  const {
14
17
  host, port, username, title, type,
15
18
  path, connectionHoppings
@@ -34,6 +34,9 @@ export default class QuickCommandsList extends List {
34
34
  }
35
35
 
36
36
  renderItem = (item, i) => {
37
+ if (!item) {
38
+ return null
39
+ }
37
40
  const { activeItemId } = this.props
38
41
  const { name, id } = item
39
42
  const cls = classnames(
@@ -3,8 +3,8 @@ export default class SidePanel extends PureComponent {
3
3
  handleMousedown = (e) => {
4
4
  this.dragStart = true
5
5
  this.clientX = e.clientX
6
- document.body.addEventListener('mouseup', this.handleMouseup)
7
- document.body.addEventListener('mousemove', this.handleMousemove)
6
+ window.addEventListener('mouseup', this.handleMouseup)
7
+ window.addEventListener('mousemove', this.handleMousemove)
8
8
  }
9
9
 
10
10
  handleMouseup = (e) => {
@@ -12,15 +12,15 @@ export default class SidePanel extends PureComponent {
12
12
  const {
13
13
  clientX
14
14
  } = e
15
- let nw = clientX - this.clientX + 300
15
+ let nw = clientX - this.clientX + this.props.leftSidebarWidth
16
16
  if (nw < 343) {
17
17
  nw = 343
18
18
  } else if (nw > 600) {
19
19
  nw = 600
20
20
  }
21
21
  this.props.setLeftSidePanelWidth(nw)
22
- document.body.removeEventListener('mouseup', this.handleMouseup)
23
- document.body.removeEventListener('mousemove', this.handleMousemove)
22
+ window.removeEventListener('mouseup', this.handleMouseup)
23
+ window.removeEventListener('mousemove', this.handleMousemove)
24
24
  }
25
25
 
26
26
  handleMousemove = (e) => {
@@ -28,8 +28,17 @@ export default class SidePanel extends PureComponent {
28
28
  clientX
29
29
  } = e
30
30
  const el = document.getElementById('side-panel')
31
- const nw = clientX - this.clientX + this.props.leftSidebarWidth
31
+ let nw = clientX - this.clientX + this.props.leftSidebarWidth
32
+ if (nw < 343) {
33
+ nw = 343
34
+ } else if (nw > 600) {
35
+ nw = 600
36
+ }
32
37
  el.style.width = nw + 'px'
38
+ const el1 = document.querySelector('.sessions')
39
+ if (el1) {
40
+ el1.style.marginLeft = (nw + 43) + 'px'
41
+ }
33
42
  }
34
43
 
35
44
  render () {
@@ -9,7 +9,7 @@
9
9
  z-index 200
10
10
  width 0
11
11
  overflow-y scroll
12
- background main-light
12
+ background main
13
13
  color text
14
14
  .item-list-unit:hover
15
15
  .list-item-remove
@@ -51,14 +51,12 @@
51
51
  position absolute
52
52
  left 43px
53
53
  top 45px
54
- bottom 36px
54
+ bottom 0
55
55
  z-index 200
56
56
  width 0
57
- border-top 5px solid main
57
+ border-right 1px solid darken(main, 30%)
58
58
 
59
59
  .pinned
60
- .sidebar-list
61
- bottom 0
62
60
  .drag-handle
63
61
  display block
64
62
  .sidebar-panel .pinned
@@ -67,8 +67,12 @@ export default class TerminalInfoContent extends PureComponent {
67
67
  clientX
68
68
  } = e
69
69
  const el = document.getElementById('info-panel-wrap')
70
- const nw = this.clientX - clientX + this.props.rightSidebarWidth
71
- console.log(nw, this.clientX, clientX, this.props.rightSidebarWidth)
70
+ let nw = this.clientX - clientX + this.props.rightSidebarWidth
71
+ if (nw < 400) {
72
+ nw = 400
73
+ } else if (nw > 1000) {
74
+ nw = 1000
75
+ }
72
76
  el.style.width = nw + 'px'
73
77
  }
74
78
 
@@ -9,7 +9,10 @@
9
9
  top 100px
10
10
  bottom 0
11
11
  width 500px
12
- background main-light
12
+ background main
13
+ border 1px solid darken(main, 30%)
14
+ border-radius 5px 0 0 5px
15
+ border-right none
13
16
  color text
14
17
  z-index 100
15
18
  overflow-y scroll
@@ -154,7 +154,7 @@ export default (Store) => {
154
154
  globs.langs
155
155
  )
156
156
  store.zoom(store.config.zoom, false, true)
157
- initWsCommon()
157
+ await initWsCommon()
158
158
  }
159
159
  Store.prototype.initData = async function () {
160
160
  const { store } = window
@@ -14,7 +14,7 @@ import {
14
14
  } from '../common/constants'
15
15
  import postMsg from '../common/post-msg'
16
16
  import * as ls from '../common/safe-local-storage'
17
- import { debounce } from 'lodash-es'
17
+ import { debounce, isEmpty } from 'lodash-es'
18
18
 
19
19
  export default store => {
20
20
  autoRun(store, () => {
@@ -65,7 +65,7 @@ export default store => {
65
65
  }).start()
66
66
 
67
67
  autoRun(store, () => {
68
- if (store.config) {
68
+ if (!isEmpty(store.config)) {
69
69
  window.pre.runGlobalAsync('saveUserConfig', store.config)
70
70
  }
71
71
  return store._config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.37.58",
3
+ "version": "1.37.60",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",