@electerm/electerm-react 3.15.105 → 3.15.110

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.
@@ -1,11 +1,17 @@
1
- import { Component } from 'react'
2
1
  import Modal from '../common/modal'
3
2
 
4
3
  const e = window.translate
5
4
 
6
- export class DropFileModal extends Component {
7
- renderSerialFooter () {
8
- const { onSelect } = this.props
5
+ export function DropFileModal (props) {
6
+ const {
7
+ visible,
8
+ files,
9
+ isSerial,
10
+ onSelect,
11
+ onCancel
12
+ } = props
13
+
14
+ const renderSerialFooter = () => {
9
15
  return (
10
16
  <>
11
17
  <button
@@ -26,8 +32,7 @@ export class DropFileModal extends Component {
26
32
  )
27
33
  }
28
34
 
29
- renderSshFooter () {
30
- const { onSelect } = this.props
35
+ const renderSshFooter = () => {
31
36
  return (
32
37
  <>
33
38
  <button
@@ -55,34 +60,35 @@ export class DropFileModal extends Component {
55
60
  )
56
61
  }
57
62
 
58
- render () {
59
- const {
60
- visible,
61
- files,
62
- isSerial,
63
- onCancel
64
- } = this.props
65
-
66
- if (!visible) {
67
- return null
68
- }
69
-
63
+ const renderList = () => {
70
64
  return (
71
- <Modal
72
- title='?'
73
- open={visible}
74
- onCancel={onCancel}
75
- footer={
76
- <div className='custom-modal-footer-buttons'>
77
- {isSerial ? this.renderSerialFooter() : this.renderSshFooter()}
78
- </div>
79
- }
80
- width={400}
81
- >
82
- <p>{files?.map(f => f.path).join(', ')}</p>
83
- </Modal>
65
+ <ul>
66
+ {files?.map(f => (
67
+ <li key={f.path}>{f.path}</li>
68
+ ))}
69
+ </ul>
84
70
  )
85
71
  }
72
+
73
+ if (!visible) {
74
+ return null
75
+ }
76
+
77
+ return (
78
+ <Modal
79
+ title='?'
80
+ open={visible}
81
+ onCancel={onCancel}
82
+ footer={
83
+ <div className='custom-modal-footer-buttons'>
84
+ {isSerial ? renderSerialFooter() : renderSshFooter()}
85
+ </div>
86
+ }
87
+ width={400}
88
+ >
89
+ {renderList()}
90
+ </Modal>
91
+ )
86
92
  }
87
93
 
88
94
  export default DropFileModal
@@ -479,19 +479,13 @@ class Term extends Component {
479
479
  return
480
480
  }
481
481
 
482
- const hasMultiFiles = filePaths.length > 1
483
-
484
482
  if (isSshTerminal) {
485
483
  const behavior = this.props.config.dragDropBehavior || 'ask'
486
- // multi-file drops always paste paths, skip the action modal
487
- if (behavior === 'ask' && !hasMultiFiles) {
484
+ if (behavior === 'ask') {
488
485
  this.setState({
489
486
  dropFileModalVisible: true,
490
487
  droppedFiles: filePaths.map(path => ({ path, isRemote: false }))
491
488
  })
492
- } else if (hasMultiFiles) {
493
- const filesAll = filePaths.map(path => `"${path}"`).join(' ')
494
- this.attachAddon._sendData(filesAll)
495
489
  } else {
496
490
  this.handleDropFileAction(behavior, filePaths.map(path => ({ path, isRemote: false })))
497
491
  }
@@ -499,16 +493,10 @@ class Term extends Component {
499
493
  }
500
494
 
501
495
  if (isSerialTerminal) {
502
- // multi-file drops always paste paths, skip the action modal
503
- if (hasMultiFiles) {
504
- const filesAll = filePaths.map(path => `"${path}"`).join(' ')
505
- this.attachAddon._sendData(filesAll)
506
- } else {
507
- this.setState({
508
- dropFileModalVisible: true,
509
- droppedFiles: filePaths.map(path => ({ path, isRemote: false }))
510
- })
511
- }
496
+ this.setState({
497
+ dropFileModalVisible: true,
498
+ droppedFiles: filePaths.map(path => ({ path, isRemote: false }))
499
+ })
512
500
  return
513
501
  }
514
502
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "3.15.105",
3
+ "version": "3.15.110",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",