@electerm/electerm-react 1.37.96 → 1.37.106

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.
@@ -37,7 +37,6 @@ export const contextMenuWidth = 280
37
37
  export const contextMenuPaddingTop = 10
38
38
  export const sftpControlHeight = 28 + 42 + 33 + 46
39
39
  export const sidebarWidth = 43
40
- export const sidebarPanelWidth = 300
41
40
  export const maxHistory = 50
42
41
  export const maxTransport = 5
43
42
  export const maxSftpHistory = 20
@@ -8,7 +8,7 @@ export default {
8
8
  scrollback: 3000,
9
9
  onStartSessions: [],
10
10
  fontSize: 16,
11
- fontFamily: 'mono, courier-new, courier, monospace',
11
+ fontFamily: 'Fira Code, mono, courier-new, courier, monospace',
12
12
  execWindows: 'System32/WindowsPowerShell/v1.0/powershell.exe',
13
13
  execMac: 'zsh',
14
14
  execLinux: 'bash',
@@ -299,11 +299,10 @@ export default class SessionWrapper extends Component {
299
299
  infoPanelPinned,
300
300
  showInfo
301
301
  } = this.state
302
- if (!infoPanelPinned || !showInfo) {
303
- return this.props.width
304
- }
305
- const { rightSidebarWidth, width } = this.props
306
- return width - rightSidebarWidth
302
+ const { rightSidebarWidth, width, leftSidebarWidth, pinned, openedSideBar } = this.props
303
+ const rt = infoPanelPinned && showInfo ? rightSidebarWidth : 0
304
+ const lt = pinned && openedSideBar ? leftSidebarWidth : 0
305
+ return width - rt - lt - 42
307
306
  }
308
307
 
309
308
  renderTerminals = () => {
@@ -350,7 +350,10 @@ class Sessions extends Component {
350
350
  'tabsHeight',
351
351
  'appPath',
352
352
  'topMenuHeight',
353
- 'rightSidebarWidth'
353
+ 'rightSidebarWidth',
354
+ 'leftSidebarWidth',
355
+ 'pinned',
356
+ 'openedSideBar'
354
357
  ]),
355
358
  config,
356
359
  ...pick(this, [
@@ -411,7 +414,7 @@ class Sessions extends Component {
411
414
 
412
415
  renderSessionsWrap = () => {
413
416
  const { leftSidebarWidth, openedSideBar } = this.props.store
414
- const w = leftSidebarWidth + 43
417
+ const w = leftSidebarWidth + 42
415
418
  const ptp = openedSideBar
416
419
  ? {
417
420
  className: 'sessions',
@@ -56,13 +56,24 @@ export function shortcutExtend (Cls) {
56
56
  type,
57
57
  key
58
58
  } = event
59
- if (this.isTerm && key === 'Backspace' && this.isTerm && type === 'keydown') {
59
+ if (
60
+ this.term &&
61
+ key === 'Backspace' &&
62
+ type === 'keydown' &&
63
+ !altKey &&
64
+ !ctrlKey
65
+ ) {
60
66
  this.props.onDelKeyPressed()
61
67
  const delKey = this.props.config.backspaceMode === '^?' ? 8 : 127
62
68
  const altDelDelKey = delKey === 8 ? 127 : 8
63
69
  const char = String.fromCharCode(shiftKey ? delKey : altDelDelKey)
64
70
  this.socket.send(char)
65
71
  return false
72
+ } else if (
73
+ this.term &&
74
+ this.term.buffer.active.type === 'alternate'
75
+ ) {
76
+ return true
66
77
  }
67
78
  const codeName = event instanceof window.WheelEvent
68
79
  ? (wheelDeltaY > 0 ? 'mouseWheelUp' : 'mouseWheelDown')
@@ -87,13 +98,14 @@ export function shortcutExtend (Cls) {
87
98
  if (conf.shortcut.split(',').includes(r)) {
88
99
  if (this[funcName]) {
89
100
  return this[funcName](event)
90
- } else if (this.isTerm && conf.readonly) {
101
+ } else if (this.term && conf.readonly) {
91
102
  return true
92
103
  } else {
93
104
  return false
94
105
  }
95
106
  }
96
107
  }
108
+ return !!this.term
97
109
  }
98
110
  return Cls
99
111
  }
@@ -19,6 +19,7 @@ export default class SidePanel extends PureComponent {
19
19
  nw = 600
20
20
  }
21
21
  this.props.setLeftSidePanelWidth(nw)
22
+ window.store.onResize()
22
23
  window.removeEventListener('mouseup', this.handleMouseup)
23
24
  window.removeEventListener('mousemove', this.handleMousemove)
24
25
  }
@@ -5,10 +5,11 @@ export default function AppDrag (props) {
5
5
  const {
6
6
  target
7
7
  } = e
8
+ const { classList = [] } = target || {}
8
9
  if (
9
- target instanceof window.SVGElement ||
10
- target.classList.contains('tab-title') ||
11
- target.classList.contains('ant-tooltip-inner')
10
+ !classList.contains('app-drag') &&
11
+ !classList.contains('tabs-inner') &&
12
+ !classList.contains('tabs-wrapper')
12
13
  ) {
13
14
  window.pre.runSync('windowMove', false)
14
15
  return false
@@ -17,6 +18,7 @@ export default function AppDrag (props) {
17
18
  }
18
19
 
19
20
  function onMouseDown (e) {
21
+ e.stopPropagation()
20
22
  if (canOperate(e)) {
21
23
  window.pre.runSync('windowMove', true)
22
24
  }
@@ -27,8 +29,9 @@ export default function AppDrag (props) {
27
29
  }
28
30
 
29
31
  function onDoubleClick (e) {
32
+ e.stopPropagation()
30
33
  if (!canOperate(e)) {
31
- return window.pre.runSync('windowMove', false)
34
+ return
32
35
  }
33
36
  const {
34
37
  isMaximized
@@ -240,7 +240,7 @@ export default class Tabs extends React.Component {
240
240
  ? '100%'
241
241
  : tabsWidthAll
242
242
  const style = {
243
- width: width - windowControlWidth - 86
243
+ width: width - windowControlWidth - 136
244
244
  }
245
245
  return (
246
246
  <div
@@ -76,8 +76,6 @@ class Term extends Component {
76
76
  }
77
77
  }
78
78
 
79
- isTerm = true
80
-
81
79
  componentDidMount () {
82
80
  this.initTerminal()
83
81
  this.initEvt()
@@ -110,7 +110,7 @@ export default class TerminalInfoContent extends PureComponent {
110
110
  draggable: false,
111
111
  style: {
112
112
  width: props.rightSidebarWidth,
113
- top: props.topMenuHeight + props.tabsHeight + termControlHeight - 4
113
+ top: props.topMenuHeight + props.tabsHeight + termControlHeight
114
114
  }
115
115
  }
116
116
  return (
@@ -2,6 +2,7 @@ import { render } from 'react-dom'
2
2
  import 'antd/dist/reset.css'
3
3
  import 'xterm/css/xterm.css'
4
4
  import '../common/trzsz'
5
+ import 'firacode/distr/fira_code.css'
5
6
  import Main from '../components/main/index.jsx'
6
7
  import { notification } from 'antd'
7
8
  notification.config({
@@ -31,8 +31,6 @@ import { uniq } from 'lodash-es'
31
31
  import copy from 'json-deep-copy'
32
32
  import {
33
33
  settingMap,
34
- sidebarWidth,
35
- sidebarPanelWidth,
36
34
  paneMap,
37
35
  settingSyncId,
38
36
  settingShortcutsId,
@@ -93,8 +91,7 @@ class Store {
93
91
  }
94
92
 
95
93
  get width () {
96
- return window.store.innerWidth - sidebarWidth -
97
- (window.store.pinned ? sidebarPanelWidth : 0)
94
+ return window.store.innerWidth
98
95
  }
99
96
 
100
97
  get currentQuickCommands () {
@@ -226,7 +223,7 @@ class Store {
226
223
  }
227
224
 
228
225
  get topMenuHeight () {
229
- return window.store.config.useSystemTitleBar ? 0 : 15
226
+ return 0
230
227
  }
231
228
 
232
229
  get tabsHeight () {
@@ -25,7 +25,7 @@ import * as ls from '../common/safe-local-storage'
25
25
 
26
26
  const { prefix } = window
27
27
  const t = prefix('terminalThemes')
28
- const e = prefix('control')
28
+ const e = prefix('common')
29
29
  const newQuickCommand = 'newQuickCommand'
30
30
  const q = prefix('quickCommands')
31
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.37.96",
3
+ "version": "1.37.106",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",