@electerm/electerm-react 1.40.18 → 1.50.21

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 (97) hide show
  1. package/client/common/constants.js +57 -7
  2. package/client/common/new-terminal.js +2 -2
  3. package/client/components/auth/login.jsx +34 -57
  4. package/client/components/batch-op/batch-op.jsx +12 -11
  5. package/client/components/bookmark-form/index.jsx +2 -2
  6. package/client/components/bookmark-form/ssh-form.jsx +4 -1
  7. package/client/components/bookmark-form/tree-delete.jsx +5 -5
  8. package/client/components/context-menu/boomarks.jsx +8 -12
  9. package/client/components/context-menu/context-menu.jsx +10 -10
  10. package/client/components/context-menu/history.jsx +21 -24
  11. package/client/components/context-menu/menu-btn.jsx +11 -11
  12. package/client/components/context-menu/tabs.jsx +15 -19
  13. package/client/components/context-menu/zoom.jsx +25 -29
  14. package/client/components/footer/footer-entry.jsx +56 -56
  15. package/client/components/icons/split-icons.jsx +77 -0
  16. package/client/components/layout/layout-alg.js +260 -0
  17. package/client/components/layout/layout-item.jsx +26 -0
  18. package/client/components/layout/layout.jsx +167 -0
  19. package/client/components/layout/layout.styl +5 -0
  20. package/client/components/layout/layouts.jsx +71 -0
  21. package/client/components/layout/session-size-alg.js +31 -0
  22. package/client/components/main/main.jsx +183 -109
  23. package/client/components/main/wrapper.styl +2 -4
  24. package/client/components/profile/profile-list.jsx +1 -3
  25. package/client/components/profile/profile-transport-mod.jsx +1 -1
  26. package/client/components/profile/profile-transport.jsx +6 -9
  27. package/client/components/quick-commands/quick-command-transport.jsx +6 -9
  28. package/client/components/quick-commands/quick-commands-box.jsx +144 -153
  29. package/client/components/quick-commands/quick-commands-select.jsx +10 -3
  30. package/client/components/rdp/rdp-session.jsx +3 -23
  31. package/client/components/rdp/resolution-edit.jsx +40 -42
  32. package/client/components/session/session.jsx +62 -317
  33. package/client/components/session/session.styl +1 -5
  34. package/client/components/session/sessions.jsx +99 -105
  35. package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
  36. package/client/components/setting-panel/setting-common.jsx +6 -4
  37. package/client/components/setting-panel/setting-modal.jsx +31 -31
  38. package/client/components/setting-panel/start-session-select.jsx +4 -4
  39. package/client/components/setting-panel/tab-settings.jsx +27 -5
  40. package/client/components/setting-sync/data-import.jsx +36 -39
  41. package/client/components/setting-sync/setting-sync-form.jsx +9 -9
  42. package/client/components/setting-sync/setting-sync.jsx +50 -52
  43. package/client/components/sftp/address-bookmark.jsx +57 -58
  44. package/client/components/sftp/confirm-modal-store.jsx +34 -40
  45. package/client/components/sftp/file-item.jsx +14 -3
  46. package/client/components/sftp/file-mode-modal.jsx +3 -0
  47. package/client/components/sftp/list-table-ui.jsx +4 -4
  48. package/client/components/sftp/sftp-entry.jsx +2 -2
  49. package/client/components/sftp/transfer-conflict-store.jsx +13 -17
  50. package/client/components/sftp/transport-action-store.jsx +38 -31
  51. package/client/components/sftp/transports-action-store.jsx +3 -3
  52. package/client/components/sftp/transports-ui-store.jsx +18 -23
  53. package/client/components/shortcuts/shortcut-handler.js +1 -0
  54. package/client/components/shortcuts/shortcuts.jsx +9 -12
  55. package/client/components/side-panel-r/right-side-panel.styl +40 -0
  56. package/client/components/side-panel-r/side-panel-r.jsx +102 -0
  57. package/client/components/sidebar/bookmark-select.jsx +40 -40
  58. package/client/components/sidebar/bookmark.jsx +63 -65
  59. package/client/components/sidebar/history.jsx +53 -50
  60. package/client/components/sidebar/index.jsx +195 -184
  61. package/client/components/sidebar/info-modal.jsx +202 -202
  62. package/client/components/sidebar/sidebar.styl +8 -2
  63. package/client/components/sidebar/transfer-history-modal.jsx +95 -100
  64. package/client/components/sidebar/transfer-list-control.jsx +2 -2
  65. package/client/components/sidebar/transfer-list.jsx +45 -42
  66. package/client/components/sidebar/transfer-modal.jsx +49 -52
  67. package/client/components/sidebar/transport-ui.jsx +1 -1
  68. package/client/components/tabs/index.jsx +261 -49
  69. package/client/components/tabs/tab.jsx +60 -65
  70. package/client/components/tabs/tabs.styl +6 -1
  71. package/client/components/tabs/window-control.jsx +46 -48
  72. package/client/components/terminal/index.jsx +101 -104
  73. package/client/components/terminal/term-search.jsx +26 -24
  74. package/client/components/terminal-info/run-cmd.jsx +0 -25
  75. package/client/components/terminal-info/terminal-info.jsx +60 -0
  76. package/client/components/terminal-info/terminal-info.styl +1 -1
  77. package/client/components/tree-list/bookmark-transport.jsx +8 -9
  78. package/client/components/tree-list/tree-list.jsx +36 -26
  79. package/client/components/vnc/vnc-session.jsx +1 -6
  80. package/client/store/common.js +1 -1
  81. package/client/store/event.js +2 -2
  82. package/client/store/index.js +21 -32
  83. package/client/store/init-state.js +15 -3
  84. package/client/store/load-data.js +1 -1
  85. package/client/store/quick-command.js +4 -4
  86. package/client/store/session.js +1 -1
  87. package/client/store/setting.js +9 -5
  88. package/client/store/sync.js +16 -9
  89. package/client/store/system-menu.js +1 -10
  90. package/client/store/tab.js +66 -1
  91. package/client/store/transfer-list.js +5 -6
  92. package/client/store/watch.js +11 -6
  93. package/package.json +1 -1
  94. package/client/components/common/react-subx.jsx +0 -1
  95. package/client/components/common/resize-wrap.jsx +0 -222
  96. package/client/components/common/resize-wrap.styl +0 -9
  97. package/client/components/terminal-info/content.jsx +0 -152
@@ -1,4 +1,4 @@
1
- import { Component } from '../common/react-subx'
1
+ import { Component } from 'react'
2
2
  import copy from 'json-deep-copy'
3
3
  import { findIndex, isFunction } from 'lodash-es'
4
4
  import generate from '../../common/uid'
@@ -51,16 +51,23 @@ export default class TransportAction extends Component {
51
51
  }
52
52
  }
53
53
 
54
+ componentWillUnmount () {
55
+ this.transport && this.transport.destroy()
56
+ this.transport = null
57
+ clearTimeout(this.timer)
58
+ this.timer = null
59
+ }
60
+
54
61
  update = (up) => {
55
- const { store, transfer } = this.props
62
+ const { fileTransfers, transfer } = this.props
56
63
  const {
57
- fileTransfers
58
- } = store
64
+ store
65
+ } = window
59
66
  const index = findIndex(fileTransfers, t => t.id === transfer.id)
60
67
  if (index < 0) {
61
68
  return store.setFileTransfers(fileTransfers)
62
69
  }
63
- window.store.editTransfer(
70
+ store.editTransfer(
64
71
  fileTransfers[index].id,
65
72
  up
66
73
  )
@@ -69,13 +76,10 @@ export default class TransportAction extends Component {
69
76
  }
70
77
 
71
78
  insert = (insts) => {
72
- const { store, transfer } = this.props
73
- const {
74
- fileTransfers
75
- } = store
79
+ const { fileTransfers, transfer } = this.props
76
80
  const index = findIndex(fileTransfers, t => t.id === transfer.id)
77
81
  fileTransfers.splice(index, 1, ...insts)
78
- store.setFileTransfers(fileTransfers)
82
+ window.store.setFileTransfers(fileTransfers)
79
83
  }
80
84
 
81
85
  remoteList = () => {
@@ -95,11 +99,12 @@ export default class TransportAction extends Component {
95
99
  }
96
100
 
97
101
  onEnd = (update = {}) => {
98
- if (this.inst.onCancel) {
102
+ if (this.onCancel) {
99
103
  return
100
104
  }
101
105
  const {
102
- transfer
106
+ transfer,
107
+ config
103
108
  } = this.props
104
109
  const {
105
110
  typeTo,
@@ -107,16 +112,16 @@ export default class TransportAction extends Component {
107
112
  } = transfer
108
113
  const cb = this[typeTo + 'List']
109
114
  const finishTime = Date.now()
110
- if (!this.props.store.config.disableTransferHistory) {
115
+ if (!config.disableTransferHistory) {
111
116
  window.store.addTransferHistory(
112
117
  {
113
118
  ...transfer,
114
119
  ...update,
115
120
  finishTime,
116
- startTime: this.inst.startTime,
121
+ startTime: this.startTime,
117
122
  size: transfer.fromFile.size,
118
123
  next: null,
119
- speed: format(transfer.fromFile.size, this.inst.startTime)
124
+ speed: format(transfer.fromFile.size, this?.startTime)
120
125
  }
121
126
  )
122
127
  }
@@ -127,7 +132,7 @@ export default class TransportAction extends Component {
127
132
  }
128
133
 
129
134
  onData = (transferred) => {
130
- if (this.inst.onCancel) {
135
+ if (this.onCancel) {
131
136
  return
132
137
  }
133
138
  const { transfer } = this.props
@@ -140,7 +145,7 @@ export default class TransportAction extends Component {
140
145
  up.percent = percent
141
146
  up.status = 'active'
142
147
  up.transferred = transferred
143
- up.startTime = this.inst.startTime
148
+ up.startTime = this.startTime
144
149
  up.speed = format(transferred, up.startTime)
145
150
  Object.assign(
146
151
  up,
@@ -151,34 +156,36 @@ export default class TransportAction extends Component {
151
156
  }
152
157
 
153
158
  cancel = (callback) => {
154
- if (this.inst.onCancel) {
159
+ if (this.onCancel) {
155
160
  return
156
161
  }
162
+ this.onCancel = true
157
163
  const {
158
- transfer,
159
- store
164
+ transfer
160
165
  } = this.props
161
- this.inst.onCancel = true
162
- const { id } = transfer
163
- this.inst.transport && this.inst.transport.destroy()
164
166
  let {
165
167
  fileTransfers
166
- } = store
168
+ } = this.props
169
+ const { id } = transfer
170
+ this.transport && this.transport.destroy()
171
+ this.transport = null
167
172
  fileTransfers = fileTransfers.filter(t => {
168
173
  return t.id !== id
169
174
  })
170
- store.setFileTransfers(fileTransfers)
175
+ this.timer = setTimeout(() => {
176
+ window.store.setFileTransfers(fileTransfers)
177
+ }, 100)
171
178
  if (isFunction(callback)) {
172
179
  callback()
173
180
  }
174
181
  }
175
182
 
176
183
  pause = () => {
177
- this.inst.transport && this.inst.transport.pause()
184
+ this.transport && this.transport.pause()
178
185
  }
179
186
 
180
187
  resume = () => {
181
- this.inst.transport && this.inst.transport.resume()
188
+ this.transport && this.transport.resume()
182
189
  }
183
190
 
184
191
  mvOrCp = () => {
@@ -343,7 +350,7 @@ export default class TransportAction extends Component {
343
350
  : toPath
344
351
  const mode = toFile.mode || fromMode
345
352
  const sftp = window.sftps[this.sessionId]
346
- this.inst.transport = await sftp[transferType]({
353
+ this.transport = await sftp[transferType]({
347
354
  remotePath,
348
355
  localPath,
349
356
  options: { mode },
@@ -358,7 +365,7 @@ export default class TransportAction extends Component {
358
365
  }
359
366
 
360
367
  initTransfer = async () => {
361
- if (this.inst.started) {
368
+ if (this.started) {
362
369
  return
363
370
  }
364
371
  const { transfer } = this.props
@@ -378,8 +385,8 @@ export default class TransportAction extends Component {
378
385
  this.update({
379
386
  startTime: t
380
387
  })
381
- this.inst.startTime = t
382
- this.inst.started = true
388
+ this.startTime = t
389
+ this.started = true
383
390
  if (typeFrom === typeTo) {
384
391
  return this.mvOrCp()
385
392
  } else if (unzip && inited) {
@@ -3,7 +3,7 @@
3
3
  * when list changes, do transfer and other op
4
4
  */
5
5
 
6
- import { Component } from '../common/react-subx'
6
+ import { Component } from 'react'
7
7
  import Transports from './transports-ui-store'
8
8
  import { maxTransport } from '../../common/constants'
9
9
 
@@ -21,10 +21,10 @@ export default class TransportsActionStore extends Component {
21
21
  }
22
22
 
23
23
  control = async () => {
24
- const { store } = this.props
24
+ const { store } = window
25
25
  let {
26
26
  fileTransfers
27
- } = store
27
+ } = this.props
28
28
 
29
29
  fileTransfers = fileTransfers.map(t => {
30
30
  const {
@@ -1,30 +1,25 @@
1
1
  /**
2
2
  * transporter UI component
3
3
  */
4
- import { Component } from '../common/react-subx'
4
+
5
5
  import Transport from './transport-action-store'
6
6
 
7
- export default class TransportsUI extends Component {
8
- render () {
9
- const { store } = this.props
10
- const {
11
- fileTransfers
12
- } = store
13
- if (!fileTransfers.length) {
14
- return null
15
- }
16
- return fileTransfers.map((t, i) => {
17
- const { id } = t
18
- return (
19
- <Transport
20
- {...this.props}
21
- transfer={t}
22
- inited={t.inited}
23
- cancel={t.cancel}
24
- pause={t.pausing}
25
- key={id + ':tr:' + i}
26
- />
27
- )
28
- })
7
+ export default function TransportsUI (props) {
8
+ const { fileTransfers } = props
9
+ if (!fileTransfers.length) {
10
+ return null
29
11
  }
12
+ return fileTransfers.map((t, i) => {
13
+ const { id } = t
14
+ return (
15
+ <Transport
16
+ {...props}
17
+ transfer={t}
18
+ inited={t.inited}
19
+ cancel={t.cancel}
20
+ pause={t.pausing}
21
+ key={id + ':tr:' + i}
22
+ />
23
+ )
24
+ })
30
25
  }
@@ -108,6 +108,7 @@ export function shortcutExtend (Cls) {
108
108
  window.store.runQuickCommandItem(
109
109
  qmMatch.id
110
110
  )
111
+ return false
111
112
  }
112
113
  }
113
114
  for (let i = 0; i < len; i++) {
@@ -1,4 +1,4 @@
1
- import { Component } from '../common/react-subx'
1
+ import { PureComponent } from 'react'
2
2
  import shortcutsDefaultsGen from './shortcuts-defaults'
3
3
  import ShortcutEdit from './shortcut-editor'
4
4
  import deepCopy from 'json-deep-copy'
@@ -13,24 +13,24 @@ import {
13
13
  const e = window.translate
14
14
  const shortcutsDefaults = shortcutsDefaultsGen()
15
15
 
16
- export default class Shortcuts extends Component {
16
+ export default class Shortcuts extends PureComponent {
17
17
  handleResetAll = () => {
18
- this.props.store.updateConfig({
18
+ window.store.updateConfig({
19
19
  shortcuts: {}
20
20
  })
21
21
  }
22
22
 
23
23
  updateConfig = (name, value) => {
24
- const { store } = this.props
25
- const shortcuts = deepCopy(store.config.shortcuts || {})
24
+ const { config } = this.props
25
+ const shortcuts = deepCopy(config.shortcuts || {})
26
26
  shortcuts[name] = value
27
- this.props.store.updateConfig({
27
+ window.store.updateConfig({
28
28
  shortcuts
29
29
  })
30
30
  }
31
31
 
32
32
  getData () {
33
- const { shortcuts = {} } = this.props.store.config
33
+ const { shortcuts = {} } = this.props.config
34
34
  return shortcutsDefaults
35
35
  .filter(g => !g.readonly)
36
36
  .map((c, i) => {
@@ -46,9 +46,8 @@ export default class Shortcuts extends Component {
46
46
  }
47
47
 
48
48
  getKeysTakenData = () => {
49
- const { store } = this.props
50
- const { shortcuts = {} } = store.config
51
- const { quickCommands = [] } = store
49
+ const { config, quickCommands = [] } = this.props
50
+ const { shortcuts = {} } = config
52
51
 
53
52
  // Gather system shortcuts
54
53
  const systemShortcuts = shortcutsDefaults.reduce((p, k) => {
@@ -84,7 +83,6 @@ export default class Shortcuts extends Component {
84
83
  }
85
84
 
86
85
  render () {
87
- const { store } = this.props
88
86
  const columns = [
89
87
  {
90
88
  title: 'NO.',
@@ -127,7 +125,6 @@ export default class Shortcuts extends Component {
127
125
  <ShortcutEdit
128
126
  data={inst}
129
127
  keysTaken={this.getKeysTakenData()}
130
- store={store}
131
128
  updateConfig={this.updateConfig}
132
129
  />
133
130
  )
@@ -0,0 +1,40 @@
1
+ @require '../../css/includes/theme-default'
2
+
3
+ .right-side-panel
4
+ position absolute
5
+ right 0
6
+ top 0
7
+ bottom 0
8
+ z-index 200
9
+ background main
10
+ color text-light
11
+ border-left 1px solid darken(main, 30%)
12
+
13
+ .drag-handle
14
+ left 0
15
+ right auto
16
+ display block
17
+
18
+ .right-side-panel-controls
19
+ position absolute
20
+ left 10px
21
+ top 10px
22
+ color text-dark
23
+ font-size 16px
24
+ &:hover
25
+ color text
26
+ cursor pointer
27
+ &.right-side-panel-pin
28
+ left 30px
29
+ &.pinned
30
+ color success
31
+ .right-side-panel-content
32
+ padding 10px
33
+ overflow-y scroll
34
+ position absolute
35
+ left 0
36
+ top 30px
37
+ right 0
38
+ bottom 0
39
+ .animate-fast
40
+ animation-duration .2s
@@ -0,0 +1,102 @@
1
+ import React, { useRef, memo } from 'react'
2
+ import './right-side-panel.styl'
3
+ import {
4
+ CloseCircleOutlined,
5
+ PushpinOutlined
6
+ } from '@ant-design/icons'
7
+
8
+ export default memo(function RightSidePanel (
9
+ {
10
+ rightPanelVisible,
11
+ rightPanelPinned,
12
+ rightPanelWidth,
13
+ children
14
+ }
15
+ ) {
16
+ if (!rightPanelVisible) {
17
+ return null
18
+ }
19
+
20
+ const dragStart = useRef(false)
21
+ const clientX = useRef(0)
22
+
23
+ function handleMousedown (e) {
24
+ dragStart.current = true
25
+ clientX.current = e.clientX
26
+ document.body.addEventListener('mouseup', handleMouseup)
27
+ document.body.addEventListener('mousemove', handleMousemove)
28
+ }
29
+
30
+ function handleMouseup (e) {
31
+ dragStart.current = false
32
+ const {
33
+ clientX: cx
34
+ } = e
35
+ let nw = clientX.current - cx + rightPanelWidth
36
+ if (nw < 400) {
37
+ nw = 400
38
+ } else if (nw > 1000) {
39
+ nw = 1000
40
+ }
41
+ window.store.setRightSidePanelWidth(nw)
42
+ document.body.removeEventListener('mouseup', handleMouseup)
43
+ document.body.removeEventListener('mousemove', handleMousemove)
44
+ }
45
+
46
+ function handleMousemove (e) {
47
+ const {
48
+ clientX: cx
49
+ } = e
50
+ const el = document.getElementById('right-side-panel')
51
+ let nw = clientX.current - cx + rightPanelWidth
52
+ if (nw < 400) {
53
+ nw = 400
54
+ } else if (nw > 1000) {
55
+ nw = 1000
56
+ }
57
+ el.style.width = nw + 'px'
58
+ }
59
+
60
+ function onClose () {
61
+ window.store.rightPanelVisible = false
62
+ }
63
+
64
+ function togglePin () {
65
+ window.store.rightPanelPinned = !window.store.rightPanelPinned
66
+ }
67
+
68
+ const panelProps = {
69
+ className: 'right-side-panel animate-fast',
70
+ id: 'right-side-panel',
71
+ style: {
72
+ width: `${rightPanelWidth}px`
73
+ }
74
+ }
75
+
76
+ const pinProps = {
77
+ className: 'right-side-panel-pin right-side-panel-controls' + (rightPanelPinned ? ' pinned' : ''),
78
+ onClick: togglePin
79
+ }
80
+
81
+ return (
82
+ <div
83
+ {...panelProps}
84
+ >
85
+ <div
86
+ className='drag-handle'
87
+ onMouseDown={handleMousedown}
88
+ draggable={false}
89
+ />
90
+ <CloseCircleOutlined
91
+ className='right-side-panel-close right-side-panel-controls'
92
+ onClick={onClose}
93
+ />
94
+ <PushpinOutlined
95
+ {...pinProps}
96
+ />
97
+ <div className='right-side-panel-content'>
98
+ {children}
99
+ </div>
100
+ </div>
101
+ )
102
+ })
@@ -2,47 +2,47 @@
2
2
  * history select
3
3
  */
4
4
 
5
- import { Component } from '../common/react-subx'
5
+ import { auto } from 'manate/react'
6
6
  import TreeList from '../tree-list/tree-list'
7
7
 
8
- export default class BookmarkSelect extends Component {
9
- render () {
10
- const { store, from } = this.props
11
- const {
12
- listStyle,
13
- openedSideBar,
14
- expandedKeys
15
- } = store
16
- if (from === 'sidebar' && openedSideBar !== 'bookmarks') {
17
- return null
18
- }
19
- const onClickItem = (item) => {
20
- if (!store.pinned) {
21
- store.setOpenedSideBar('')
22
- }
23
- store.onSelectBookmark(item.id)
24
- }
25
- const base = {
26
- store,
27
- bookmarks: store.bookmarks || [],
28
- type: 'bookmarks',
29
- onClickItem,
30
- listStyle,
31
- staticList: true
32
- }
33
- if (!store.config.hideSshConfig) {
34
- base.bookmarks.push(...store.sshConfigItems)
35
- }
36
- const propsTree = {
37
- ...base,
38
- shouldConfirmDel: true,
39
- bookmarkGroups: store.getBookmarkGroupsTotal(),
40
- expandedKeys
8
+ export default auto(function BookmarkSelect (props) {
9
+ const { store, from } = props
10
+ const {
11
+ listStyle,
12
+ openedSideBar,
13
+ leftSidebarWidth,
14
+ expandedKeys
15
+ } = store
16
+ if (from === 'sidebar' && openedSideBar !== 'bookmarks') {
17
+ return null
18
+ }
19
+ const onClickItem = (item) => {
20
+ if (!store.pinned) {
21
+ store.setOpenedSideBar('')
41
22
  }
42
- return (
43
- <TreeList
44
- {...propsTree}
45
- />
46
- )
23
+ store.onSelectBookmark(item.id)
24
+ }
25
+ const base = {
26
+ bookmarks: store.bookmarks || [],
27
+ type: 'bookmarks',
28
+ onClickItem,
29
+ listStyle,
30
+ staticList: true
31
+ }
32
+ if (!store.config.hideSshConfig) {
33
+ base.bookmarks.push(...store.sshConfigItems)
34
+ }
35
+ const propsTree = {
36
+ ...base,
37
+ shouldConfirmDel: true,
38
+ bookmarkGroups: store.getBookmarkGroupsTotal(),
39
+ expandedKeys,
40
+ leftSidebarWidth,
41
+ bookmarkGroupTree: store.bookmarkGroupTree
47
42
  }
48
- }
43
+ return (
44
+ <TreeList
45
+ {...propsTree}
46
+ />
47
+ )
48
+ })
@@ -2,7 +2,7 @@
2
2
  * history select
3
3
  */
4
4
 
5
- import { Component } from '../common/react-subx'
5
+ import { memo } from 'react'
6
6
  import BookmarkSelect from './bookmark-select'
7
7
  import { pick } from 'lodash-es'
8
8
  import { ArrowsAltOutlined, EditOutlined, PlusCircleOutlined, ShrinkOutlined, PushpinOutlined } from '@ant-design/icons'
@@ -10,70 +10,68 @@ import { Tooltip } from 'antd'
10
10
 
11
11
  const e = window.translate
12
12
 
13
- export default class BookmarkPanel extends Component {
14
- render () {
15
- const { props } = this
16
- const { store } = props
17
- const prps = {
18
- className: 'font16 mg1x mg2l pointer iblock control-icon'
19
- }
20
- const prps1 = {
21
- className: prps.className + (store.pinned ? ' pinned' : '')
22
- }
23
- const pop1 = {
24
- ...prps,
25
- onClick: store.onNewSsh
26
- }
27
- const pop2 = {
28
- ...prps,
29
- onClick: store.expandBookmarks
30
- }
31
- const pop3 = {
32
- ...prps,
33
- onClick: store.collapseBookmarks
34
- }
35
- return (
36
- <div
37
- className='sidebar-panel bookmarks-panel animate-fast'
38
- {...pick(props, ['onMouseEnter', 'onMouseLeave'])}
39
- >
40
- <div className='pd1y pd2t pd2x'>
41
- <div className='fix'>
42
- <div className='fleft'>{e('bookmarks')}</div>
43
- <div className='fright'>
44
- <Tooltip title={e('newBookmark')}>
45
- <PlusCircleOutlined
46
- {...pop1}
47
- />
48
- </Tooltip>
49
- <Tooltip title={`${e('edit')} ${e('bookmarks')}`}>
50
- <EditOutlined
51
- {...pop1}
52
- />
53
- </Tooltip>
54
- <Tooltip title={e('expandAll')}>
55
- <ArrowsAltOutlined
56
- {...pop2}
57
- />
58
- </Tooltip>
59
- <Tooltip title={e('collapseAll')}>
60
- <ShrinkOutlined
61
- {...pop3}
62
- />
63
- </Tooltip>
64
- <Tooltip title={e('pin')}>
65
- <PushpinOutlined
66
- {...prps1}
67
- onClick={store.handlePin}
68
- />
69
- </Tooltip>
70
- </div>
13
+ export default memo(function BookmarkPanel (props) {
14
+ const { pinned } = props
15
+ const prps = {
16
+ className: 'font16 mg1x mg2l pointer iblock control-icon'
17
+ }
18
+ const prps1 = {
19
+ className: prps.className + (pinned ? ' pinned' : '')
20
+ }
21
+ const { store } = window
22
+ const pop1 = {
23
+ ...prps,
24
+ onClick: store.onNewSsh
25
+ }
26
+ const pop2 = {
27
+ ...prps,
28
+ onClick: store.expandBookmarks
29
+ }
30
+ const pop3 = {
31
+ ...prps,
32
+ onClick: store.collapseBookmarks
33
+ }
34
+ return (
35
+ <div
36
+ className='sidebar-panel bookmarks-panel animate-fast'
37
+ {...pick(props, ['onMouseEnter', 'onMouseLeave'])}
38
+ >
39
+ <div className='pd1y pd2t pd2x'>
40
+ <div className='fix'>
41
+ <div className='fleft'>{e('bookmarks')}</div>
42
+ <div className='fright'>
43
+ <Tooltip title={e('newBookmark')}>
44
+ <PlusCircleOutlined
45
+ {...pop1}
46
+ />
47
+ </Tooltip>
48
+ <Tooltip title={`${e('edit')} ${e('bookmarks')}`}>
49
+ <EditOutlined
50
+ {...pop1}
51
+ />
52
+ </Tooltip>
53
+ <Tooltip title={e('expandAll')}>
54
+ <ArrowsAltOutlined
55
+ {...pop2}
56
+ />
57
+ </Tooltip>
58
+ <Tooltip title={e('collapseAll')}>
59
+ <ShrinkOutlined
60
+ {...pop3}
61
+ />
62
+ </Tooltip>
63
+ <Tooltip title={e('pin')}>
64
+ <PushpinOutlined
65
+ {...prps1}
66
+ onClick={store.handlePin}
67
+ />
68
+ </Tooltip>
71
69
  </div>
72
70
  </div>
73
- <div className='pd2l sidebar-inner'>
74
- <BookmarkSelect store={store} from='sidebar' />
75
- </div>
76
71
  </div>
77
- )
78
- }
79
- }
72
+ <div className='pd2l sidebar-inner'>
73
+ <BookmarkSelect store={store} from='sidebar' />
74
+ </div>
75
+ </div>
76
+ )
77
+ })