@electerm/electerm-react 1.39.2 → 1.39.5

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.
@@ -238,6 +238,7 @@ export const terminalActions = {
238
238
  openTerminalSearch: 'open-terminal-search',
239
239
  doSearchNext: 'do-search-next',
240
240
  doSearchPrev: 'do-search-prev',
241
+ clearSearch: 'clear-search',
241
242
  zoom: 'zoom-terminal'
242
243
  }
243
244
  export const fileActions = {
@@ -317,6 +318,7 @@ export const sshTunnelHelpLink = 'https://github.com/electerm/electerm/wiki/How-
317
318
  export const batchOpHelpLink = 'https://github.com/electerm/electerm/wiki/batch-operation'
318
319
  export const proxyHelpLink = 'https://github.com/electerm/electerm/wiki/proxy-format'
319
320
  export const regexHelpLink = 'https://github.com/electerm/electerm/wiki/Terminal-keywords-highlight-regular-expression-exmaples'
321
+ export const rdpHelpLink = 'https://github.com/electerm/electerm/wiki/RDP-limitation'
320
322
  export const modals = {
321
323
  hide: 0,
322
324
  setting: 1,
@@ -6,22 +6,28 @@ import { useEffect } from 'react'
6
6
  import {
7
7
  Input,
8
8
  Form,
9
- InputNumber
9
+ InputNumber,
10
+ TreeSelect
10
11
  } from 'antd'
11
12
  import { formItemLayout } from '../../common/form-layout'
12
13
  import {
13
14
  newBookmarkIdPrefix,
14
- terminalRdpType
15
+ terminalRdpType,
16
+ rdpHelpLink
15
17
  } from '../../common/constants'
16
18
  import useSubmit from './use-submit'
17
19
  import copy from 'json-deep-copy'
20
+ import Link from '../common/external-link.jsx'
18
21
  import { defaults } from 'lodash-es'
19
22
  import { ColorPickerItem } from './color-picker-item.jsx'
20
23
  import { getRandomDefaultColor } from '../../common/rand-hex-color.js'
24
+ import formatBookmarkGroups from './bookmark-group-tree-format'
25
+ import findBookmarkGroupId from '../../common/find-bookmark-group-id'
21
26
 
22
27
  const FormItem = Form.Item
23
28
  const { prefix } = window
24
29
  const e = prefix('form')
30
+ const c = prefix('common')
25
31
 
26
32
  export default function LocalFormUi (props) {
27
33
  const [
@@ -36,16 +42,34 @@ export default function LocalFormUi (props) {
36
42
  })
37
43
  }
38
44
  }, [props.currentBookmarkGroupId])
45
+ const {
46
+ id = ''
47
+ } = props.formData
48
+ const {
49
+ bookmarkGroups = [],
50
+ currentBookmarkGroupId
51
+ } = props
39
52
  let initialValues = copy(props.formData)
53
+ const initBookmarkGroupId = !id.startsWith(newBookmarkIdPrefix)
54
+ ? findBookmarkGroupId(bookmarkGroups, id)
55
+ : currentBookmarkGroupId
40
56
  const defaultValues = {
41
57
  type: terminalRdpType,
42
58
  port: 3389,
59
+ category: initBookmarkGroupId,
43
60
  color: getRandomDefaultColor()
44
61
  }
45
62
  initialValues = defaults(initialValues, defaultValues)
46
63
  function renderCommon () {
64
+ const {
65
+ bookmarkGroups = []
66
+ } = props
67
+ const tree = formatBookmarkGroups(bookmarkGroups)
47
68
  return (
48
69
  <div className='pd1x'>
70
+ <p className='alignright'>
71
+ <Link to={rdpHelpLink}>Wiki: {rdpHelpLink}</Link>
72
+ </p>
49
73
  <FormItem
50
74
  {...formItemLayout}
51
75
  label={e('title')}
@@ -114,6 +138,17 @@ export default function LocalFormUi (props) {
114
138
  >
115
139
  <Input />
116
140
  </FormItem>
141
+ <FormItem
142
+ {...formItemLayout}
143
+ label={c('bookmarkCategory')}
144
+ name='category'
145
+ >
146
+ <TreeSelect
147
+ treeData={tree}
148
+ treeDefaultExpandAll
149
+ showSearch
150
+ />
151
+ </FormItem>
117
152
  <FormItem
118
153
  {...formItemLayout}
119
154
  label='type'
@@ -5,7 +5,8 @@
5
5
  import { useEffect } from 'react'
6
6
  import {
7
7
  Input,
8
- Form
8
+ Form,
9
+ TreeSelect
9
10
  } from 'antd'
10
11
  import { formItemLayout } from '../../common/form-layout'
11
12
  import {
@@ -17,10 +18,13 @@ import copy from 'json-deep-copy'
17
18
  import { defaults } from 'lodash-es'
18
19
  import { ColorPickerItem } from './color-picker-item.jsx'
19
20
  import { getRandomDefaultColor } from '../../common/rand-hex-color.js'
21
+ import formatBookmarkGroups from './bookmark-group-tree-format'
22
+ import findBookmarkGroupId from '../../common/find-bookmark-group-id'
20
23
 
21
24
  const FormItem = Form.Item
22
25
  const { prefix } = window
23
26
  const e = prefix('form')
27
+ const c = prefix('common')
24
28
 
25
29
  export default function LocalFormUi (props) {
26
30
  const [
@@ -35,13 +39,28 @@ export default function LocalFormUi (props) {
35
39
  })
36
40
  }
37
41
  }, [props.currentBookmarkGroupId])
42
+ const {
43
+ id = ''
44
+ } = props.formData
45
+ const {
46
+ bookmarkGroups = [],
47
+ currentBookmarkGroupId
48
+ } = props
49
+ const initBookmarkGroupId = !id.startsWith(newBookmarkIdPrefix)
50
+ ? findBookmarkGroupId(bookmarkGroups, id)
51
+ : currentBookmarkGroupId
38
52
  let initialValues = copy(props.formData)
39
53
  const defaultValues = {
40
54
  type: terminalWebType,
55
+ category: initBookmarkGroupId,
41
56
  color: getRandomDefaultColor()
42
57
  }
43
58
  initialValues = defaults(initialValues, defaultValues)
44
59
  function renderCommon () {
60
+ const {
61
+ bookmarkGroups = []
62
+ } = props
63
+ const tree = formatBookmarkGroups(bookmarkGroups)
45
64
  return (
46
65
  <div className='pd1x'>
47
66
  <FormItem
@@ -70,6 +89,17 @@ export default function LocalFormUi (props) {
70
89
  >
71
90
  <Input.TextArea rows={1} />
72
91
  </FormItem>
92
+ <FormItem
93
+ {...formItemLayout}
94
+ label={c('bookmarkCategory')}
95
+ name='category'
96
+ >
97
+ <TreeSelect
98
+ treeData={tree}
99
+ treeDefaultExpandAll
100
+ showSearch
101
+ />
102
+ </FormItem>
73
103
  <FormItem
74
104
  {...formItemLayout}
75
105
  label='type'
@@ -11,7 +11,7 @@ import BatchOp from '../batch-op/batch-op'
11
11
  import CssOverwrite from './css-overwrite'
12
12
  import UiTheme from './ui-theme'
13
13
  import CustomCss from './custom-css.jsx'
14
- import Resolutions from '../session/resolution-edit'
14
+ import Resolutions from '../rdp/resolution-edit'
15
15
  import TerminalInteractive from '../terminal/terminal-interactive'
16
16
  import ConfirmModalStore from '../sftp/confirm-modal-store.jsx'
17
17
  import TransferConflictStore from '../sftp/transfer-conflict-store.jsx'
@@ -4,7 +4,8 @@ import deepCopy from 'json-deep-copy'
4
4
  import clone from '../../common/to-simple-obj'
5
5
  import { handleErr } from '../../common/fetch'
6
6
  import {
7
- statusMap
7
+ statusMap,
8
+ rdpHelpLink
8
9
  } from '../../common/constants'
9
10
  import {
10
11
  notification,
@@ -16,6 +17,7 @@ import {
16
17
  ReloadOutlined,
17
18
  EditOutlined
18
19
  } from '@ant-design/icons'
20
+ import HelpIcon from '../common/help-icon'
19
21
  import * as ls from '../../common/safe-local-storage'
20
22
  import scanCode from './code-scan'
21
23
  import resolutions from './resolutions'
@@ -388,9 +390,12 @@ export default class RdpSession extends Component {
388
390
  onClick={this.handleEditResolutions}
389
391
  className='mg2r mg1l pointer'
390
392
  />
391
- <span className='mg2l'>
393
+ <span className='mg2l mg2r'>
392
394
  {username}@{host}:{port}
393
395
  </span>
396
+ <HelpIcon
397
+ link={rdpHelpLink}
398
+ />
394
399
  </div>
395
400
  )
396
401
  }
@@ -4,7 +4,7 @@
4
4
  import { Component } from 'react'
5
5
  import Term from '../terminal'
6
6
  import Sftp from '../sftp/sftp-entry'
7
- import RdpSession from './rdp-session'
7
+ import RdpSession from '../rdp/rdp-session'
8
8
  import {
9
9
  BorderVerticleOutlined,
10
10
  BorderHorizontalOutlined,
@@ -1,6 +1,6 @@
1
1
  import { Component } from '../common/react-subx'
2
2
  import Session from './session'
3
- import WebSession from './web-session'
3
+ import WebSession from '../web/web-session.jsx'
4
4
  import { findIndex, pick } from 'lodash-es'
5
5
  import classNames from 'classnames'
6
6
  import generate from '../../common/uid'
@@ -363,6 +363,13 @@ class Term extends Component {
363
363
  )
364
364
  ) {
365
365
  this.searchPrev(keyword, options)
366
+ } else if (
367
+ action === terminalActions.clearSearch &&
368
+ (
369
+ propSplitId === activeSplitId
370
+ )
371
+ ) {
372
+ this.searchAddon.clearDecorations()
366
373
  } else if (
367
374
  action === commonActions.getTermLogState &&
368
375
  pid === statePid
@@ -55,6 +55,9 @@ class TermSearch extends Component {
55
55
  }
56
56
 
57
57
  toggleSearch = () => {
58
+ if (this.props.store.termSearchOpen) {
59
+ this.clearSearch()
60
+ }
58
61
  this.props.store.toggleTerminalSearch()
59
62
  setTimeout(window.store.focus, 200)
60
63
  }
@@ -89,7 +92,16 @@ class TermSearch extends Component {
89
92
  this.prev()
90
93
  }
91
94
 
95
+ clearSearch = () => {
96
+ const { activeTerminalId } = this.props.store
97
+ postMessage({
98
+ action: terminalActions.clearSearch,
99
+ activeSplitId: activeTerminalId
100
+ })
101
+ }
102
+
92
103
  close = () => {
104
+ this.clearSearch()
93
105
  this.props.store.termSearchOpen = false
94
106
  }
95
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.39.2",
3
+ "version": "1.39.5",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",
File without changes