@electerm/electerm-react 2.3.114 → 2.3.126
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/components/shortcuts/shortcut-control.jsx +10 -0
- package/client/components/shortcuts/shortcuts-defaults.js +5 -0
- package/client/components/tabs/add-btn-menu.jsx +0 -2
- package/client/components/tabs/add-btn.jsx +16 -1
- package/client/components/terminal/terminal-command-dropdown.jsx +2 -2
- package/client/components/text-editor/simple-editor.jsx +3 -1
- package/client/components/vnc/vnc-session.jsx +0 -1
- package/package.json +1 -1
|
@@ -167,6 +167,16 @@ class ShortcutControl extends React.PureComponent {
|
|
|
167
167
|
window.store.onNewSsh()
|
|
168
168
|
}, 500)
|
|
169
169
|
|
|
170
|
+
toggleAddBtnShortcut = throttle((e) => {
|
|
171
|
+
e.stopPropagation()
|
|
172
|
+
const { currentLayoutBatch } = window.store
|
|
173
|
+
// Find the add button for the active layout (batch)
|
|
174
|
+
const addBtnElement = document.querySelector(`.v${currentLayoutBatch + 1} .tabs-add-btn`)
|
|
175
|
+
if (addBtnElement) {
|
|
176
|
+
addBtnElement.click()
|
|
177
|
+
}
|
|
178
|
+
}, 500)
|
|
179
|
+
|
|
170
180
|
togglefullscreenShortcut = throttle((e) => {
|
|
171
181
|
e.stopPropagation()
|
|
172
182
|
const x = document.querySelector('.term-fullscreen-control') ||
|
|
@@ -46,6 +46,10 @@ export default class AddBtn extends Component {
|
|
|
46
46
|
document.body.removeChild(this.portalContainer)
|
|
47
47
|
this.portalContainer = null
|
|
48
48
|
}
|
|
49
|
+
// Clear focus timeout
|
|
50
|
+
if (this.çƒ) {
|
|
51
|
+
clearTimeout(this.focusTimeout)
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
componentDidUpdate (prevProps, prevState) {
|
|
@@ -111,6 +115,17 @@ export default class AddBtn extends Component {
|
|
|
111
115
|
)
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
focusSearchInput = () => {
|
|
119
|
+
// Focus the search input after the menu renders
|
|
120
|
+
this.focusTimeout = setTimeout(() => {
|
|
121
|
+
const searchInput = this.menuRef.current?.querySelector('.ant-input')
|
|
122
|
+
if (searchInput) {
|
|
123
|
+
searchInput.focus()
|
|
124
|
+
searchInput.select()
|
|
125
|
+
}
|
|
126
|
+
}, 500)
|
|
127
|
+
}
|
|
128
|
+
|
|
114
129
|
handleAddBtnClick = () => {
|
|
115
130
|
if (this.state.open) {
|
|
116
131
|
this.setState({ open: false })
|
|
@@ -157,7 +172,7 @@ export default class AddBtn extends Component {
|
|
|
157
172
|
menuPosition,
|
|
158
173
|
menuTop,
|
|
159
174
|
menuLeft
|
|
160
|
-
})
|
|
175
|
+
}, this.focusSearchInput)
|
|
161
176
|
|
|
162
177
|
window.openTabBatch = this.props.batch
|
|
163
178
|
}
|
|
@@ -120,9 +120,9 @@ export default class TerminalCmdSuggestions extends Component {
|
|
|
120
120
|
|
|
121
121
|
// Use bottom position if close to bottom edge
|
|
122
122
|
if (reverse) {
|
|
123
|
-
position.bottom = h - top + cellHeight
|
|
123
|
+
position.bottom = h - top + cellHeight * 1.5
|
|
124
124
|
} else {
|
|
125
|
-
position.top = top
|
|
125
|
+
position.top = top + cellHeight
|
|
126
126
|
}
|
|
127
127
|
this.setState({
|
|
128
128
|
showSuggestions: true,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CopyOutlined
|
|
8
8
|
} from '@ant-design/icons'
|
|
9
9
|
import { copy } from '../../common/clipboard'
|
|
10
|
+
import { escapeRegExp } from 'lodash-es'
|
|
10
11
|
|
|
11
12
|
export default function SimpleEditor (props) {
|
|
12
13
|
const [searchKeyword, setSearchKeyword] = useState('')
|
|
@@ -72,7 +73,8 @@ export default function SimpleEditor (props) {
|
|
|
72
73
|
|
|
73
74
|
const matches = []
|
|
74
75
|
const text = props.value || ''
|
|
75
|
-
const
|
|
76
|
+
const escapedKeyword = escapeRegExp(searchKeyword)
|
|
77
|
+
const regex = new RegExp(escapedKeyword, 'gi')
|
|
76
78
|
let match
|
|
77
79
|
|
|
78
80
|
while ((match = regex.exec(text)) !== null) {
|