@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)
|
package/client/store/item.js
CHANGED
package/client/store/ui-theme.js
CHANGED
|
@@ -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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|