@electerm/electerm-react 1.60.18 → 1.60.32
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/clipboard.js +1 -14
- package/client/common/constants.js +0 -43
- package/client/common/data-compare.js +55 -0
- package/client/common/default-setting.js +2 -10
- package/client/common/resolve.js +18 -22
- package/client/common/sftp.js +0 -3
- package/client/components/ai/ai-chat.jsx +30 -6
- package/client/components/ai/ai-config.jsx +17 -6
- package/client/components/batch-op/batch-op.jsx +3 -24
- package/client/components/bookmark-form/bookmark-group-tree-format.js +7 -9
- package/client/components/bookmark-form/form-ssh-common.jsx +0 -2
- package/client/components/bookmark-form/ssh-form.jsx +8 -41
- package/client/components/bookmark-form/tree-delete.jsx +1 -13
- package/client/components/common/animate-text.jsx +3 -4
- package/client/components/common/drag-handle.jsx +59 -45
- package/client/components/common/drag-handle.styl +2 -1
- package/client/components/common/input-auto-focus.jsx +29 -63
- package/client/components/common/ref.js +24 -0
- package/client/components/footer/batch-input.jsx +1 -6
- package/client/components/footer/footer-entry.jsx +13 -16
- package/client/components/footer/footer.styl +0 -5
- package/client/components/icons/ai-icon.jsx +17 -0
- package/client/components/icons/ai-icon.styl +3 -0
- package/client/components/layout/layout-item.jsx +14 -0
- package/client/components/main/main.jsx +8 -19
- package/client/components/main/upgrade.jsx +13 -25
- package/client/components/profile/profile-form-elem.jsx +1 -2
- package/client/components/quick-commands/on-drop.js +1 -12
- package/client/components/quick-commands/quick-command-transport-mod.jsx +3 -13
- package/client/components/quick-commands/quick-commands-form-elem.jsx +1 -2
- package/client/components/rdp/rdp-session.jsx +4 -4
- package/client/components/session/session.jsx +9 -11
- package/client/components/setting-panel/on-tree-drop.js +4 -35
- package/client/components/setting-panel/setting-common.jsx +4 -1
- package/client/components/setting-panel/setting-modal.jsx +7 -5
- package/client/components/setting-panel/tab-settings.jsx +0 -1
- package/client/components/setting-sync/setting-sync.jsx +0 -1
- package/client/components/sftp/address-bookmark-item.jsx +1 -15
- package/client/components/sftp/confirm-modal-store.jsx +2 -2
- package/client/components/sftp/{file-mode-modal.jsx → file-info-modal.jsx} +137 -37
- package/client/components/sftp/file-item.jsx +156 -192
- package/client/components/sftp/file-table-header.jsx +98 -0
- package/client/components/sftp/list-table-ui.jsx +125 -416
- package/client/components/sftp/sftp-entry.jsx +102 -128
- package/client/components/sftp/sftp.styl +6 -22
- package/client/components/sftp/transfer-conflict-store.jsx +8 -12
- package/client/components/sftp/transport-action-store.jsx +7 -15
- package/client/components/shortcuts/shortcut-control.jsx +72 -3
- package/client/components/shortcuts/shortcut-handler.js +0 -1
- package/client/components/side-panel-r/side-panel-r.jsx +7 -4
- package/client/components/sidebar/bookmark-select.jsx +5 -3
- package/client/components/sidebar/history.jsx +3 -0
- package/client/components/sidebar/index.jsx +1 -1
- package/client/components/sidebar/info-modal.jsx +3 -0
- package/client/components/sidebar/side-panel.jsx +7 -4
- package/client/components/sidebar/sidebar-panel.jsx +1 -1
- package/client/components/sidebar/sidebar.styl +3 -3
- package/client/components/sys-menu/icons-map.jsx +52 -0
- package/client/components/{context-menu → sys-menu}/menu-btn.jsx +33 -45
- package/client/components/sys-menu/sys-menu.jsx +163 -0
- package/client/components/{context-menu/context-menu.styl → sys-menu/sys-menu.styl} +2 -11
- package/client/components/tabs/index.jsx +5 -97
- package/client/components/tabs/tab.jsx +121 -73
- package/client/components/tabs/tabs.styl +4 -1
- package/client/components/terminal/term-search.jsx +16 -28
- package/client/components/terminal/terminal-interactive.jsx +0 -2
- package/client/components/terminal/{index.jsx → terminal.jsx} +110 -240
- package/client/components/terminal-info/base.jsx +21 -46
- package/client/components/terminal-info/terminal-info.jsx +3 -0
- package/client/components/text-editor/text-editor.jsx +38 -53
- package/client/components/theme/theme-form.jsx +0 -2
- package/client/components/tree-list/bookmark-toolbar.jsx +23 -47
- package/client/components/tree-list/bookmark-transport.jsx +2 -90
- package/client/components/tree-list/move-item-modal.jsx +101 -0
- package/client/components/tree-list/tree-expander.jsx +2 -3
- package/client/components/tree-list/tree-list-item.jsx +8 -11
- package/client/components/tree-list/tree-list.jsx +75 -296
- package/client/components/vnc/vnc-session.jsx +5 -3
- package/client/store/app-upgrade.js +2 -5
- package/client/store/bookmark-group.js +116 -51
- package/client/store/common.js +36 -54
- package/client/store/event.js +4 -37
- package/client/store/init-state.js +9 -12
- package/client/store/item.js +34 -39
- package/client/store/load-data.js +5 -1
- package/client/store/quick-command.js +2 -12
- package/client/store/session.js +6 -7
- package/client/store/setting.js +3 -7
- package/client/store/sidebar.js +2 -8
- package/client/store/store.js +0 -20
- package/client/store/system-menu.js +1 -2
- package/client/store/tab.js +29 -1
- package/client/store/terminal-theme.js +0 -4
- package/client/store/watch.js +26 -4
- package/package.json +1 -1
- package/client/common/post-msg.js +0 -3
- package/client/components/common/native-input.jsx +0 -30
- package/client/components/context-menu/context-menu.jsx +0 -339
- package/client/components/sftp/file-props-modal.jsx +0 -210
- package/client/store/context-menu.js +0 -23
- /package/client/components/{context-menu → sys-menu}/boomarks.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/history.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/icon-holder.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/sub-tab-menu.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/tabs.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/zoom.jsx +0 -0
|
@@ -8,21 +8,13 @@ import {
|
|
|
8
8
|
CloseOutlined,
|
|
9
9
|
LoadingOutlined
|
|
10
10
|
} from '@ant-design/icons'
|
|
11
|
-
import {
|
|
12
|
-
readClipboard,
|
|
13
|
-
cut,
|
|
14
|
-
hasBookmarkOrGroupInClipboardText
|
|
15
|
-
} from '../../common/clipboard'
|
|
16
11
|
import createName from '../../common/create-title'
|
|
17
12
|
import InputAutoFocus from '../common/input-auto-focus'
|
|
18
|
-
import { find, uniq,
|
|
13
|
+
import { find, uniq, filter, pick } from 'lodash-es'
|
|
19
14
|
import {
|
|
20
15
|
maxBookmarkGroupTitleLength,
|
|
21
16
|
defaultBookmarkGroupId,
|
|
22
|
-
settingMap
|
|
23
|
-
commonActions,
|
|
24
|
-
copyBookmarkItemPrefix,
|
|
25
|
-
copyBookmarkGroupItemPrefix
|
|
17
|
+
settingMap
|
|
26
18
|
} from '../../common/constants'
|
|
27
19
|
import findParentBySel from '../../common/find-parent'
|
|
28
20
|
import copy, { deepCopy } from 'json-deep-copy'
|
|
@@ -30,13 +22,13 @@ import NewButtonsGroup from './bookmark-toolbar'
|
|
|
30
22
|
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
31
23
|
import getInitItem from '../../common/init-setting-item'
|
|
32
24
|
import uid from '../../common/uid'
|
|
25
|
+
import { action } from 'manate'
|
|
33
26
|
import deepEqual from 'fast-deep-equal'
|
|
34
27
|
import './tree-list.styl'
|
|
35
28
|
import TreeExpander from './tree-expander'
|
|
36
29
|
import TreeListItem from './tree-list-item'
|
|
37
30
|
import TreeSearch from './tree-search'
|
|
38
|
-
|
|
39
|
-
const e = window.translate
|
|
31
|
+
import MoveItemModal from './move-item-modal'
|
|
40
32
|
|
|
41
33
|
export default class ItemListTree extends Component {
|
|
42
34
|
constructor (props) {
|
|
@@ -46,6 +38,9 @@ export default class ItemListTree extends Component {
|
|
|
46
38
|
keyword: '',
|
|
47
39
|
parentId: '',
|
|
48
40
|
showNewBookmarkGroupForm: false,
|
|
41
|
+
openMoveModal: false,
|
|
42
|
+
moveItem: null,
|
|
43
|
+
moveItemIsGroup: false,
|
|
49
44
|
bookmarkGroupTitle: '',
|
|
50
45
|
categoryTitle: '',
|
|
51
46
|
categoryId: '',
|
|
@@ -53,6 +48,10 @@ export default class ItemListTree extends Component {
|
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
50
|
|
|
51
|
+
onSubmit = false
|
|
52
|
+
|
|
53
|
+
onSubmitEdit = false
|
|
54
|
+
|
|
56
55
|
componentDidMount () {
|
|
57
56
|
this.timer = setTimeout(() => {
|
|
58
57
|
this.setState({
|
|
@@ -74,7 +73,14 @@ export default class ItemListTree extends Component {
|
|
|
74
73
|
|
|
75
74
|
componentWillUnmount () {
|
|
76
75
|
clearTimeout(this.timer)
|
|
77
|
-
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
onCancelMoveItem = () => {
|
|
79
|
+
this.setState({
|
|
80
|
+
openMoveModal: false,
|
|
81
|
+
moveItem: null,
|
|
82
|
+
moveItemIsGroup: false
|
|
83
|
+
})
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
filter = list => {
|
|
@@ -152,9 +158,7 @@ export default class ItemListTree extends Component {
|
|
|
152
158
|
if (!categoryTitle) {
|
|
153
159
|
return
|
|
154
160
|
}
|
|
155
|
-
const bookmarkGroups =
|
|
156
|
-
this.props.bookmarkGroups
|
|
157
|
-
)
|
|
161
|
+
const { bookmarkGroups } = window.store
|
|
158
162
|
const obj = find(
|
|
159
163
|
bookmarkGroups,
|
|
160
164
|
bg => bg.id === categoryId
|
|
@@ -166,27 +170,20 @@ export default class ItemListTree extends Component {
|
|
|
166
170
|
this.setState({
|
|
167
171
|
categoryId: ''
|
|
168
172
|
})
|
|
169
|
-
const { store } = window
|
|
170
|
-
store.setBookmarkGroups(
|
|
171
|
-
bookmarkGroups
|
|
172
|
-
)
|
|
173
|
-
store.batchDbUpdate([{
|
|
174
|
-
id: categoryId,
|
|
175
|
-
db: 'bookmarkGroups',
|
|
176
|
-
upsert: false,
|
|
177
|
-
update: {
|
|
178
|
-
title: categoryTitle
|
|
179
|
-
}
|
|
180
|
-
}])
|
|
181
173
|
}
|
|
182
174
|
|
|
183
175
|
onClick = () => {
|
|
184
176
|
|
|
185
177
|
}
|
|
186
178
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
179
|
+
openMoveModal = (e, item, isGroup) => {
|
|
180
|
+
e.stopPropagation()
|
|
181
|
+
this.setState({
|
|
182
|
+
openMoveModal: true,
|
|
183
|
+
moveItem: item,
|
|
184
|
+
moveItemIsGroup: isGroup
|
|
185
|
+
})
|
|
186
|
+
}
|
|
190
187
|
|
|
191
188
|
handleChangeBookmarkGroupTitle = e => {
|
|
192
189
|
let { value } = e.target
|
|
@@ -227,55 +224,37 @@ export default class ItemListTree extends Component {
|
|
|
227
224
|
return
|
|
228
225
|
}
|
|
229
226
|
this.onSubmit = true
|
|
230
|
-
|
|
227
|
+
this.parentId = this.state.parentId
|
|
231
228
|
this.setState({
|
|
232
229
|
showNewBookmarkGroupForm: false,
|
|
233
230
|
parentId: ''
|
|
234
|
-
},
|
|
235
|
-
this.onSubmit = false
|
|
236
|
-
let bookmarkGroups = copy(
|
|
237
|
-
this.props.bookmarkGroups
|
|
238
|
-
)
|
|
239
|
-
const newCat = {
|
|
240
|
-
id: uid(),
|
|
241
|
-
title: this.state.bookmarkGroupTitle,
|
|
242
|
-
level: 2,
|
|
243
|
-
bookmarkIds: []
|
|
244
|
-
}
|
|
245
|
-
bookmarkGroups = [
|
|
246
|
-
newCat,
|
|
247
|
-
...bookmarkGroups
|
|
248
|
-
]
|
|
249
|
-
const cat = find(
|
|
250
|
-
bookmarkGroups,
|
|
251
|
-
d => d.id === id
|
|
252
|
-
)
|
|
253
|
-
if (!cat) {
|
|
254
|
-
return
|
|
255
|
-
}
|
|
256
|
-
cat.bookmarkGroupIds = [
|
|
257
|
-
...(cat.bookmarkGroupIds || []),
|
|
258
|
-
newCat.id
|
|
259
|
-
]
|
|
260
|
-
const { store } = window
|
|
261
|
-
store.setBookmarkGroups(
|
|
262
|
-
bookmarkGroups
|
|
263
|
-
)
|
|
264
|
-
store.batchDbAdd([{
|
|
265
|
-
db: 'bookmarkGroups',
|
|
266
|
-
obj: newCat
|
|
267
|
-
}])
|
|
268
|
-
store.batchDbUpdate([{
|
|
269
|
-
upsert: false,
|
|
270
|
-
id,
|
|
271
|
-
update: {
|
|
272
|
-
bookmarkGroupIds: cat.bookmarkGroupIds
|
|
273
|
-
},
|
|
274
|
-
db: 'bookmarkGroups'
|
|
275
|
-
}])
|
|
276
|
-
})
|
|
231
|
+
}, this.afterSubmitSub)
|
|
277
232
|
}
|
|
278
233
|
|
|
234
|
+
afterSubmitSub = action(() => {
|
|
235
|
+
const id = this.parentId
|
|
236
|
+
this.onSubmit = false
|
|
237
|
+
const { bookmarkGroups } = window.store
|
|
238
|
+
const newCat = {
|
|
239
|
+
id: uid(),
|
|
240
|
+
title: this.state.bookmarkGroupTitle,
|
|
241
|
+
level: 2,
|
|
242
|
+
bookmarkIds: []
|
|
243
|
+
}
|
|
244
|
+
bookmarkGroups.unshift(newCat)
|
|
245
|
+
const cat = find(
|
|
246
|
+
bookmarkGroups,
|
|
247
|
+
d => d.id === id
|
|
248
|
+
)
|
|
249
|
+
if (!cat) {
|
|
250
|
+
return
|
|
251
|
+
}
|
|
252
|
+
cat.bookmarkGroupIds = [
|
|
253
|
+
...(cat.bookmarkGroupIds || []),
|
|
254
|
+
newCat.id
|
|
255
|
+
]
|
|
256
|
+
})
|
|
257
|
+
|
|
279
258
|
handleNewBookmarkGroup = () => {
|
|
280
259
|
this.setState({
|
|
281
260
|
showNewBookmarkGroupForm: true,
|
|
@@ -345,137 +324,6 @@ export default class ItemListTree extends Component {
|
|
|
345
324
|
)
|
|
346
325
|
}
|
|
347
326
|
|
|
348
|
-
onCut = (item, isGroup) => {
|
|
349
|
-
const str = isGroup
|
|
350
|
-
? copyBookmarkGroupItemPrefix
|
|
351
|
-
: copyBookmarkItemPrefix
|
|
352
|
-
const txt = str + item.id
|
|
353
|
-
cut(txt, createName(item))
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
onPaste = (item) => {
|
|
357
|
-
const str = readClipboard()
|
|
358
|
-
const id = str.split(':')[1]
|
|
359
|
-
const bookmarkGroups = copy(
|
|
360
|
-
this.props.bookmarkGroups
|
|
361
|
-
)
|
|
362
|
-
const from = bookmarkGroups.find(t => {
|
|
363
|
-
return t.bookmarkIds.includes(id)
|
|
364
|
-
})
|
|
365
|
-
from.bookmarkIds = from.bookmarkIds.filter(d => {
|
|
366
|
-
return d !== id
|
|
367
|
-
})
|
|
368
|
-
const to = bookmarkGroups.find(t => {
|
|
369
|
-
return t.id === item.id
|
|
370
|
-
})
|
|
371
|
-
if (!to.bookmarkIds) {
|
|
372
|
-
to.bookmarkIds = []
|
|
373
|
-
}
|
|
374
|
-
to.bookmarkIds = uniq(
|
|
375
|
-
[
|
|
376
|
-
...to.bookmarkIds,
|
|
377
|
-
id
|
|
378
|
-
]
|
|
379
|
-
)
|
|
380
|
-
const { store } = window
|
|
381
|
-
if (from) {
|
|
382
|
-
store.editBookmarkGroup(
|
|
383
|
-
from.id,
|
|
384
|
-
{
|
|
385
|
-
bookmarkIds: (from.bookmarkIds || []).filter(d => {
|
|
386
|
-
return d !== id
|
|
387
|
-
})
|
|
388
|
-
}
|
|
389
|
-
)
|
|
390
|
-
}
|
|
391
|
-
store.editBookmarkGroup(
|
|
392
|
-
item.id,
|
|
393
|
-
{
|
|
394
|
-
bookmarkIds: uniq(
|
|
395
|
-
[
|
|
396
|
-
...(item.bookmarkIds || []),
|
|
397
|
-
id
|
|
398
|
-
]
|
|
399
|
-
)
|
|
400
|
-
}
|
|
401
|
-
)
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
computePos = (e) => {
|
|
405
|
-
return {
|
|
406
|
-
left: e.clientX,
|
|
407
|
-
top: e.clientY
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
onContextAction = e => {
|
|
412
|
-
const {
|
|
413
|
-
action,
|
|
414
|
-
id,
|
|
415
|
-
args = [],
|
|
416
|
-
func
|
|
417
|
-
} = e.data || {}
|
|
418
|
-
if (action === commonActions.closeContextMenuAfter) {
|
|
419
|
-
window.removeEventListener('message', this.onContextAction)
|
|
420
|
-
return false
|
|
421
|
-
}
|
|
422
|
-
if (
|
|
423
|
-
action !== commonActions.clickContextMenu ||
|
|
424
|
-
id !== this.uid ||
|
|
425
|
-
!this[func]
|
|
426
|
-
) {
|
|
427
|
-
return false
|
|
428
|
-
}
|
|
429
|
-
window.removeEventListener('message', this.onContextAction)
|
|
430
|
-
this[func](...args)
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
onContextMenu = (e, item, isGroup) => {
|
|
434
|
-
e.preventDefault()
|
|
435
|
-
if (this.props.staticList) {
|
|
436
|
-
return null
|
|
437
|
-
}
|
|
438
|
-
const menus = this.renderContextItems(item, isGroup)
|
|
439
|
-
this.uid = uid()
|
|
440
|
-
window.store.openContextMenu({
|
|
441
|
-
items: menus,
|
|
442
|
-
id: this.uid,
|
|
443
|
-
pos: this.computePos(e)
|
|
444
|
-
})
|
|
445
|
-
window.addEventListener('message', this.onContextAction)
|
|
446
|
-
this.closeNewGroupForm()
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
renderContextItems (item, isGroup) {
|
|
450
|
-
const res = []
|
|
451
|
-
const args = [copy(item), isGroup]
|
|
452
|
-
if (!isGroup) {
|
|
453
|
-
// res.push({
|
|
454
|
-
// func: 'onCopy',
|
|
455
|
-
// icon: 'CopyOutlined',
|
|
456
|
-
// text: e('copy'),
|
|
457
|
-
// args
|
|
458
|
-
// })
|
|
459
|
-
res.push({
|
|
460
|
-
func: 'onCut',
|
|
461
|
-
icon: 'FileExcelOutlined',
|
|
462
|
-
text: e('cut'),
|
|
463
|
-
args
|
|
464
|
-
})
|
|
465
|
-
}
|
|
466
|
-
const canPaste = hasBookmarkOrGroupInClipboardText()
|
|
467
|
-
if (isGroup) {
|
|
468
|
-
res.push({
|
|
469
|
-
func: 'onPaste',
|
|
470
|
-
icon: 'CopyOutlined',
|
|
471
|
-
text: e('paste'),
|
|
472
|
-
disabled: !canPaste,
|
|
473
|
-
args
|
|
474
|
-
})
|
|
475
|
-
}
|
|
476
|
-
return res
|
|
477
|
-
}
|
|
478
|
-
|
|
479
327
|
editItem = (e, item, isGroup) => {
|
|
480
328
|
e.stopPropagation()
|
|
481
329
|
if (isGroup) {
|
|
@@ -547,7 +395,7 @@ export default class ItemListTree extends Component {
|
|
|
547
395
|
target.classList.add('item-dragover')
|
|
548
396
|
}
|
|
549
397
|
|
|
550
|
-
onDrop = e => {
|
|
398
|
+
onDrop = action(e => {
|
|
551
399
|
e.preventDefault()
|
|
552
400
|
const elems = document.querySelectorAll('.tree-item.item-dragover')
|
|
553
401
|
elems.forEach(elem => {
|
|
@@ -604,9 +452,8 @@ export default class ItemListTree extends Component {
|
|
|
604
452
|
0,
|
|
605
453
|
dragItem
|
|
606
454
|
)
|
|
607
|
-
return
|
|
455
|
+
return
|
|
608
456
|
}
|
|
609
|
-
const updates = []
|
|
610
457
|
if (isGroupDrag) {
|
|
611
458
|
const parentDrag = pidDragged
|
|
612
459
|
? bookmarkGroups.find(
|
|
@@ -617,14 +464,6 @@ export default class ItemListTree extends Component {
|
|
|
617
464
|
parentDrag.bookmarkGroupIds = (parentDrag.bookmarkGroupIds || []).filter(
|
|
618
465
|
id => id !== idDragged
|
|
619
466
|
)
|
|
620
|
-
updates.push({
|
|
621
|
-
upsert: false,
|
|
622
|
-
id: parentDrag.id,
|
|
623
|
-
update: {
|
|
624
|
-
bookmarkGroupIds: parentDrag.bookmarkGroupIds
|
|
625
|
-
},
|
|
626
|
-
db: 'bookmarkGroups'
|
|
627
|
-
})
|
|
628
467
|
}
|
|
629
468
|
const parentDrop = pidDrop
|
|
630
469
|
? bookmarkGroups.find(
|
|
@@ -651,14 +490,6 @@ export default class ItemListTree extends Component {
|
|
|
651
490
|
}
|
|
652
491
|
arr.splice(index, 0, idDragged)
|
|
653
492
|
}
|
|
654
|
-
updates.push({
|
|
655
|
-
upsert: false,
|
|
656
|
-
id: parentDrop.id,
|
|
657
|
-
update: {
|
|
658
|
-
bookmarkGroupIds: parentDrop.bookmarkGroupIds
|
|
659
|
-
},
|
|
660
|
-
db: 'bookmarkGroups'
|
|
661
|
-
})
|
|
662
493
|
} else {
|
|
663
494
|
const parentDrag = bookmarkGroups.find(
|
|
664
495
|
item => item.id === pidDragged
|
|
@@ -669,14 +500,6 @@ export default class ItemListTree extends Component {
|
|
|
669
500
|
parentDrag.bookmarkIds = (parentDrag.bookmarkIds || []).filter(
|
|
670
501
|
id => id !== idDragged
|
|
671
502
|
)
|
|
672
|
-
updates.push({
|
|
673
|
-
upsert: false,
|
|
674
|
-
id: parentDrag.id,
|
|
675
|
-
update: {
|
|
676
|
-
bookmarkIds: parentDrag.bookmarkIds
|
|
677
|
-
},
|
|
678
|
-
db: 'bookmarkGroups'
|
|
679
|
-
})
|
|
680
503
|
const parentDrop = isGroupDrop
|
|
681
504
|
? bookmarkGroups.find(
|
|
682
505
|
item => item.id === idDrop
|
|
@@ -702,14 +525,6 @@ export default class ItemListTree extends Component {
|
|
|
702
525
|
}
|
|
703
526
|
arr.splice(index, 0, idDragged)
|
|
704
527
|
}
|
|
705
|
-
updates.push({
|
|
706
|
-
upsert: false,
|
|
707
|
-
id: parentDrop.id,
|
|
708
|
-
update: {
|
|
709
|
-
bookmarkIds: parentDrop.bookmarkIds
|
|
710
|
-
},
|
|
711
|
-
db: 'bookmarkGroups'
|
|
712
|
-
})
|
|
713
528
|
}
|
|
714
529
|
if (
|
|
715
530
|
isGroupDrag &&
|
|
@@ -720,19 +535,9 @@ export default class ItemListTree extends Component {
|
|
|
720
535
|
if (i >= 0) {
|
|
721
536
|
const item = bookmarkGroups[i]
|
|
722
537
|
item.level = 2
|
|
723
|
-
updates.push({
|
|
724
|
-
upsert: false,
|
|
725
|
-
id: item.id,
|
|
726
|
-
update: {
|
|
727
|
-
level: item.level
|
|
728
|
-
},
|
|
729
|
-
db: 'bookmarkGroups'
|
|
730
|
-
})
|
|
731
538
|
}
|
|
732
539
|
}
|
|
733
|
-
|
|
734
|
-
return window.store.setState('bookmarkGroups', bookmarkGroups)
|
|
735
|
-
}
|
|
540
|
+
})
|
|
736
541
|
|
|
737
542
|
editCategory = () => {
|
|
738
543
|
const {
|
|
@@ -757,9 +562,7 @@ export default class ItemListTree extends Component {
|
|
|
757
562
|
duplicateItem = (e, item) => {
|
|
758
563
|
e.stopPropagation()
|
|
759
564
|
const { addItem } = window.store
|
|
760
|
-
const bookmarkGroups =
|
|
761
|
-
this.props.bookmarkGroups
|
|
762
|
-
)
|
|
565
|
+
const { bookmarkGroups } = this.props
|
|
763
566
|
|
|
764
567
|
const newbookmark = copy(item)
|
|
765
568
|
newbookmark.id = uid()
|
|
@@ -779,14 +582,16 @@ export default class ItemListTree extends Component {
|
|
|
779
582
|
addItem(newbookmark, settingMap.bookmarks)
|
|
780
583
|
// update bookmark groups
|
|
781
584
|
this.updateBookmarkGroups(
|
|
782
|
-
bookmarkGroups,
|
|
783
585
|
newbookmark,
|
|
784
586
|
categoryId
|
|
785
587
|
)
|
|
786
588
|
this.props.onClickItem(newbookmark)
|
|
787
589
|
}
|
|
788
590
|
|
|
789
|
-
updateBookmarkGroups = (
|
|
591
|
+
updateBookmarkGroups = (bookmark, categoryId) => {
|
|
592
|
+
const {
|
|
593
|
+
bookmarkGroups
|
|
594
|
+
} = window.store
|
|
790
595
|
let index = bookmarkGroups.findIndex(
|
|
791
596
|
bg => bg.id === categoryId
|
|
792
597
|
)
|
|
@@ -795,48 +600,20 @@ export default class ItemListTree extends Component {
|
|
|
795
600
|
bg => bg.id === defaultBookmarkGroupId
|
|
796
601
|
)
|
|
797
602
|
}
|
|
798
|
-
const updates = []
|
|
799
603
|
const bid = bookmark.id
|
|
800
604
|
const bg = bookmarkGroups[index]
|
|
801
|
-
const old = copy(bg.bookmarkIds)
|
|
802
605
|
if (!bg.bookmarkIds.includes(bid)) {
|
|
803
606
|
bg.bookmarkIds.unshift(bid)
|
|
804
607
|
}
|
|
805
608
|
bg.bookmarkIds = uniq(bg.bookmarkIds)
|
|
806
|
-
|
|
807
|
-
updates.push({
|
|
808
|
-
id: bg.id,
|
|
809
|
-
db: 'bookmarkGroups',
|
|
810
|
-
upsert: false,
|
|
811
|
-
update: {
|
|
812
|
-
bookmarkIds: bg.bookmarkIds
|
|
813
|
-
}
|
|
814
|
-
})
|
|
815
|
-
}
|
|
816
|
-
bookmarkGroups = bookmarkGroups.map((bg, i) => {
|
|
609
|
+
bookmarkGroups.forEach((bg, i) => {
|
|
817
610
|
if (i === index) {
|
|
818
|
-
return
|
|
611
|
+
return
|
|
819
612
|
}
|
|
820
|
-
const old = copy(bg.bookmarkIds)
|
|
821
613
|
bg.bookmarkIds = bg.bookmarkIds.filter(
|
|
822
614
|
g => g !== bid
|
|
823
615
|
)
|
|
824
|
-
if (!isEqual(old, copy(bg.bookmarkIds))) {
|
|
825
|
-
updates.push({
|
|
826
|
-
id: bg.id,
|
|
827
|
-
db: 'bookmarkGroups',
|
|
828
|
-
upsert: false,
|
|
829
|
-
update: {
|
|
830
|
-
bookmarkIds: bg.bookmarkIds
|
|
831
|
-
}
|
|
832
|
-
})
|
|
833
|
-
}
|
|
834
|
-
return bg
|
|
835
616
|
})
|
|
836
|
-
window.store.setBookmarkGroups(
|
|
837
|
-
bookmarkGroups
|
|
838
|
-
)
|
|
839
|
-
window.store.batchDbUpdate(updates)
|
|
840
617
|
}
|
|
841
618
|
|
|
842
619
|
findBookmarkByTitle = (bookmarks, oldBookmark) => {
|
|
@@ -861,7 +638,7 @@ export default class ItemListTree extends Component {
|
|
|
861
638
|
[
|
|
862
639
|
'del',
|
|
863
640
|
'openAll',
|
|
864
|
-
'
|
|
641
|
+
'openMoveModal',
|
|
865
642
|
'editItem',
|
|
866
643
|
'addSubCat',
|
|
867
644
|
'onSelect',
|
|
@@ -875,13 +652,7 @@ export default class ItemListTree extends Component {
|
|
|
875
652
|
...pick(
|
|
876
653
|
this.state,
|
|
877
654
|
[
|
|
878
|
-
'keyword'
|
|
879
|
-
'openAll',
|
|
880
|
-
'onContextMenu',
|
|
881
|
-
'editItem',
|
|
882
|
-
'addSubCat',
|
|
883
|
-
'onSelect',
|
|
884
|
-
'duplicateItem'
|
|
655
|
+
'keyword'
|
|
885
656
|
]
|
|
886
657
|
)
|
|
887
658
|
}
|
|
@@ -1024,7 +795,7 @@ export default class ItemListTree extends Component {
|
|
|
1024
795
|
}
|
|
1025
796
|
|
|
1026
797
|
render () {
|
|
1027
|
-
const { ready } = this.state
|
|
798
|
+
const { ready, openMoveModal, moveItem, moveItemIsGroup } = this.state
|
|
1028
799
|
if (!ready) {
|
|
1029
800
|
return (
|
|
1030
801
|
<div className='pd3 aligncenter'>
|
|
@@ -1038,6 +809,13 @@ export default class ItemListTree extends Component {
|
|
|
1038
809
|
staticList,
|
|
1039
810
|
listStyle = {}
|
|
1040
811
|
} = this.props
|
|
812
|
+
const moveProps = {
|
|
813
|
+
openMoveModal,
|
|
814
|
+
moveItem,
|
|
815
|
+
moveItemIsGroup,
|
|
816
|
+
bookmarkGroups,
|
|
817
|
+
onCancelMoveItem: this.onCancelMoveItem
|
|
818
|
+
}
|
|
1041
819
|
const level1Bookgroups = ready
|
|
1042
820
|
? bookmarkGroups.filter(
|
|
1043
821
|
d => !d.level || d.level < 2
|
|
@@ -1045,6 +823,7 @@ export default class ItemListTree extends Component {
|
|
|
1045
823
|
: []
|
|
1046
824
|
return (
|
|
1047
825
|
<div className={`tree-list item-type-${type}`}>
|
|
826
|
+
<MoveItemModal {...moveProps} />
|
|
1048
827
|
{
|
|
1049
828
|
staticList
|
|
1050
829
|
? null
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRef } from 'react'
|
|
1
2
|
import RdpSession from '../rdp/rdp-session'
|
|
2
3
|
import { createTerm } from '../terminal/terminal-apis'
|
|
3
4
|
import deepCopy from 'json-deep-copy'
|
|
@@ -35,6 +36,8 @@ export default class VncSession extends RdpSession {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
domRef = createRef()
|
|
40
|
+
|
|
38
41
|
componentDidMount () {
|
|
39
42
|
this.remoteInit()
|
|
40
43
|
}
|
|
@@ -203,8 +206,7 @@ export default class VncSession extends RdpSession {
|
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
getDom = () => {
|
|
206
|
-
|
|
207
|
-
return document.getElementById(id)
|
|
209
|
+
return this.domRef.current
|
|
208
210
|
}
|
|
209
211
|
|
|
210
212
|
handleReInit = () => {
|
|
@@ -282,7 +284,7 @@ export default class VncSession extends RdpSession {
|
|
|
282
284
|
<div
|
|
283
285
|
{...divProps}
|
|
284
286
|
className='vnc-session-wrap session-v-wrap'
|
|
285
|
-
|
|
287
|
+
ref={this.domRef}
|
|
286
288
|
/>
|
|
287
289
|
{this.renderConfirm()}
|
|
288
290
|
</div>
|
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
* app upgrade
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { refsStatic } from '../components/common/ref'
|
|
6
6
|
|
|
7
7
|
export default Store => {
|
|
8
8
|
Store.prototype.onCheckUpdate = (noSkip = true) => {
|
|
9
|
-
|
|
10
|
-
action: commonActions.appUpdateCheck,
|
|
11
|
-
noSkip
|
|
12
|
-
}, '*')
|
|
9
|
+
refsStatic.get('upgrade')?.appUpdateCheck(noSkip)
|
|
13
10
|
}
|
|
14
11
|
Store.prototype.getProxySetting = function () {
|
|
15
12
|
const {
|