@electerm/electerm-react 1.100.20 → 1.100.46
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.
- package/client/common/constants.js +2 -1
- package/client/common/default-setting.js +6 -1
- package/client/common/get-category-color.js +19 -0
- package/client/components/ai/ai-chat-history.jsx +1 -1
- package/client/components/ai/ai-chat.jsx +108 -22
- package/client/components/ai/ai-output.jsx +8 -8
- package/client/components/ai/ai.styl +6 -6
- package/client/components/bg/css-overwrite.jsx +52 -4
- package/client/components/bookmark-form/bookmark-category-select.jsx +80 -0
- package/client/components/bookmark-form/form-ssh-common.jsx +6 -14
- package/client/components/bookmark-form/ftp-form-ui.jsx +7 -16
- package/client/components/bookmark-form/local-form-ui.jsx +7 -16
- package/client/components/bookmark-form/rdp-form-ui.jsx +7 -16
- package/client/components/bookmark-form/serial-form-ui.jsx +9 -17
- package/client/components/bookmark-form/ssh-form-ui.jsx +7 -3
- package/client/components/bookmark-form/telnet-form-ui.jsx +2 -2
- package/client/components/bookmark-form/vnc-form-ui.jsx +7 -16
- package/client/components/bookmark-form/web-form-ui.jsx +7 -16
- package/client/components/main/main.jsx +4 -2
- package/client/components/main/term-fullscreen.styl +18 -7
- package/client/components/session/session.jsx +3 -1
- package/client/components/setting-panel/setting-common.jsx +1 -0
- package/client/components/setting-panel/terminal-bg-config.jsx +82 -5
- package/client/components/setting-panel/text-bg-modal.jsx +131 -0
- package/client/components/sftp/sftp-entry.jsx +8 -3
- package/client/components/terminal/terminal.jsx +4 -4
- package/client/components/tree-list/category-color-picker.jsx +11 -0
- package/client/components/tree-list/tree-list-item.jsx +11 -1
- package/client/components/tree-list/tree-list.jsx +54 -7
- package/client/components/tree-list/tree-list.styl +10 -1
- package/client/store/init-state.js +3 -1
- package/client/store/sync.js +6 -1
- package/package.json +1 -1
|
@@ -195,6 +195,16 @@ export default function TreeListItem (props) {
|
|
|
195
195
|
}
|
|
196
196
|
)
|
|
197
197
|
const tag = isGroup ? '' : createTitleTag(item)
|
|
198
|
+
const colorTag = isGroup && item.color
|
|
199
|
+
? (
|
|
200
|
+
<span
|
|
201
|
+
className='category-color-tag'
|
|
202
|
+
style={{
|
|
203
|
+
backgroundColor: item.color
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
)
|
|
207
|
+
: null
|
|
198
208
|
const title = isGroup
|
|
199
209
|
? item.title
|
|
200
210
|
: createName(item)
|
|
@@ -236,7 +246,7 @@ export default function TreeListItem (props) {
|
|
|
236
246
|
<div
|
|
237
247
|
{...titleProps}
|
|
238
248
|
>
|
|
239
|
-
{tag}{titleHighlight}
|
|
249
|
+
{colorTag}{tag}{titleHighlight}
|
|
240
250
|
</div>
|
|
241
251
|
{
|
|
242
252
|
isGroup
|
|
@@ -28,6 +28,8 @@ import TreeExpander from './tree-expander'
|
|
|
28
28
|
import TreeListItem from './tree-list-item'
|
|
29
29
|
import TreeSearch from './tree-search'
|
|
30
30
|
import MoveItemModal from './move-item-modal'
|
|
31
|
+
import { CategoryColorPicker } from './category-color-picker.jsx'
|
|
32
|
+
import { getRandomDefaultColor } from '../../common/rand-hex-color.js'
|
|
31
33
|
|
|
32
34
|
export default class ItemListTree extends Component {
|
|
33
35
|
constructor (props) {
|
|
@@ -41,7 +43,9 @@ export default class ItemListTree extends Component {
|
|
|
41
43
|
moveItem: null,
|
|
42
44
|
moveItemIsGroup: false,
|
|
43
45
|
bookmarkGroupTitle: '',
|
|
46
|
+
bookmarkGroupColor: '',
|
|
44
47
|
categoryTitle: '',
|
|
48
|
+
categoryColor: '',
|
|
45
49
|
categoryId: ''
|
|
46
50
|
}
|
|
47
51
|
}
|
|
@@ -110,7 +114,8 @@ export default class ItemListTree extends Component {
|
|
|
110
114
|
handleCancelNew = () => {
|
|
111
115
|
this.setState({
|
|
112
116
|
showNewBookmarkGroupForm: false,
|
|
113
|
-
bookmarkGroupTitle: ''
|
|
117
|
+
bookmarkGroupTitle: '',
|
|
118
|
+
bookmarkGroupColor: ''
|
|
114
119
|
})
|
|
115
120
|
}
|
|
116
121
|
|
|
@@ -123,7 +128,8 @@ export default class ItemListTree extends Component {
|
|
|
123
128
|
handleCancelEdit = () => {
|
|
124
129
|
this.setState({
|
|
125
130
|
categoryId: '',
|
|
126
|
-
categoryTitle: ''
|
|
131
|
+
categoryTitle: '',
|
|
132
|
+
categoryColor: ''
|
|
127
133
|
})
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -140,6 +146,7 @@ export default class ItemListTree extends Component {
|
|
|
140
146
|
handleSubmitEdit = () => {
|
|
141
147
|
const {
|
|
142
148
|
categoryTitle,
|
|
149
|
+
categoryColor,
|
|
143
150
|
categoryId
|
|
144
151
|
} = this.state
|
|
145
152
|
if (!categoryTitle) {
|
|
@@ -153,6 +160,9 @@ export default class ItemListTree extends Component {
|
|
|
153
160
|
return this.handleCancelEdit()
|
|
154
161
|
}
|
|
155
162
|
obj.title = categoryTitle
|
|
163
|
+
if (categoryColor) {
|
|
164
|
+
obj.color = categoryColor
|
|
165
|
+
}
|
|
156
166
|
this.setState({
|
|
157
167
|
categoryId: ''
|
|
158
168
|
})
|
|
@@ -181,6 +191,18 @@ export default class ItemListTree extends Component {
|
|
|
181
191
|
})
|
|
182
192
|
}
|
|
183
193
|
|
|
194
|
+
handleChangeBookmarkGroupColor = color => {
|
|
195
|
+
this.setState({
|
|
196
|
+
bookmarkGroupColor: color
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
handleChangeCategoryColor = color => {
|
|
201
|
+
this.setState({
|
|
202
|
+
categoryColor: color
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
|
|
184
206
|
handleNewBookmark = () => {
|
|
185
207
|
this.props.onClickItem(getInitItem([], settingMap.bookmarks))
|
|
186
208
|
}
|
|
@@ -197,11 +219,15 @@ export default class ItemListTree extends Component {
|
|
|
197
219
|
showNewBookmarkGroupForm: false
|
|
198
220
|
}, () => {
|
|
199
221
|
this.onSubmit = false
|
|
200
|
-
|
|
222
|
+
const newGroup = {
|
|
201
223
|
id: uid(),
|
|
202
224
|
title: this.state.bookmarkGroupTitle,
|
|
203
225
|
bookmarkIds: []
|
|
204
|
-
}
|
|
226
|
+
}
|
|
227
|
+
if (this.state.bookmarkGroupColor) {
|
|
228
|
+
newGroup.color = this.state.bookmarkGroupColor
|
|
229
|
+
}
|
|
230
|
+
window.store.addBookmarkGroup(newGroup)
|
|
205
231
|
})
|
|
206
232
|
}
|
|
207
233
|
|
|
@@ -227,6 +253,9 @@ export default class ItemListTree extends Component {
|
|
|
227
253
|
level: 2,
|
|
228
254
|
bookmarkIds: []
|
|
229
255
|
}
|
|
256
|
+
if (this.state.bookmarkGroupColor) {
|
|
257
|
+
newCat.color = this.state.bookmarkGroupColor
|
|
258
|
+
}
|
|
230
259
|
bookmarkGroups.unshift(newCat)
|
|
231
260
|
const cat = bookmarkGroups.find(
|
|
232
261
|
d => d.id === id
|
|
@@ -244,6 +273,7 @@ export default class ItemListTree extends Component {
|
|
|
244
273
|
this.setState({
|
|
245
274
|
showNewBookmarkGroupForm: true,
|
|
246
275
|
bookmarkGroupTitle: '',
|
|
276
|
+
bookmarkGroupColor: getRandomDefaultColor(),
|
|
247
277
|
parentId: ''
|
|
248
278
|
})
|
|
249
279
|
}
|
|
@@ -309,6 +339,7 @@ export default class ItemListTree extends Component {
|
|
|
309
339
|
if (isGroup) {
|
|
310
340
|
this.setState({
|
|
311
341
|
categoryTitle: '' + item.title,
|
|
342
|
+
categoryColor: item.color || '',
|
|
312
343
|
categoryId: item.id,
|
|
313
344
|
bookmarkGroupSubParentId: ''
|
|
314
345
|
})
|
|
@@ -322,7 +353,8 @@ export default class ItemListTree extends Component {
|
|
|
322
353
|
return {
|
|
323
354
|
showNewBookmarkGroupForm: true,
|
|
324
355
|
parentId: item.id,
|
|
325
|
-
bookmarkGroupTitle: ''
|
|
356
|
+
bookmarkGroupTitle: '',
|
|
357
|
+
bookmarkGroupColor: getRandomDefaultColor()
|
|
326
358
|
}
|
|
327
359
|
})
|
|
328
360
|
window.store.expandedKeys.push(item.id)
|
|
@@ -385,7 +417,6 @@ export default class ItemListTree extends Component {
|
|
|
385
417
|
if (tar) {
|
|
386
418
|
target = tar
|
|
387
419
|
}
|
|
388
|
-
console.log('tar', target, tar)
|
|
389
420
|
const dataDragged = e.dataTransfer.getData('idDragged')
|
|
390
421
|
const [idDragged, pidDrags, isGroupDragged] = dataDragged.split('@')
|
|
391
422
|
const isGroupDrag = isGroupDragged === 'true'
|
|
@@ -519,7 +550,8 @@ export default class ItemListTree extends Component {
|
|
|
519
550
|
|
|
520
551
|
editCategory = () => {
|
|
521
552
|
const {
|
|
522
|
-
categoryTitle
|
|
553
|
+
categoryTitle,
|
|
554
|
+
categoryColor
|
|
523
555
|
} = this.state
|
|
524
556
|
const confirm = (
|
|
525
557
|
<span>
|
|
@@ -527,11 +559,18 @@ export default class ItemListTree extends Component {
|
|
|
527
559
|
<CloseOutlined className='mg1l pointer' onClick={this.handleCancelEdit} />
|
|
528
560
|
</span>
|
|
529
561
|
)
|
|
562
|
+
const colorPicker = (
|
|
563
|
+
<CategoryColorPicker
|
|
564
|
+
value={categoryColor || getRandomDefaultColor()}
|
|
565
|
+
onChange={this.handleChangeCategoryColor}
|
|
566
|
+
/>
|
|
567
|
+
)
|
|
530
568
|
return (
|
|
531
569
|
<InputAutoFocus
|
|
532
570
|
value={categoryTitle}
|
|
533
571
|
onChange={this.handleChangeEdit}
|
|
534
572
|
onPressEnter={this.handleSubmitEdit}
|
|
573
|
+
addonBefore={colorPicker}
|
|
535
574
|
addonAfter={confirm}
|
|
536
575
|
/>
|
|
537
576
|
)
|
|
@@ -693,6 +732,7 @@ export default class ItemListTree extends Component {
|
|
|
693
732
|
renderNewCat = (group) => {
|
|
694
733
|
const {
|
|
695
734
|
bookmarkGroupTitle,
|
|
735
|
+
bookmarkGroupColor,
|
|
696
736
|
parentId,
|
|
697
737
|
showNewBookmarkGroupForm
|
|
698
738
|
} = this.state
|
|
@@ -705,12 +745,19 @@ export default class ItemListTree extends Component {
|
|
|
705
745
|
<CloseOutlined className='mg1l pointer' onClick={this.handleCancelNew} />
|
|
706
746
|
</span>
|
|
707
747
|
)
|
|
748
|
+
const colorPicker = (
|
|
749
|
+
<CategoryColorPicker
|
|
750
|
+
value={bookmarkGroupColor || getRandomDefaultColor()}
|
|
751
|
+
onChange={this.handleChangeBookmarkGroupColor}
|
|
752
|
+
/>
|
|
753
|
+
)
|
|
708
754
|
return (
|
|
709
755
|
<div className='pd1y'>
|
|
710
756
|
<InputAutoFocus
|
|
711
757
|
value={bookmarkGroupTitle}
|
|
712
758
|
onPressEnter={this.handleSubmit}
|
|
713
759
|
onChange={this.handleChangeBookmarkGroupTitle}
|
|
760
|
+
addonBefore={colorPicker}
|
|
714
761
|
addonAfter={confirm}
|
|
715
762
|
onBlur={this.handleBlurBookmarkGroupTitle}
|
|
716
763
|
/>
|
|
@@ -67,4 +67,13 @@
|
|
|
67
67
|
top 0
|
|
68
68
|
width 12px
|
|
69
69
|
font-size 11px
|
|
70
|
-
line-height 30px
|
|
70
|
+
line-height 30px
|
|
71
|
+
|
|
72
|
+
.category-color-tag
|
|
73
|
+
display inline-block
|
|
74
|
+
width 12px
|
|
75
|
+
height 12px
|
|
76
|
+
margin-right 6px
|
|
77
|
+
border-radius 2px
|
|
78
|
+
border 1px solid rgba(0,0,0,0.1)
|
|
79
|
+
vertical-align middle
|
|
@@ -28,6 +28,7 @@ import { buildDefaultThemes } from '../common/terminal-theme'
|
|
|
28
28
|
import * as ls from '../common/safe-local-storage'
|
|
29
29
|
import { exclude } from 'manate'
|
|
30
30
|
import initSettingItem from '../common/init-setting-item'
|
|
31
|
+
import { getRandomDefaultColor } from '../common/rand-hex-color'
|
|
31
32
|
|
|
32
33
|
const e = window.translate
|
|
33
34
|
|
|
@@ -36,7 +37,8 @@ function getDefaultBookmarkGroups (bookmarks) {
|
|
|
36
37
|
JSON.stringify({
|
|
37
38
|
title: e(defaultBookmarkGroupId),
|
|
38
39
|
id: defaultBookmarkGroupId,
|
|
39
|
-
bookmarkIds: bookmarks.map(d => d.id)
|
|
40
|
+
bookmarkIds: bookmarks.map(d => d.id),
|
|
41
|
+
color: getRandomDefaultColor()
|
|
40
42
|
})
|
|
41
43
|
]
|
|
42
44
|
}
|
package/client/store/sync.js
CHANGED
|
@@ -514,7 +514,12 @@ export default (Store) => {
|
|
|
514
514
|
'modelAI',
|
|
515
515
|
'roleAI',
|
|
516
516
|
'languageAI',
|
|
517
|
-
'proxyAI'
|
|
517
|
+
'proxyAI',
|
|
518
|
+
'disableDeveloperTool',
|
|
519
|
+
'terminalBackgroundText',
|
|
520
|
+
'terminalBackgroundTextSize',
|
|
521
|
+
'terminalBackgroundTextColor',
|
|
522
|
+
'terminalBackgroundTextFontFamily'
|
|
518
523
|
]
|
|
519
524
|
return pick(store.config, configSyncKeys)
|
|
520
525
|
}
|