@electerm/electerm-react 1.39.68 → 1.39.88

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 (27) hide show
  1. package/client/common/constants.js +7 -0
  2. package/client/common/create-title.jsx +1 -1
  3. package/client/common/default-setting.js +2 -1
  4. package/client/components/bookmark-form/color-picker.jsx +1 -1
  5. package/client/components/bookmark-form/render-auth-ssh.jsx +8 -1
  6. package/client/components/bookmark-form/render-delayed-scripts.jsx +35 -33
  7. package/client/components/bookmark-form/ssh-form.jsx +0 -9
  8. package/client/components/footer/footer-entry.jsx +1 -1
  9. package/client/components/footer/footer.styl +1 -1
  10. package/client/components/quick-commands/quick-commands-box.jsx +13 -4
  11. package/client/components/session/session.jsx +1 -1
  12. package/client/components/setting-sync/data-select-item.jsx +25 -0
  13. package/client/components/setting-sync/data-select.jsx +51 -0
  14. package/client/components/setting-sync/setting-sync.jsx +12 -1
  15. package/client/components/sftp/file-item.jsx +2 -2
  16. package/client/components/sidebar/side-panel.jsx +3 -2
  17. package/client/components/tabs/tab-title.jsx +1 -1
  18. package/client/components/tabs/tab.jsx +26 -0
  19. package/client/components/tabs/tabs.styl +3 -0
  20. package/client/components/terminal/index.jsx +1 -1
  21. package/client/components/terminal/term-search.jsx +5 -4
  22. package/client/components/terminal-info/data-cols-parser.jsx +13 -11
  23. package/client/components/terminal-info/terminal-info.styl +4 -4
  24. package/client/components/tree-list/tree-list.jsx +2 -1
  25. package/client/components/tree-list/tree-list.styl +3 -2
  26. package/client/store/sync.js +104 -54
  27. package/package.json +1 -1
@@ -352,3 +352,10 @@ export const instSftpKeys = [
352
352
  ]
353
353
  export const cwdId = '=__+__'
354
354
  export const zmodemTransferPackSize = 1024 * 1024 * 2
355
+ export const syncDataMaps = {
356
+ settings: ['config'],
357
+ bookmarks: ['bookmarks', 'bookmarkGroups', 'profiles'],
358
+ terminalThemes: ['terminalThemes'],
359
+ quickCommands: ['quickCommands'],
360
+ addressBookmarks: ['addressBookmarks']
361
+ }
@@ -58,7 +58,7 @@ export function createTitleTag (obj) {
58
58
  ? { color }
59
59
  : {}
60
60
  return (
61
- <span style={styleTag}>♦</span>
61
+ <span style={styleTag} className='tab-title-tag'>●</span>
62
62
  )
63
63
  }
64
64
 
@@ -58,5 +58,6 @@ export default {
58
58
  'size',
59
59
  'modifyTime'
60
60
  ],
61
- hideIP: false
61
+ hideIP: false,
62
+ dataSyncSelected: 'all'
62
63
  }
@@ -48,7 +48,7 @@ export const ColorPicker = React.forwardRef((props, ref) => {
48
48
  {...props}
49
49
  key={color}
50
50
  >
51
- {color}
51
+ {color}
52
52
  </div>
53
53
  )
54
54
  })
@@ -24,6 +24,13 @@ export default function renderAuth (props) {
24
24
  form,
25
25
  authType
26
26
  } = props
27
+ const beforeUpload = async (file) => {
28
+ const privateKey = await window.fs.readFile(file.path)
29
+ form.setFieldsValue({
30
+ privateKey
31
+ })
32
+ return false
33
+ }
27
34
  if (authType === 'password') {
28
35
  const opts = {
29
36
  options: uniqBy(
@@ -101,7 +108,7 @@ export default function renderAuth (props) {
101
108
  />
102
109
  </FormItem>
103
110
  <Upload
104
- beforeUpload={file => props.beforeUpload(file, form)}
111
+ beforeUpload={beforeUpload}
105
112
  fileList={[]}
106
113
  >
107
114
  <Button
@@ -16,41 +16,43 @@ const e = prefix('form')
16
16
  export default function renderRunScripts () {
17
17
  function renderItem (field, i, add, remove) {
18
18
  return (
19
- <Space
20
- align='center'
21
- key={field.key}
22
- >
23
- <FormItem
24
- label=''
25
- name={[field.name, 'delay']}
26
- required
27
- >
28
- <InputNumber
29
- min={1}
30
- step={1}
31
- max={65535}
32
- addonBefore={e('loginScriptDelay')}
33
- className='compact-input'
34
- />
35
- </FormItem>
36
- <FormItem
37
- label=''
38
- name={[field.name, 'script']}
39
- required
40
- className='mg2x'
19
+ <div>
20
+ <Space
21
+ align='center'
22
+ key={field.key}
41
23
  >
42
- <Input.TextArea
43
- rows={1}
44
- placeholder={e('loginScript')}
45
- className='compact-input'
24
+ <FormItem
25
+ label=''
26
+ name={[field.name, 'delay']}
27
+ required
28
+ >
29
+ <InputNumber
30
+ min={1}
31
+ step={1}
32
+ max={65535}
33
+ addonBefore={e('loginScriptDelay')}
34
+ className='compact-input'
35
+ />
36
+ </FormItem>
37
+ <FormItem
38
+ label=''
39
+ name={[field.name, 'script']}
40
+ required
41
+ className='mg2x'
42
+ >
43
+ <Input.TextArea
44
+ rows={1}
45
+ placeholder={e('loginScript')}
46
+ className='compact-input'
47
+ />
48
+ </FormItem>
49
+ <Button
50
+ icon={<MinusCircleOutlined />}
51
+ onClick={() => remove(field.name)}
52
+ className='mg24b'
46
53
  />
47
- </FormItem>
48
- <Button
49
- icon={<MinusCircleOutlined />}
50
- onClick={() => remove(field.name)}
51
- className='mg24b'
52
- />
53
- </Space>
54
+ </Space>
55
+ </div>
54
56
  )
55
57
  }
56
58
 
@@ -307,17 +307,8 @@ export default class BookmarkForm extends PureComponent {
307
307
  }
308
308
  }
309
309
 
310
- beforeUpload = async (file, form) => {
311
- const privateKey = await window.fs.readFile(file.path)
312
- form.setFieldsValue({
313
- privateKey
314
- })
315
- return false
316
- }
317
-
318
310
  getProps = () => {
319
311
  const funcs = pick(this, [
320
- 'beforeUpload',
321
312
  'handleFinish',
322
313
  'testConnection',
323
314
  'connect',
@@ -17,7 +17,7 @@ const {
17
17
  const { prefix } = window
18
18
  const f = prefix('form')
19
19
 
20
- export default class SystemMenu extends Component {
20
+ export default class FooterEntry extends Component {
21
21
  handleInfoPanel = () => {
22
22
  const { activeTerminalId } = this.props.store
23
23
  postMessage({
@@ -4,7 +4,7 @@
4
4
  background main
5
5
  height 36px
6
6
  position absolute
7
- left 43px
7
+ left 44px
8
8
  right 0
9
9
  bottom 0
10
10
  color text
@@ -167,7 +167,9 @@ export default class QuickCommandsFooterBox extends Component {
167
167
  openQuickCommandBar,
168
168
  pinnedQuickCommandBar,
169
169
  qmSortByFrequency,
170
- inActiveTerminal
170
+ inActiveTerminal,
171
+ leftSidebarWidth,
172
+ openedSideBar
171
173
  } = this.props.store
172
174
  if ((!openQuickCommandBar && !pinnedQuickCommandBar) || !inActiveTerminal) {
173
175
  return null
@@ -205,11 +207,18 @@ export default class QuickCommandsFooterBox extends Component {
205
207
  { 'fil-keyword': !!keyword }
206
208
  )
207
209
  const type = qmSortByFrequency ? 'primary' : 'default'
210
+ const w = openedSideBar ? 43 + leftSidebarWidth : 43
211
+ const qmProps = {
212
+ className: 'qm-wrap-tooltip',
213
+ style: {
214
+ left: w
215
+ },
216
+ onMouseLeave: this.handleMouseLeave,
217
+ onMouseEnter: this.handleMouseEnter
218
+ }
208
219
  return (
209
220
  <div
210
- className='qm-wrap-tooltip'
211
- onMouseLeave={this.handleMouseLeave}
212
- onMouseEnter={this.handleMouseEnter}
221
+ {...qmProps}
213
222
  >
214
223
  <div className='pd2'>
215
224
  <div className='pd2b fix'>
@@ -589,7 +589,7 @@ export default class SessionWrapper extends Component {
589
589
  }
590
590
  </div>
591
591
  {
592
- (isSsh && enableSsh) || isLocal
592
+ (isSsh && enableSsh !== false) || isLocal
593
593
  ? (
594
594
  <Tooltip title={checkTxt}>
595
595
  <span {...checkProps}>
@@ -0,0 +1,25 @@
1
+ import {
2
+ Checkbox
3
+ } from 'antd'
4
+
5
+ export default function DataSelectItem (props) {
6
+ const {
7
+ title,
8
+ checked,
9
+ value,
10
+ onChange
11
+ } = props
12
+ const boxProps = {
13
+ checked,
14
+ onChange,
15
+ 'data-key': value
16
+ }
17
+ return (
18
+ <Checkbox
19
+ key={value}
20
+ {...boxProps}
21
+ >
22
+ {title}
23
+ </Checkbox>
24
+ )
25
+ }
@@ -0,0 +1,51 @@
1
+ import {
2
+ syncDataMaps
3
+ } from '../../common/constants'
4
+ import DataSelectItem from './data-select-item'
5
+
6
+ const { prefix } = window
7
+ const e = prefix('common')
8
+ const f = prefix('config')
9
+ const t = prefix('terminalThemes')
10
+ const q = prefix('quickCommands')
11
+
12
+ const translateMap = {
13
+ settings: f,
14
+ terminalThemes: t,
15
+ quickCommands: q,
16
+ bookmarks: e,
17
+ addressBookmarks: e
18
+ }
19
+
20
+ export default function DataSelect (props) {
21
+ const {
22
+ dataSyncSelected
23
+ } = props
24
+ function onChange (e) {
25
+ const key = e.target['data-key']
26
+ window.store.toggleDataSyncSelected(key)
27
+ }
28
+ return (
29
+ <div className='pd2y pd1x'>
30
+ {
31
+ Object.keys(syncDataMaps)
32
+ .map(d => {
33
+ const checked = dataSyncSelected.includes(d)
34
+ const title = translateMap[d](d)
35
+ const boxProps = {
36
+ checked,
37
+ onChange,
38
+ title,
39
+ value: d
40
+ }
41
+ return (
42
+ <DataSelectItem
43
+ key={d}
44
+ {...boxProps}
45
+ />
46
+ )
47
+ })
48
+ }
49
+ </div>
50
+ )
51
+ }
@@ -4,8 +4,9 @@
4
4
  import { Component } from '../common/react-subx'
5
5
  import { Tabs, Spin } from 'antd'
6
6
  import SyncForm from './setting-sync-form'
7
- import { syncTypes } from '../../common/constants'
7
+ import { syncTypes, syncDataMaps } from '../../common/constants'
8
8
  import { DataTransport } from './data-import'
9
+ import DataSelect from './data-select'
9
10
  import { pick } from 'lodash-es'
10
11
 
11
12
  export default class SyncSettingEntry extends Component {
@@ -62,6 +63,15 @@ export default class SyncSettingEntry extends Component {
62
63
  children: null
63
64
  }
64
65
  })
66
+ const {
67
+ dataSyncSelected
68
+ } = store.config
69
+ const arr = dataSyncSelected && dataSyncSelected !== 'all'
70
+ ? dataSyncSelected.split(',')
71
+ : Object.keys(syncDataMaps)
72
+ const dataSelectProps = {
73
+ dataSyncSelected: arr
74
+ }
65
75
  return (
66
76
  <div className='pd2l'>
67
77
  <DataTransport store={store} />
@@ -74,6 +84,7 @@ export default class SyncSettingEntry extends Component {
74
84
  {
75
85
  this.renderForm()
76
86
  }
87
+ <DataSelect {...dataSelectProps} />
77
88
  </Spin>
78
89
  </div>
79
90
  )
@@ -967,7 +967,7 @@ export default class FileSection extends React.Component {
967
967
  if (
968
968
  isDirectory && id &&
969
969
  (
970
- (hasHost && enableSsh && isRemote) ||
970
+ (hasHost && enableSsh !== false && isRemote) ||
971
971
  (isLocal && !hasHost)
972
972
  )
973
973
  ) {
@@ -1047,7 +1047,7 @@ export default class FileSection extends React.Component {
1047
1047
  text: m('copyFilePath')
1048
1048
  })
1049
1049
  }
1050
- if (enableSsh || isLocal) {
1050
+ if (enableSsh !== false || isLocal) {
1051
1051
  res.push({
1052
1052
  func: 'newFile',
1053
1053
  icon: 'FileAddOutlined',
@@ -1,6 +1,7 @@
1
1
  import { PureComponent } from 'react'
2
2
  export default class SidePanel extends PureComponent {
3
3
  handleMousedown = (e) => {
4
+ e.stopPropagation()
4
5
  this.dragStart = true
5
6
  this.clientX = e.clientX
6
7
  window.addEventListener('mouseup', this.handleMouseup)
@@ -13,8 +14,8 @@ export default class SidePanel extends PureComponent {
13
14
  clientX
14
15
  } = e
15
16
  let nw = clientX - this.clientX + this.props.leftSidebarWidth
16
- if (nw < 343) {
17
- nw = 343
17
+ if (nw < 150) {
18
+ nw = 150
18
19
  } else if (nw > 600) {
19
20
  nw = 600
20
21
  }
@@ -9,7 +9,7 @@ export default function tabTitle (props) {
9
9
  : {}
10
10
  return (
11
11
  <span className='tab-title'>
12
- <span style={styleTag}>♦</span> {tabCount}. {title}
12
+ <span style={styleTag}>●</span> {tabCount}. {title}
13
13
  </span>
14
14
  )
15
15
  }
@@ -40,6 +40,7 @@ class Tab extends Component {
40
40
  }
41
41
 
42
42
  componentDidMount () {
43
+ console.log(this.props)
43
44
  this.dom = document.getElementById('id' + this.state.tab.id)
44
45
  window.addEventListener('message', this.onEvent)
45
46
  }
@@ -58,6 +59,31 @@ class Tab extends Component {
58
59
  clearTimeout(this.handler)
59
60
  }
60
61
 
62
+ shouldComponentUpdate (nextProps, nextState) {
63
+ return this.shouldUpdate(this.props, nextProps) || this.shouldUpdateState(this.state, nextState)
64
+ }
65
+
66
+ shouldUpdateState = (prevState, nextState) => {
67
+ return !isEqual(prevState, nextState)
68
+ }
69
+
70
+ shouldUpdate = (prevProps, nextProps) => {
71
+ // todo currentTabId still need improve
72
+ const pickKeys = [
73
+ 'currentTabId',
74
+ 'height',
75
+ 'isLast',
76
+ 'isMaximized',
77
+ 'activeTerminalId',
78
+ 'config',
79
+ 'tab',
80
+ 'width'
81
+ ]
82
+
83
+ // compare only the relevant props
84
+ return !isEqual(pick(prevProps, pickKeys), pick(nextProps, pickKeys))
85
+ }
86
+
61
87
  modifier = (...args) => {
62
88
  runIdle(() => this.setState(...args))
63
89
  }
@@ -205,3 +205,6 @@
205
205
  .system-ui
206
206
  .window-controls
207
207
  display none
208
+ .tab-title-tag
209
+ margin-right 5px
210
+ font-size 14px
@@ -1226,7 +1226,7 @@ class Term extends Component {
1226
1226
  }
1227
1227
 
1228
1228
  oncloseSocket = () => {
1229
- if (this.onClose || !this.props.tab.enableSsh) {
1229
+ if (this.onClose || this.props.tab.enableSsh === false) {
1230
1230
  return
1231
1231
  }
1232
1232
  this.setStatus(
@@ -197,10 +197,11 @@ class TermSearch extends Component {
197
197
  termSearchOpen,
198
198
  termSearch
199
199
  } = store
200
- if (!termSearchOpen) {
201
- return null
202
- }
203
- if (currentTab.pane === paneMap.fileManager) {
200
+ if (
201
+ !termSearchOpen ||
202
+ !currentTab ||
203
+ currentTab.pane === paneMap.fileManager
204
+ ) {
204
205
  return null
205
206
  }
206
207
  const props = {
@@ -2,9 +2,6 @@ import { copy } from '../../common/clipboard'
2
2
  import filesizeParser from 'filesize-parser'
3
3
  import { formatBytes } from '../../common/byte-format'
4
4
 
5
- const { prefix } = window
6
- const m = prefix('menu')
7
-
8
5
  const valueParserMaps = {
9
6
  size: v => v,
10
7
  used: filesizeParser,
@@ -19,19 +16,24 @@ function valueParse (obj, k) {
19
16
  return obj[k]
20
17
  }
21
18
 
19
+ function copyValue (event) {
20
+ copy(event.target.getAttribute('data-content'))
21
+ }
22
+
22
23
  export default (data) => {
23
24
  return Object.keys(data).map(k => {
24
25
  const rd = (txt) => {
25
26
  const r = k === 'mem' ? formatBytes(parseInt(txt, 10)) : txt
27
+ const itemProps = {
28
+ className: 'activity-item pointer',
29
+ 'data-content': r,
30
+ onClick: copyValue
31
+ }
26
32
  return (
27
- <div className='activity-item'>
28
- <span>{r}</span>
29
- <span
30
- className='pointer activity-item-copy mg1l bold color-blue'
31
- onClick={() => copy(txt)}
32
- >
33
- {m('copy')}
34
- </span>
33
+ <div
34
+ {...itemProps}
35
+ >
36
+ {r}
35
37
  </div>
36
38
  )
37
39
  }
@@ -29,10 +29,10 @@
29
29
  max-height 260px
30
30
  overflow-y scroll
31
31
  .activity-item
32
- .activity-item-copy
33
- display none
34
- &:hover .activity-item-copy
35
- display inline
32
+ max-height 1.6em
33
+ line-height 1.6
34
+ &:hover
35
+ max-height none
36
36
  .info-panel-wrap-pin
37
37
  .toggle-info-panel-wrap
38
38
  color success
@@ -997,7 +997,8 @@ export default class ItemListTree extends Component {
997
997
  bookmarkGroupIds = [],
998
998
  id
999
999
  } = group
1000
- if (!this.state.expandedKeys.includes(id)) {
1000
+ const shouldRender = this.state.keyword || this.state.expandedKeys.includes(id)
1001
+ if (!shouldRender) {
1001
1002
  return null
1002
1003
  }
1003
1004
  return [
@@ -3,10 +3,11 @@
3
3
  display none
4
4
  margin-left 3px
5
5
  width 16px
6
- line-height 26px
7
- height 20px
6
+ line-height 30px
7
+ height 26px
8
8
  .tree-item
9
9
  display flex
10
+ position relative
10
11
  line-height 26px
11
12
  padding-left 5px
12
13
  border-radius 3px
@@ -2,10 +2,10 @@
2
2
  * sync data to github gist related
3
3
  */
4
4
 
5
- import { without, get, pick, debounce, findIndex } from 'lodash-es'
5
+ import { get, pick, debounce, findIndex } from 'lodash-es'
6
6
  import copy from 'json-deep-copy'
7
7
  import {
8
- settingMap, packInfo, syncTypes
8
+ settingMap, packInfo, syncTypes, syncDataMaps
9
9
  } from '../common/constants'
10
10
  import { remove, dbNames, insert, update, getData } from '../common/db'
11
11
  import fetch from '../common/fetch-from-server'
@@ -14,7 +14,6 @@ import { fixBookmarks } from '../common/db-fix'
14
14
  import dayjs from 'dayjs'
15
15
  import parseJsonSafe from '../common/parse-json-safe'
16
16
 
17
- const names = without(dbNames, settingMap.history)
18
17
  const {
19
18
  version: packVer
20
19
  } = packInfo
@@ -162,6 +161,7 @@ export default (Store) => {
162
161
  }
163
162
  const pass = store.getSyncPassword(type)
164
163
  const objs = {}
164
+ const { names, syncConfig } = store.getDataSyncNames()
165
165
  for (const n of names) {
166
166
  let str = store.getItems(n)
167
167
  const order = await getData(`${n}:order`)
@@ -182,14 +182,18 @@ export default (Store) => {
182
182
  objs[`${n}.order.json`] = {
183
183
  content: 'empty'
184
184
  }
185
+ if (syncConfig) {
186
+ objs['userConfig.json'] = {
187
+ content: JSON.stringify(
188
+ store.getSyncConfig()
189
+ )
190
+ }
191
+ }
185
192
  }
186
193
  const res = await fetchData(type, 'update', [gistId, {
187
194
  description: 'sync electerm data',
188
195
  files: {
189
196
  ...objs,
190
- 'userConfig.json': {
191
- content: JSON.stringify(pick(store.config, ['theme']))
192
- },
193
197
  'electerm-status.json': {
194
198
  content: JSON.stringify({
195
199
  lastSyncTime: Date.now(),
@@ -230,6 +234,7 @@ export default (Store) => {
230
234
  store.getProxySetting()
231
235
  )
232
236
  const toInsert = []
237
+ const { names, syncConfig } = store.getDataSyncNames()
233
238
  for (const n of names) {
234
239
  let str = get(gist, `files["${n}.json"].content`)
235
240
  if (!str) {
@@ -267,12 +272,18 @@ export default (Store) => {
267
272
  })
268
273
  store.setItems(n, arr)
269
274
  }
270
- const userConfig = parseJsonSafe(
271
- get(gist, 'files["userConfig.json"].content')
272
- )
273
- if (userConfig && userConfig.theme) {
274
- store.setTheme(userConfig.theme)
275
+ if (syncConfig) {
276
+ const userConfig = parseJsonSafe(
277
+ get(gist, 'files["userConfig.json"].content')
278
+ )
279
+ if (userConfig) {
280
+ store.setConfig(userConfig)
281
+ }
282
+ if (userConfig && userConfig.theme) {
283
+ store.setTheme(userConfig.theme)
284
+ }
275
285
  }
286
+
276
287
  const up = {
277
288
  [type + 'LastSyncTime']: Date.now()
278
289
  }
@@ -331,6 +342,7 @@ export default (Store) => {
331
342
  Store.prototype.handleExportAllData = async function () {
332
343
  const { store } = window
333
344
  const objs = {}
345
+ const names = store.getDataSyncNames(true)
334
346
  for (const n of names) {
335
347
  objs[n] = store.getItems(n)
336
348
  const order = await getData(`${n}:order`)
@@ -342,49 +354,7 @@ export default (Store) => {
342
354
  })
343
355
  }
344
356
  }
345
- objs.config = pick(store.config, [
346
- 'theme',
347
- 'useSystemTitleBar',
348
- 'defaultEditor',
349
- 'checkUpdateOnStart',
350
- 'confirmBeforeExit',
351
- 'ctrlOrMetaOpenTerminalLink',
352
- 'cursorStyle',
353
- 'defaultEditor',
354
- 'disableSshHistory',
355
- 'disableTransferHistory',
356
- 'enableGlobalProxy',
357
- 'execLinux',
358
- 'execLinuxArgs',
359
- 'execMac',
360
- 'execMacArgs',
361
- 'execWindows',
362
- 'execWindowsArgs',
363
- 'fontFamily',
364
- 'fontSize',
365
- 'hotkey',
366
- 'keepaliveCountMax',
367
- 'keepaliveInterval',
368
- 'language',
369
- 'opacity',
370
- 'pasteWhenContextMenu',
371
- 'proxyIp',
372
- 'proxyPassword',
373
- 'proxyPort',
374
- 'proxyType',
375
- 'proxyUsername',
376
- 'rendererType',
377
- 'rightClickSelectsWord',
378
- 'saveTerminalLogToFile',
379
- 'scrollback',
380
- 'sshReadyTimeout',
381
- 'syncSetting',
382
- 'terminalTimeout',
383
- 'terminalType',
384
- 'theme',
385
- 'useSystemTitleBar',
386
- 'zoom'
387
- ])
357
+ objs.config = store.config
388
358
  const text = JSON.stringify(objs)
389
359
  const name = dayjs().format('YYYY-MM-DD-HH-mm-ss') + '-electerm-all-data.json'
390
360
  download(name, text)
@@ -396,6 +366,7 @@ export default (Store) => {
396
366
  const { store } = window
397
367
  const objs = JSON.parse(txt)
398
368
  const toInsert = []
369
+ const { names } = store.getDataSyncNames(true)
399
370
  for (const n of names) {
400
371
  let arr = objs[n]
401
372
  if (n === settingMap.terminalThemes) {
@@ -423,4 +394,83 @@ export default (Store) => {
423
394
  autoSync: v
424
395
  })
425
396
  }
397
+
398
+ Store.prototype.toggleDataSyncSelected = function (key) {
399
+ const { store } = window
400
+ const {
401
+ dataSyncSelected
402
+ } = store.config
403
+ let arr = dataSyncSelected && dataSyncSelected !== 'all'
404
+ ? dataSyncSelected.split(',')
405
+ : Object.keys(syncDataMaps)
406
+ if (arr.includes(key)) {
407
+ arr = arr.filter(d => d !== key)
408
+ } else {
409
+ arr.push(key)
410
+ }
411
+ store.setConfig({
412
+ dataSyncSelected: arr.join(',')
413
+ })
414
+ }
415
+ Store.prototype.getDataSyncNames = function (all) {
416
+ const { store } = window
417
+ const {
418
+ dataSyncSelected
419
+ } = store.config
420
+ const syncAll = all || dataSyncSelected === 'all'
421
+ const keys = syncAll
422
+ ? Object.keys(syncDataMaps)
423
+ : dataSyncSelected.split(',')
424
+ const names = keys
425
+ .filter(d => d !== 'settings')
426
+ .map(d => syncDataMaps[d]).flat()
427
+ const syncConfig = keys.includes('settings')
428
+ return {
429
+ names,
430
+ syncConfig
431
+ }
432
+ }
433
+ Store.prototype.getSyncConfig = function () {
434
+ const { store } = window
435
+ const configSyncKeys = [
436
+ 'keepaliveInterval',
437
+ 'rightClickSelectsWord',
438
+ 'pasteWhenContextMenu',
439
+ 'ctrlOrMetaOpenTerminalLink',
440
+ 'hotkey',
441
+ 'sshReadyTimeout',
442
+ 'scrollback',
443
+ 'fontSize',
444
+ 'execWindows',
445
+ 'execMac',
446
+ 'execLinux',
447
+ 'execWindowsArgs',
448
+ 'execMacArgs',
449
+ 'execLinuxArgs',
450
+ 'disableSshHistory',
451
+ 'disableTransferHistory',
452
+ 'terminalType',
453
+ 'keepaliveCountMax',
454
+ 'saveTerminalLogToFile',
455
+ 'checkUpdateOnStart',
456
+ 'cursorBlink',
457
+ 'cursorStyle',
458
+ 'terminalWordSeparator',
459
+ 'confirmBeforeExit',
460
+ 'autoRefreshWhenSwitchToSftp',
461
+ 'addTimeStampToTermLog',
462
+ 'showHiddenFilesOnSftpStart',
463
+ 'terminalInfos',
464
+ 'filePropsEnabled',
465
+ 'hideIP',
466
+ 'terminalTimeout',
467
+ 'theme',
468
+ 'terminalTypes',
469
+ 'language',
470
+ 'copyWhenSelect',
471
+ 'customCss',
472
+ 'dataSyncSelected'
473
+ ]
474
+ return pick(store.config, configSyncKeys)
475
+ }
426
476
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.39.68",
3
+ "version": "1.39.88",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",