@electerm/electerm-react 1.34.30
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/LICENSE +21 -0
- package/README.md +31 -0
- package/client/common/auto-complete-data-mapper.js +6 -0
- package/client/common/byte-format.js +14 -0
- package/client/common/class.js +52 -0
- package/client/common/clipboard.js +49 -0
- package/client/common/constants.js +308 -0
- package/client/common/create-lang-edit-link.js +7 -0
- package/client/common/create-title.js +29 -0
- package/client/common/db-fix.js +24 -0
- package/client/common/db.js +155 -0
- package/client/common/download-mirrors.js +10 -0
- package/client/common/download.js +16 -0
- package/client/common/error-handler.jsx +27 -0
- package/client/common/fetch-from-server.js +47 -0
- package/client/common/fetch.jsx +71 -0
- package/client/common/find-bookmark-group-id.js +15 -0
- package/client/common/find-parent.js +30 -0
- package/client/common/form-layout.js +27 -0
- package/client/common/fs.js +21 -0
- package/client/common/get-proxy.js +8 -0
- package/client/common/id-with-stamp.js +10 -0
- package/client/common/index-sorter.js +4 -0
- package/client/common/init-setting-item.js +32 -0
- package/client/common/is-absolute-path.js +3 -0
- package/client/common/is-ip.js +16 -0
- package/client/common/is-valid-path.js +7 -0
- package/client/common/key-control-pressed.js +13 -0
- package/client/common/key-pressed.js +13 -0
- package/client/common/key-shift-pressed.js +7 -0
- package/client/common/mode2permission.js +81 -0
- package/client/common/new-terminal.js +31 -0
- package/client/common/parse-int10.js +3 -0
- package/client/common/parse-json-safe.js +11 -0
- package/client/common/pass-enc.js +25 -0
- package/client/common/post-msg.js +3 -0
- package/client/common/pre.js +156 -0
- package/client/common/promise-timeout.js +27 -0
- package/client/common/resolve.js +31 -0
- package/client/common/run-idle.js +1 -0
- package/client/common/safe-local-storage.js +35 -0
- package/client/common/safe-name.js +19 -0
- package/client/common/sftp.js +74 -0
- package/client/common/terminal-theme.js +158 -0
- package/client/common/test-connection.js +12 -0
- package/client/common/time.js +30 -0
- package/client/common/to-simple-obj.js +5 -0
- package/client/common/track.js +7 -0
- package/client/common/transfer.js +76 -0
- package/client/common/trzsz.js +62 -0
- package/client/common/ui-theme.js +44 -0
- package/client/common/uid.js +5 -0
- package/client/common/update-check.js +79 -0
- package/client/common/upgrade.js +68 -0
- package/client/common/wait.js +8 -0
- package/client/common/ws.js +161 -0
- package/client/components/batch-op/batch-op.jsx +650 -0
- package/client/components/bookmark-form/bookmark-form.styl +8 -0
- package/client/components/bookmark-form/bookmark-group-tree-format.js +39 -0
- package/client/components/bookmark-form/encodes.js +44 -0
- package/client/components/bookmark-form/form-ssh-common.jsx +208 -0
- package/client/components/bookmark-form/form-tabs.jsx +69 -0
- package/client/components/bookmark-form/index.jsx +159 -0
- package/client/components/bookmark-form/local-form-ui.jsx +152 -0
- package/client/components/bookmark-form/local-form.jsx +16 -0
- package/client/components/bookmark-form/proxy.jsx +49 -0
- package/client/components/bookmark-form/quick-command-list.jsx +31 -0
- package/client/components/bookmark-form/quick-command.jsx +228 -0
- package/client/components/bookmark-form/render-auth-ssh.jsx +104 -0
- package/client/components/bookmark-form/render-connection-hopping.jsx +229 -0
- package/client/components/bookmark-form/render-delayed-scripts.jsx +88 -0
- package/client/components/bookmark-form/render-ssh-tunnel.jsx +116 -0
- package/client/components/bookmark-form/serial-form-ui.jsx +311 -0
- package/client/components/bookmark-form/serial-form.jsx +20 -0
- package/client/components/bookmark-form/sftp-enable.jsx +33 -0
- package/client/components/bookmark-form/ssh-form-ui.jsx +100 -0
- package/client/components/bookmark-form/ssh-form.jsx +348 -0
- package/client/components/bookmark-form/telnet-form-ui.jsx +154 -0
- package/client/components/bookmark-form/telnet-form.jsx +16 -0
- package/client/components/bookmark-form/tree-delete.jsx +87 -0
- package/client/components/bookmark-form/use-form-funcs.jsx +50 -0
- package/client/components/bookmark-form/use-quick-commands.jsx +83 -0
- package/client/components/bookmark-form/use-submit.jsx +77 -0
- package/client/components/bookmark-form/use-ui.jsx +82 -0
- package/client/components/bookmark-form/x11.jsx +23 -0
- package/client/components/common/animate-text.jsx +37 -0
- package/client/components/common/animate-text.styl +54 -0
- package/client/components/common/external-link.jsx +28 -0
- package/client/components/common/help-icon.jsx +25 -0
- package/client/components/common/highlight.jsx +23 -0
- package/client/components/common/highlight.styl +3 -0
- package/client/components/common/input-auto-focus.jsx +68 -0
- package/client/components/common/input-confirm.jsx +66 -0
- package/client/components/common/logo-elem.jsx +22 -0
- package/client/components/common/markdown.jsx +27 -0
- package/client/components/common/react-subx.jsx +1 -0
- package/client/components/common/resize-wrap.jsx +222 -0
- package/client/components/common/resize-wrap.styl +9 -0
- package/client/components/common/search.jsx +9 -0
- package/client/components/common/show-item.jsx +27 -0
- package/client/components/context-menu/boomarks.jsx +15 -0
- package/client/components/context-menu/context-menu.jsx +340 -0
- package/client/components/context-menu/context-menu.styl +90 -0
- package/client/components/context-menu/history.jsx +27 -0
- package/client/components/context-menu/icon-holder.jsx +5 -0
- package/client/components/context-menu/menu-btn.jsx +224 -0
- package/client/components/context-menu/sub-tab-menu.jsx +23 -0
- package/client/components/context-menu/tabs.jsx +22 -0
- package/client/components/context-menu/zoom.jsx +40 -0
- package/client/components/footer/batch-input.jsx +177 -0
- package/client/components/footer/footer-entry.jsx +141 -0
- package/client/components/footer/footer.styl +47 -0
- package/client/components/icons/match-case.jsx +10 -0
- package/client/components/icons/match-whole-word.jsx +13 -0
- package/client/components/icons/regular-exp.jsx +10 -0
- package/client/components/main/css-overwrite.jsx +92 -0
- package/client/components/main/error-wrapper.jsx +59 -0
- package/client/components/main/index.jsx +11 -0
- package/client/components/main/loading.jsx +25 -0
- package/client/components/main/main.jsx +149 -0
- package/client/components/main/term-fullscreen-control.jsx +21 -0
- package/client/components/main/term-fullscreen.styl +27 -0
- package/client/components/main/ui-theme.jsx +31 -0
- package/client/components/main/upgrade.jsx +351 -0
- package/client/components/main/upgrade.styl +27 -0
- package/client/components/main/wrapper.styl +41 -0
- package/client/components/quick-commands/qm.styl +29 -0
- package/client/components/quick-commands/quick-command-item.jsx +36 -0
- package/client/components/quick-commands/quick-command-transport-mod.jsx +54 -0
- package/client/components/quick-commands/quick-command-transport.jsx +12 -0
- package/client/components/quick-commands/quick-commands-box.jsx +233 -0
- package/client/components/quick-commands/quick-commands-form-elem.jsx +119 -0
- package/client/components/quick-commands/quick-commands-form.jsx +33 -0
- package/client/components/quick-commands/quick-commands-list.jsx +128 -0
- package/client/components/quick-commands/quick-commands-select.jsx +38 -0
- package/client/components/session/session.jsx +533 -0
- package/client/components/session/session.styl +53 -0
- package/client/components/session/sessions.jsx +445 -0
- package/client/components/setting-panel/bookmark-transport.jsx +148 -0
- package/client/components/setting-panel/bookmark-tree-list.jsx +14 -0
- package/client/components/setting-panel/col.jsx +18 -0
- package/client/components/setting-panel/list.jsx +186 -0
- package/client/components/setting-panel/list.styl +33 -0
- package/client/components/setting-panel/on-tree-drop.js +222 -0
- package/client/components/setting-panel/setting-modal.jsx +163 -0
- package/client/components/setting-panel/setting-wrap.jsx +37 -0
- package/client/components/setting-panel/setting-wrap.styl +52 -0
- package/client/components/setting-panel/setting.jsx +858 -0
- package/client/components/setting-panel/setting.styl +4 -0
- package/client/components/setting-panel/start-session-select.jsx +91 -0
- package/client/components/setting-panel/tab-bookmarks.jsx +37 -0
- package/client/components/setting-panel/tab-history.jsx +44 -0
- package/client/components/setting-panel/tab-quick-commands.jsx +38 -0
- package/client/components/setting-panel/tab-settings.jsx +42 -0
- package/client/components/setting-panel/tab-themes.jsx +34 -0
- package/client/components/setting-panel/tree-list.jsx +978 -0
- package/client/components/setting-panel/tree-list.styl +57 -0
- package/client/components/setting-sync/data-import.jsx +65 -0
- package/client/components/setting-sync/setting-sync-form.jsx +271 -0
- package/client/components/setting-sync/setting-sync.jsx +81 -0
- package/client/components/setting-sync/sync.styl +7 -0
- package/client/components/sftp/address-bar.jsx +139 -0
- package/client/components/sftp/address-bookmark-item.jsx +47 -0
- package/client/components/sftp/address-bookmark.jsx +81 -0
- package/client/components/sftp/address-bookmark.styl +8 -0
- package/client/components/sftp/confirm-modal.jsx +184 -0
- package/client/components/sftp/file-icon.jsx +22 -0
- package/client/components/sftp/file-item.jsx +1226 -0
- package/client/components/sftp/file-mode-modal.jsx +205 -0
- package/client/components/sftp/file-props-modal.jsx +211 -0
- package/client/components/sftp/file-read.js +81 -0
- package/client/components/sftp/list-table-ui.jsx +547 -0
- package/client/components/sftp/owner-list.js +97 -0
- package/client/components/sftp/paged-list.jsx +60 -0
- package/client/components/sftp/permission-render.jsx +42 -0
- package/client/components/sftp/sftp-entry.jsx +1069 -0
- package/client/components/sftp/sftp.styl +217 -0
- package/client/components/sftp/transfer-common.js +9 -0
- package/client/components/sftp/transfer-conflict.jsx +315 -0
- package/client/components/sftp/transfer-speed-format.js +60 -0
- package/client/components/sftp/transfer-tag.jsx +40 -0
- package/client/components/sftp/transfer-tag.styl +11 -0
- package/client/components/sftp/transfer.styl +55 -0
- package/client/components/sftp/transport-action.jsx +410 -0
- package/client/components/sftp/transport-entry.jsx +108 -0
- package/client/components/sftp/transport-types.js +8 -0
- package/client/components/sftp/transports-action.jsx +111 -0
- package/client/components/sftp/transports-ui.jsx +93 -0
- package/client/components/sftp/zip.js +42 -0
- package/client/components/sidebar/bookmark-select.jsx +48 -0
- package/client/components/sidebar/bookmark.jsx +82 -0
- package/client/components/sidebar/history.jsx +66 -0
- package/client/components/sidebar/index.jsx +230 -0
- package/client/components/sidebar/info-modal.jsx +250 -0
- package/client/components/sidebar/info.styl +27 -0
- package/client/components/sidebar/side-icon.jsx +25 -0
- package/client/components/sidebar/sidebar.styl +128 -0
- package/client/components/sidebar/transfer-history-modal.jsx +110 -0
- package/client/components/sidebar/transfer-history.styl +3 -0
- package/client/components/sidebar/transfer-list-control.jsx +205 -0
- package/client/components/sidebar/transfer-list.jsx +55 -0
- package/client/components/sidebar/transfer-modal.jsx +76 -0
- package/client/components/sidebar/transfer.styl +8 -0
- package/client/components/sidebar/transport-ui.jsx +109 -0
- package/client/components/tabs/index.jsx +320 -0
- package/client/components/tabs/tab.jsx +427 -0
- package/client/components/tabs/tabs.styl +220 -0
- package/client/components/tabs/window-control.jsx +55 -0
- package/client/components/terminal/attach-addon-custom.js +70 -0
- package/client/components/terminal/build-ls-term-id.js +5 -0
- package/client/components/terminal/index.jsx +1358 -0
- package/client/components/terminal/normal-buffer.jsx +33 -0
- package/client/components/terminal/term-search.jsx +224 -0
- package/client/components/terminal/term-search.styl +15 -0
- package/client/components/terminal/terminal-apis.js +31 -0
- package/client/components/terminal/terminal-interactive.jsx +148 -0
- package/client/components/terminal/terminal.styl +96 -0
- package/client/components/terminal/xterm-zmodem.js +48 -0
- package/client/components/terminal/zmodem-transfer.jsx +98 -0
- package/client/components/terminal/zmodem.styl +14 -0
- package/client/components/terminal-info/activity.jsx +54 -0
- package/client/components/terminal-info/base.jsx +25 -0
- package/client/components/terminal-info/content.jsx +101 -0
- package/client/components/terminal-info/data-cols-parser.jsx +50 -0
- package/client/components/terminal-info/disk.jsx +29 -0
- package/client/components/terminal-info/index.jsx +25 -0
- package/client/components/terminal-info/network.jsx +114 -0
- package/client/components/terminal-info/resource.jsx +80 -0
- package/client/components/terminal-info/run-cmd.jsx +273 -0
- package/client/components/terminal-info/terminal-info.styl +29 -0
- package/client/components/terminal-info/up.jsx +15 -0
- package/client/components/terminal-theme/index.jsx +264 -0
- package/client/components/terminal-theme/terminal-theme-list.styl +3 -0
- package/client/components/terminal-theme/theme-list.jsx +146 -0
- package/client/components/text-editor/text-editor-form.jsx +97 -0
- package/client/components/text-editor/text-editor.jsx +182 -0
- package/client/css/antd-overwrite.styl +14 -0
- package/client/css/basic.styl +38 -0
- package/client/css/includes/box.styl +154 -0
- package/client/css/includes/font-size.styl +6 -0
- package/client/css/includes/index.styl +3 -0
- package/client/css/includes/text.styl +31 -0
- package/client/css/includes/theme-default.styl +20 -0
- package/client/entry/basic.js +58 -0
- package/client/entry/index.jsx +15 -0
- package/client/entry/worker.js +137 -0
- package/client/store/address-bookmark.js +25 -0
- package/client/store/app-upgrade.js +23 -0
- package/client/store/batch-input-history.js +26 -0
- package/client/store/bookmark-group.js +128 -0
- package/client/store/bookmark.js +22 -0
- package/client/store/common.js +140 -0
- package/client/store/context-menu.js +23 -0
- package/client/store/db-upgrade.js +43 -0
- package/client/store/event.js +70 -0
- package/client/store/index.js +335 -0
- package/client/store/init-state.js +191 -0
- package/client/store/item.js +120 -0
- package/client/store/load-data.js +198 -0
- package/client/store/quick-command.js +43 -0
- package/client/store/session.js +54 -0
- package/client/store/setting.js +208 -0
- package/client/store/sidebar.js +48 -0
- package/client/store/sync.js +390 -0
- package/client/store/system-menu.js +120 -0
- package/client/store/tab.js +74 -0
- package/client/store/terminal-theme.js +116 -0
- package/client/store/transfer-history.js +27 -0
- package/client/store/transfer-list.js +20 -0
- package/client/store/ui-theme.js +71 -0
- package/client/store/watch.js +116 -0
- package/client/views/index.pug +58 -0
- package/package.json +34 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* theme list render
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import List from '../setting-panel/list'
|
|
6
|
+
import { CheckCircleOutlined, PlusOutlined, LoadingOutlined } from '@ant-design/icons'
|
|
7
|
+
import { Tooltip, Pagination } from 'antd'
|
|
8
|
+
import classnames from 'classnames'
|
|
9
|
+
import { defaultTheme } from '../../common/constants'
|
|
10
|
+
import highlight from '../common/highlight'
|
|
11
|
+
import './terminal-theme-list.styl'
|
|
12
|
+
|
|
13
|
+
const { prefix } = window
|
|
14
|
+
const e = prefix('terminalThemes')
|
|
15
|
+
|
|
16
|
+
export default class ThemeList extends List {
|
|
17
|
+
del = (item, e) => {
|
|
18
|
+
e.stopPropagation()
|
|
19
|
+
this.props.store.delTheme(item)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
handlePager = page => {
|
|
23
|
+
this.setState({ page })
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
renderApplyBtn = item => {
|
|
27
|
+
if (!item.id) {
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
return (
|
|
31
|
+
<Tooltip
|
|
32
|
+
title={e('apply')}
|
|
33
|
+
placement='topLeft'
|
|
34
|
+
>
|
|
35
|
+
<CheckCircleOutlined
|
|
36
|
+
className='pointer list-item-apply'
|
|
37
|
+
onClick={() => this.props.store.setTheme(item.id)}
|
|
38
|
+
/>
|
|
39
|
+
</Tooltip>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onClickTheme = item => {
|
|
44
|
+
this.props.onClickItem(item)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
renderItem = (item, i) => {
|
|
48
|
+
const { activeItemId } = this.props
|
|
49
|
+
const { theme } = this.props
|
|
50
|
+
const { name, id } = item
|
|
51
|
+
const cls = classnames(
|
|
52
|
+
'item-list-unit theme-item',
|
|
53
|
+
{
|
|
54
|
+
current: theme === id
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
active: activeItemId === id
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
let title = id === defaultTheme.id
|
|
61
|
+
? e(id)
|
|
62
|
+
: name
|
|
63
|
+
title = highlight(
|
|
64
|
+
title,
|
|
65
|
+
this.state.keyword
|
|
66
|
+
)
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
key={i + id}
|
|
70
|
+
className={cls}
|
|
71
|
+
onClick={() => this.onClickTheme(item)}
|
|
72
|
+
>
|
|
73
|
+
<div className='elli pd1y pd2x' title={name}>
|
|
74
|
+
{
|
|
75
|
+
!id
|
|
76
|
+
? <PlusOutlined className='mg1r' />
|
|
77
|
+
: null
|
|
78
|
+
}
|
|
79
|
+
{title}
|
|
80
|
+
</div>
|
|
81
|
+
{
|
|
82
|
+
id === defaultTheme.id
|
|
83
|
+
? null
|
|
84
|
+
: this.renderDelBtn(item)
|
|
85
|
+
}
|
|
86
|
+
{this.renderApplyBtn(item)}
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
filter = list => {
|
|
92
|
+
const { keyword, ready } = this.state
|
|
93
|
+
return keyword
|
|
94
|
+
? list.slice(0, ready ? list.length : 2).filter(item => {
|
|
95
|
+
return item.name.toLowerCase().includes(keyword.toLowerCase())
|
|
96
|
+
})
|
|
97
|
+
: list.slice(0, ready ? list.length : 2)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
paged = list => {
|
|
101
|
+
const { pageSize, ready, page } = this.state
|
|
102
|
+
if (!ready) {
|
|
103
|
+
return list
|
|
104
|
+
}
|
|
105
|
+
return list.slice((page - 1) * pageSize, pageSize * page)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
render () {
|
|
109
|
+
const { ready, page, pageSize } = this.state
|
|
110
|
+
let {
|
|
111
|
+
list = [],
|
|
112
|
+
type,
|
|
113
|
+
listStyle = {}
|
|
114
|
+
} = this.props
|
|
115
|
+
list = this.filter(list)
|
|
116
|
+
const all = list.length
|
|
117
|
+
list = this.paged(this.filter(list))
|
|
118
|
+
return (
|
|
119
|
+
<div className={`item-list item-type-${type}`}>
|
|
120
|
+
{this.renderTransport ? this.renderTransport() : null}
|
|
121
|
+
{this.renderLabels ? this.renderLabels() : null}
|
|
122
|
+
{this.renderSearch()}
|
|
123
|
+
<div className='item-list-wrap' style={listStyle}>
|
|
124
|
+
{
|
|
125
|
+
list.map(this.renderItem)
|
|
126
|
+
}
|
|
127
|
+
</div>
|
|
128
|
+
<Pagination
|
|
129
|
+
onChange={this.handlePager}
|
|
130
|
+
total={all}
|
|
131
|
+
current={page}
|
|
132
|
+
pageSize={pageSize}
|
|
133
|
+
/>
|
|
134
|
+
{
|
|
135
|
+
ready
|
|
136
|
+
? null
|
|
137
|
+
: (
|
|
138
|
+
<div className='pd3 aligncenter'>
|
|
139
|
+
<LoadingOutlined />
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
</div>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* default text editor for remote file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { useEffect } from 'react'
|
|
6
|
+
import { Input, Form, Button } from 'antd'
|
|
7
|
+
|
|
8
|
+
const FormItem = Form.Item
|
|
9
|
+
|
|
10
|
+
const { prefix } = window
|
|
11
|
+
const e = prefix('form')
|
|
12
|
+
const c = prefix('common')
|
|
13
|
+
const s = prefix('sftp')
|
|
14
|
+
|
|
15
|
+
export default function TextEditorForm (props) {
|
|
16
|
+
const [form] = Form.useForm()
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
form.resetFields()
|
|
20
|
+
}, [props.text])
|
|
21
|
+
|
|
22
|
+
function submit () {
|
|
23
|
+
form.submit()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function handleSubmit (res) {
|
|
27
|
+
props.submit(res)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function onPressEnter (e) {
|
|
31
|
+
e.stopPropagation()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function reset () {
|
|
35
|
+
form.resetFields()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
text,
|
|
40
|
+
loading
|
|
41
|
+
} = props
|
|
42
|
+
const popsEdit = {
|
|
43
|
+
type: 'primary',
|
|
44
|
+
className: 'mg3r mg1b',
|
|
45
|
+
disabled: loading,
|
|
46
|
+
onClick: props.editWith
|
|
47
|
+
}
|
|
48
|
+
const popsCancel = {
|
|
49
|
+
type: 'dashed',
|
|
50
|
+
onClick: props.cancel,
|
|
51
|
+
disabled: loading,
|
|
52
|
+
className: 'mg2r mg1b'
|
|
53
|
+
}
|
|
54
|
+
return (
|
|
55
|
+
<Form
|
|
56
|
+
onFinish={handleSubmit}
|
|
57
|
+
form={form}
|
|
58
|
+
name='text-edit-form'
|
|
59
|
+
layout='vertical'
|
|
60
|
+
initialValues={{ text }}
|
|
61
|
+
>
|
|
62
|
+
<FormItem
|
|
63
|
+
name='text'
|
|
64
|
+
>
|
|
65
|
+
<Input.TextArea
|
|
66
|
+
rows={20}
|
|
67
|
+
onPressEnter={onPressEnter}
|
|
68
|
+
>{text}
|
|
69
|
+
</Input.TextArea>
|
|
70
|
+
</FormItem>
|
|
71
|
+
<div className='pd1t pd2b'>
|
|
72
|
+
<Button
|
|
73
|
+
{...popsEdit}
|
|
74
|
+
>{s('editWithSystemEditor')}
|
|
75
|
+
</Button>
|
|
76
|
+
<Button
|
|
77
|
+
type='primary'
|
|
78
|
+
className='mg1r mg1b'
|
|
79
|
+
disabled={loading}
|
|
80
|
+
onClick={submit}
|
|
81
|
+
>{e('save')}
|
|
82
|
+
</Button>
|
|
83
|
+
<Button
|
|
84
|
+
type='dashed'
|
|
85
|
+
className='mg1r mg1b'
|
|
86
|
+
disabled={loading}
|
|
87
|
+
onClick={reset}
|
|
88
|
+
>{s('reset')}
|
|
89
|
+
</Button>
|
|
90
|
+
<Button
|
|
91
|
+
{...popsCancel}
|
|
92
|
+
>{c('cancel')}
|
|
93
|
+
</Button>
|
|
94
|
+
</div>
|
|
95
|
+
</Form>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* default text editor for remote file
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PureComponent } from 'react'
|
|
6
|
+
import TextEditorForm from './text-editor-form'
|
|
7
|
+
import { Spin, Modal } from 'antd'
|
|
8
|
+
import resolve from '../../common/resolve'
|
|
9
|
+
import { commonActions } from '../../common/constants'
|
|
10
|
+
import postMsg from '../../common/post-msg'
|
|
11
|
+
|
|
12
|
+
const { prefix } = window
|
|
13
|
+
const s = prefix('sftp')
|
|
14
|
+
|
|
15
|
+
export default class TextEditor extends PureComponent {
|
|
16
|
+
state = {
|
|
17
|
+
text: '',
|
|
18
|
+
path: 'loading...',
|
|
19
|
+
file: null,
|
|
20
|
+
id: '',
|
|
21
|
+
loading: true
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
componentDidMount () {
|
|
25
|
+
window.addEventListener('message', this.onEvent)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setStateProxy = (state, cb) => {
|
|
29
|
+
if (state && typeof state.file !== 'undefined') {
|
|
30
|
+
postMsg({
|
|
31
|
+
action: commonActions.updateStore,
|
|
32
|
+
value: !!state.file,
|
|
33
|
+
prop: 'showEditor'
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
return this.setState(state, cb)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onEvent = (e) => {
|
|
40
|
+
const {
|
|
41
|
+
action,
|
|
42
|
+
data
|
|
43
|
+
} = e.data || {}
|
|
44
|
+
if (
|
|
45
|
+
action === commonActions.openTextEditor && data
|
|
46
|
+
) {
|
|
47
|
+
this.setStateProxy(data)
|
|
48
|
+
if (data.id && data.file) {
|
|
49
|
+
this.fetchText(data)
|
|
50
|
+
} else if (data.id === '') {
|
|
51
|
+
this.cancel()
|
|
52
|
+
}
|
|
53
|
+
} else if (action === commonActions.loadTextEditorText) {
|
|
54
|
+
this.setStateProxy(data)
|
|
55
|
+
} else if (action === commonActions.editWithSystemEditorDone) {
|
|
56
|
+
let cb = this.doSubmit
|
|
57
|
+
if (data.text === this.state.text) {
|
|
58
|
+
delete data.text
|
|
59
|
+
cb = undefined
|
|
60
|
+
}
|
|
61
|
+
this.setStateProxy(data, cb)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
fetchText = async ({
|
|
66
|
+
id, file
|
|
67
|
+
}) => {
|
|
68
|
+
this.setStateProxy({
|
|
69
|
+
loading: true
|
|
70
|
+
})
|
|
71
|
+
const {
|
|
72
|
+
path,
|
|
73
|
+
name,
|
|
74
|
+
type
|
|
75
|
+
} = file
|
|
76
|
+
const p = resolve(path, name)
|
|
77
|
+
this.setStateProxy({
|
|
78
|
+
path: p
|
|
79
|
+
})
|
|
80
|
+
postMsg({
|
|
81
|
+
action: commonActions.fetchTextEditorText,
|
|
82
|
+
id,
|
|
83
|
+
path: p,
|
|
84
|
+
type
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
doSubmit = () => {
|
|
89
|
+
this.handleSubmit({
|
|
90
|
+
text: this.state.text
|
|
91
|
+
}, true)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
handleSubmit = async (res, force = false) => {
|
|
95
|
+
this.setStateProxy({
|
|
96
|
+
loading: true
|
|
97
|
+
})
|
|
98
|
+
if (!force && res.text === this.state.text) {
|
|
99
|
+
return this.cancel()
|
|
100
|
+
}
|
|
101
|
+
const {
|
|
102
|
+
path,
|
|
103
|
+
file,
|
|
104
|
+
id
|
|
105
|
+
} = this.state
|
|
106
|
+
const {
|
|
107
|
+
type,
|
|
108
|
+
mode
|
|
109
|
+
} = file
|
|
110
|
+
postMsg({
|
|
111
|
+
id,
|
|
112
|
+
path,
|
|
113
|
+
action: commonActions.submitTextEditorText,
|
|
114
|
+
text: res.text,
|
|
115
|
+
mode,
|
|
116
|
+
type,
|
|
117
|
+
noClose: force
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
editWith = () => {
|
|
122
|
+
this.setStateProxy({
|
|
123
|
+
loading: true
|
|
124
|
+
})
|
|
125
|
+
const {
|
|
126
|
+
id, text
|
|
127
|
+
} = this.state
|
|
128
|
+
postMsg({
|
|
129
|
+
action: commonActions.editWithSystemEditor,
|
|
130
|
+
id,
|
|
131
|
+
text
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
cancel = () => {
|
|
136
|
+
this.setStateProxy({
|
|
137
|
+
id: '',
|
|
138
|
+
file: null
|
|
139
|
+
})
|
|
140
|
+
postMsg({
|
|
141
|
+
action: commonActions.onCloseTextEditor
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
render () {
|
|
146
|
+
const {
|
|
147
|
+
file,
|
|
148
|
+
path,
|
|
149
|
+
loading,
|
|
150
|
+
text
|
|
151
|
+
} = this.state
|
|
152
|
+
if (!file) {
|
|
153
|
+
return null
|
|
154
|
+
}
|
|
155
|
+
const title = `${s('edit')} ${s('remote')} ${s('file')}: ${path}`
|
|
156
|
+
const propsAll = {
|
|
157
|
+
footer: null,
|
|
158
|
+
title,
|
|
159
|
+
maskClosable: false,
|
|
160
|
+
onCancel: this.cancel,
|
|
161
|
+
width: '90%',
|
|
162
|
+
open: true
|
|
163
|
+
}
|
|
164
|
+
const pops = {
|
|
165
|
+
submit: this.handleSubmit,
|
|
166
|
+
text,
|
|
167
|
+
cancel: this.cancel,
|
|
168
|
+
editWith: this.editWith
|
|
169
|
+
}
|
|
170
|
+
return (
|
|
171
|
+
<Modal
|
|
172
|
+
{...propsAll}
|
|
173
|
+
>
|
|
174
|
+
<Spin spinning={loading}>
|
|
175
|
+
<TextEditorForm
|
|
176
|
+
{...pops}
|
|
177
|
+
/>
|
|
178
|
+
</Spin>
|
|
179
|
+
</Modal>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
// .ant-switch-handle::before
|
|
3
|
+
// background #232340
|
|
4
|
+
// .ant-spin-container
|
|
5
|
+
// .ant-spin-nested-loading
|
|
6
|
+
// filter none
|
|
7
|
+
#container .ant-spin-blur
|
|
8
|
+
opacity 1 !important
|
|
9
|
+
.ant-tree-indent-unit
|
|
10
|
+
width 5px
|
|
11
|
+
.ant-tree .ant-tree-switcher.ant-tree-switcher-noop
|
|
12
|
+
width 18px
|
|
13
|
+
td.ant-table-column-sort
|
|
14
|
+
background none
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@require './includes'
|
|
2
|
+
@require './antd-overwrite'
|
|
3
|
+
@require './includes/theme-default'
|
|
4
|
+
|
|
5
|
+
html
|
|
6
|
+
background rgba(0,0,0,.01)
|
|
7
|
+
|
|
8
|
+
body
|
|
9
|
+
color main
|
|
10
|
+
overflow hidden
|
|
11
|
+
background alpha(main, .3)
|
|
12
|
+
font-size 12px
|
|
13
|
+
line-height 1.5715
|
|
14
|
+
font-family -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
|
|
15
|
+
font-variant: tabular-nums
|
|
16
|
+
|
|
17
|
+
::-webkit-scrollbar
|
|
18
|
+
background alpha(main, .5)
|
|
19
|
+
width 7px
|
|
20
|
+
|
|
21
|
+
.term-wrap:hover
|
|
22
|
+
::-webkit-scrollbar
|
|
23
|
+
width 12px
|
|
24
|
+
|
|
25
|
+
::-webkit-scrollbar-track
|
|
26
|
+
-webkit-box-shadow none
|
|
27
|
+
|
|
28
|
+
::-webkit-scrollbar-thumb
|
|
29
|
+
background-color primary
|
|
30
|
+
outline none
|
|
31
|
+
|
|
32
|
+
.common-err
|
|
33
|
+
max-height 100px
|
|
34
|
+
overflow-y scroll
|
|
35
|
+
overflow-x hidden
|
|
36
|
+
word-break break-all
|
|
37
|
+
.hide-resize-observer
|
|
38
|
+
display: none !important
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
|
|
2
|
+
for $i, $index in 5 16 32
|
|
3
|
+
|
|
4
|
+
//padding
|
|
5
|
+
.pd{$index+1}
|
|
6
|
+
padding ($i)px
|
|
7
|
+
|
|
8
|
+
.pd{$index+1}x
|
|
9
|
+
padding-left ($i)px
|
|
10
|
+
padding-right ($i)px
|
|
11
|
+
|
|
12
|
+
.pd{$index+1}l
|
|
13
|
+
padding-left ($i)px
|
|
14
|
+
|
|
15
|
+
.pd{$index+1}r
|
|
16
|
+
padding-right ($i)px
|
|
17
|
+
|
|
18
|
+
.pd{$index+1}y
|
|
19
|
+
padding-top ($i)px
|
|
20
|
+
padding-bottom ($i)px
|
|
21
|
+
|
|
22
|
+
.pd{$index+1}t
|
|
23
|
+
padding-top ($i)px
|
|
24
|
+
|
|
25
|
+
.pd{$index+1}b
|
|
26
|
+
padding-bottom ($i)px
|
|
27
|
+
|
|
28
|
+
//margin
|
|
29
|
+
.mg{$index+1}
|
|
30
|
+
margin ($i)px
|
|
31
|
+
|
|
32
|
+
.mg{$index+1}x
|
|
33
|
+
margin-left ($i)px
|
|
34
|
+
margin-right ($i)px
|
|
35
|
+
|
|
36
|
+
.mg{$index+1}l
|
|
37
|
+
margin-left ($i)px
|
|
38
|
+
|
|
39
|
+
.mg{$index+1}r
|
|
40
|
+
margin-right ($i)px
|
|
41
|
+
|
|
42
|
+
.mg{$index+1}y
|
|
43
|
+
margin-top ($i)px
|
|
44
|
+
margin-bottom ($i)px
|
|
45
|
+
|
|
46
|
+
.mg{$index+1}t
|
|
47
|
+
margin-top ($i)px
|
|
48
|
+
|
|
49
|
+
.mg{$index+1}b
|
|
50
|
+
margin-bottom ($i)px
|
|
51
|
+
|
|
52
|
+
.mg-auto
|
|
53
|
+
margin-left auto
|
|
54
|
+
margin-right auto
|
|
55
|
+
.mg0
|
|
56
|
+
margin 0
|
|
57
|
+
.pd0
|
|
58
|
+
padding 0
|
|
59
|
+
|
|
60
|
+
.block
|
|
61
|
+
display block
|
|
62
|
+
|
|
63
|
+
.inline
|
|
64
|
+
display inline-block
|
|
65
|
+
|
|
66
|
+
.iblock
|
|
67
|
+
display inline-block
|
|
68
|
+
vertical-align middle
|
|
69
|
+
|
|
70
|
+
.ibblock
|
|
71
|
+
display inline-block
|
|
72
|
+
vertical-align baseline
|
|
73
|
+
|
|
74
|
+
.itblock
|
|
75
|
+
display inline-block
|
|
76
|
+
vertical-align top
|
|
77
|
+
|
|
78
|
+
.border
|
|
79
|
+
border 1px solid #e4e4e4
|
|
80
|
+
|
|
81
|
+
.borderl
|
|
82
|
+
border-left 1px solid #e4e4e4
|
|
83
|
+
|
|
84
|
+
.borderr
|
|
85
|
+
border-right 1px solid #e4e4e4
|
|
86
|
+
|
|
87
|
+
.borderb
|
|
88
|
+
border-bottom 1px solid #e4e4e4
|
|
89
|
+
&.dashed
|
|
90
|
+
border-bottom 1px dashed #e4e4e4
|
|
91
|
+
|
|
92
|
+
.bordert
|
|
93
|
+
border-top 1px solid #e4e4e4
|
|
94
|
+
|
|
95
|
+
.borderr
|
|
96
|
+
border-right 1px solid #e4e4e4
|
|
97
|
+
|
|
98
|
+
.borderl
|
|
99
|
+
border-left 1px solid #e4e4e4
|
|
100
|
+
|
|
101
|
+
.border-dashed
|
|
102
|
+
border-style dashed
|
|
103
|
+
.border-dotted
|
|
104
|
+
border-style dotted
|
|
105
|
+
|
|
106
|
+
.hide,
|
|
107
|
+
.hide1,
|
|
108
|
+
.hide2
|
|
109
|
+
display none
|
|
110
|
+
|
|
111
|
+
.hidden
|
|
112
|
+
visibility hidden
|
|
113
|
+
|
|
114
|
+
.fleft
|
|
115
|
+
float left
|
|
116
|
+
|
|
117
|
+
.fright
|
|
118
|
+
float right
|
|
119
|
+
|
|
120
|
+
.fcenter
|
|
121
|
+
float center
|
|
122
|
+
|
|
123
|
+
.fix:before,
|
|
124
|
+
.fix:after
|
|
125
|
+
content " "
|
|
126
|
+
display table
|
|
127
|
+
|
|
128
|
+
.fix
|
|
129
|
+
&:after
|
|
130
|
+
clear both
|
|
131
|
+
|
|
132
|
+
.overhide
|
|
133
|
+
overflow hidden
|
|
134
|
+
|
|
135
|
+
.overscroll
|
|
136
|
+
overflow scroll
|
|
137
|
+
|
|
138
|
+
.overscroll-y
|
|
139
|
+
overflow-y scroll
|
|
140
|
+
|
|
141
|
+
.relative
|
|
142
|
+
position relative
|
|
143
|
+
.absolute
|
|
144
|
+
position absolute
|
|
145
|
+
.pointer
|
|
146
|
+
cursor pointer
|
|
147
|
+
.width-100
|
|
148
|
+
width 100%
|
|
149
|
+
.width-40
|
|
150
|
+
width 40%
|
|
151
|
+
.width-60
|
|
152
|
+
width 60%
|
|
153
|
+
.spin-90
|
|
154
|
+
transform rotate(90deg)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
.bold
|
|
3
|
+
font-weight bold
|
|
4
|
+
|
|
5
|
+
.em
|
|
6
|
+
font-style italic
|
|
7
|
+
|
|
8
|
+
.alignleft
|
|
9
|
+
text-align left
|
|
10
|
+
|
|
11
|
+
.alignright
|
|
12
|
+
text-align right
|
|
13
|
+
|
|
14
|
+
.aligncenter
|
|
15
|
+
text-align center
|
|
16
|
+
|
|
17
|
+
.indent
|
|
18
|
+
text-indent 2em
|
|
19
|
+
|
|
20
|
+
.wordbreak
|
|
21
|
+
word-break break-all
|
|
22
|
+
|
|
23
|
+
.elli
|
|
24
|
+
overflow hidden
|
|
25
|
+
white-space nowrap
|
|
26
|
+
text-overflow ellipsis
|
|
27
|
+
|
|
28
|
+
.under-line
|
|
29
|
+
text-decoration underline
|
|
30
|
+
&.dashed
|
|
31
|
+
text-decoration-style dashed
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
// Function to determine font color based on background color
|
|
3
|
+
contrastColor(color)
|
|
4
|
+
if (luminance(color) > 0.5)
|
|
5
|
+
return #000000 // Black font for bright colors
|
|
6
|
+
else
|
|
7
|
+
return #ffffff // White font for dark colors
|
|
8
|
+
|
|
9
|
+
main = #141314
|
|
10
|
+
main-dark = #000
|
|
11
|
+
main-light = #2E3338
|
|
12
|
+
text = #ddd
|
|
13
|
+
text-light = #fff
|
|
14
|
+
text-dark = #888
|
|
15
|
+
text-disabled = #777
|
|
16
|
+
primary = #08c
|
|
17
|
+
info = #FFD166
|
|
18
|
+
success = #06D6A0
|
|
19
|
+
error = #EF476F
|
|
20
|
+
warn = #E55934
|