@electerm/electerm-react 1.90.6 → 1.90.8

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.
@@ -26,11 +26,11 @@ export default function ThemeListItem (props) {
26
26
  const { store } = window
27
27
 
28
28
  function handleClickApply () {
29
+ delete window.originalTheme
29
30
  store.setTheme(item.id)
30
31
  }
31
32
 
32
33
  function handleMouseEnter () {
33
- if (!item.id) return
34
34
  // Store current theme ID before changing
35
35
  const currentTheme = window.store.config.theme
36
36
  window.originalTheme = currentTheme
@@ -3,12 +3,15 @@
3
3
  */
4
4
 
5
5
  import List from '../setting-panel/list'
6
- import { LoadingOutlined } from '@ant-design/icons'
6
+ import { LoadingOutlined, CheckCircleOutlined } from '@ant-design/icons'
7
7
  import { pick } from 'lodash-es'
8
8
  import { Pagination } from 'antd'
9
9
  import ThemeListItem from './theme-list-item'
10
+ import { defaultTheme } from '../../common/constants'
10
11
  import './terminal-theme-list.styl'
11
12
 
13
+ const e = window.translate
14
+
12
15
  export default class ThemeList extends List {
13
16
  handlePager = page => {
14
17
  this.setState({ page })
@@ -37,6 +40,24 @@ export default class ThemeList extends List {
37
40
  )
38
41
  }
39
42
 
43
+ renderCurrentTheme () {
44
+ const { theme, list } = this.props
45
+ const item = list.find(d => d.id === theme)
46
+ if (!item) {
47
+ return null
48
+ }
49
+ const { name, id } = item
50
+ const title = id === defaultTheme.id
51
+ ? e(id)
52
+ : name
53
+ return (
54
+ <div className='pd2'>
55
+ <CheckCircleOutlined className='mg1r' />
56
+ {title}
57
+ </div>
58
+ )
59
+ }
60
+
40
61
  filter = list => {
41
62
  const { keyword, ready } = this.state
42
63
  return keyword
@@ -69,6 +90,7 @@ export default class ThemeList extends List {
69
90
  {this.renderTransport ? this.renderTransport() : null}
70
91
  {this.renderLabels ? this.renderLabels() : null}
71
92
  {this.renderSearch()}
93
+ {this.renderCurrentTheme()}
72
94
  <div className='item-list-wrap' style={listStyle}>
73
95
  {
74
96
  list.map(this.renderItem)
@@ -66,7 +66,7 @@ export default Store => {
66
66
  return deepCopy([
67
67
  ...store.getTerminalThemes(),
68
68
  ...store.itermThemes
69
- ]).sort(window.store.sortTheme)
69
+ ])
70
70
  }
71
71
  return deepCopy(store.getItems(type))
72
72
  }
@@ -37,12 +37,12 @@ export default Store => {
37
37
  return window.pre.runGlobalAsync('toCss', stylus)
38
38
  }
39
39
 
40
- Store.prototype.sortTheme = function (a, b) {
41
- const theme = window.originalTheme || window.store.config.theme
42
- const ax = a.id === theme ? -1 : 1
43
- const bx = b.id === theme ? -1 : 1
44
- return ax - bx
45
- }
40
+ // Store.prototype.sortTheme = function (a, b) {
41
+ // const theme = window.originalTheme || window.store.config.theme
42
+ // const ax = a.id === theme ? -1 : 1
43
+ // const bx = b.id === theme ? -1 : 1
44
+ // return ax > bx ? 1 : -1
45
+ // }
46
46
 
47
47
  Store.prototype.getUiThemeConfig = function () {
48
48
  const { store } = window
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.90.6",
3
+ "version": "1.90.8",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",