@electerm/electerm-react 1.35.6 → 1.36.2

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,8 @@ import {
35
35
  sidebarPanelWidth,
36
36
  paneMap,
37
37
  settingSyncId,
38
- settingShortcutsId
38
+ settingShortcutsId,
39
+ settingTerminalId
39
40
  } from '../common/constants'
40
41
  import getInitItem from '../common/init-setting-item'
41
42
  import {
@@ -45,6 +46,7 @@ import {
45
46
  const { prefix } = window
46
47
  const ss = prefix('settingSync')
47
48
  const s = prefix('setting')
49
+ const sss = prefix('ssh')
48
50
 
49
51
  function getReverseColor (hex) {
50
52
  // Check if the input is a valid hex color code
@@ -86,7 +88,7 @@ class Store {
86
88
  constructor () {
87
89
  Object.assign(
88
90
  this,
89
- initState
91
+ initState()
90
92
  )
91
93
  }
92
94
 
@@ -248,12 +250,16 @@ class Store {
248
250
  get setting () {
249
251
  return [
250
252
  {
251
- id: settingSyncId,
252
- title: ss('settingSync')
253
+ id: settingTerminalId,
254
+ title: sss('terminal')
253
255
  },
254
256
  {
255
257
  id: settingShortcutsId,
256
258
  title: s('settingShortcuts')
259
+ },
260
+ {
261
+ id: settingSyncId,
262
+ title: ss('settingSync')
257
263
  }
258
264
  ]
259
265
  }
@@ -344,7 +350,7 @@ batchInputHistory(Store)
344
350
  transferExtend(Store)
345
351
  addressBookmarkExtend(Store)
346
352
 
353
+ export const StateStore = Store
347
354
  const store = manage(new Store())
348
355
 
349
- window.store = store
350
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
  }
@@ -11,6 +11,7 @@ import copy from 'json-deep-copy'
11
11
  import {
12
12
  settingMap,
13
13
  settingCommonId,
14
+ settingSyncId,
14
15
  modals
15
16
  } from '../common/constants'
16
17
  import { buildNewTheme } from '../common/terminal-theme'
@@ -150,7 +151,7 @@ export default Store => {
150
151
  store.storeAssign({
151
152
  settingTab: settingMap.setting
152
153
  })
153
- store.setSettingItem(copy(store.setting[0]))
154
+ store.setSettingItem(copy(store.setting.find(d => d.id === settingSyncId)))
154
155
  store.openSettingModal()
155
156
  }
156
157
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.35.6",
3
+ "version": "1.36.2",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",