Skip to content

Commit 7e58734

Browse files
author
春秋一语
authored
Merge pull request #18 from Coding/tencent
Tencent
2 parents 84491ce + 5a755a2 commit 7e58734

File tree

16 files changed

+143
-24
lines changed

16 files changed

+143
-24
lines changed

app/commands/commandBindings/editor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ export default {
2222
Pane.split(4, 'row')
2323
}
2424
}
25-

app/commands/keymaps.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if (isMac) {
2222
'cmd+alt+4': 'editor:split_pane_vertical_4',
2323
'cmd+,': 'global:show_settings',
2424
'ctrl+g': 'editor:goto',
25-
'alt+l': 'edit:toggle_format',
25+
'alt+l': 'edit:toggle_format_monaco',
2626
'cmd+/': 'edit:toggle_comment',
2727
'cmd+f11': 'tab:zenmode',
2828
}
@@ -50,7 +50,7 @@ if (isMac) {
5050
'ctrl+alt+4': 'editor:split_pane_vertical_4',
5151
'alt+,': 'global:show_settings',
5252
'ctrl+g': 'editor:goto',
53-
'alt+l': 'edit:toggle_format',
53+
'alt+l': 'edit:toggle_format_monaco',
5454
'ctrl+/': 'edit:toggle_comment',
5555
'ctrl+f11': 'tab:zenmode',
5656
}

app/components/Editor/components/MarkdownEditor/index.jsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types'
33
import { autorun, extendObservable, observable, autorunAsync } from 'mobx'
44
import debounce from 'lodash/debounce'
55
import cx from 'classnames'
6-
import marked from 'marked'
76
import Remarkable from 'remarkable'
87
import { observer } from 'mobx-react'
98
import CodeEditor from '../CodeEditor'
@@ -69,13 +68,6 @@ md.renderer.rules.heading_open = (tokens, idx) => {
6968
return '<h' + tokens[idx].hLevel + '>'
7069
}
7170

72-
marked.setOptions({
73-
highlight: (code) => {
74-
require('highlight.js/styles/github-gist.css')
75-
return require('highlight.js').highlightAuto(code).value
76-
},
77-
})
78-
7971
@observer
8072
class PreviewEditor extends Component {
8173
constructor (props) {
@@ -142,7 +134,7 @@ class MarkdownEditor extends Component {
142134
showPreview: true,
143135
})
144136
}
145-
137+
146138
this.state = observable({
147139
previewContent: '',
148140
tokens: []

app/components/Editor/components/MarkdownEditor/mdMixin.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import state from './state'
22
// import findByTextContent from './utils'
33
import debounce from 'lodash/debounce'
4-
import marked from 'marked'
54
import animatedScrollTo from 'animated-scrollto'
65

76
const buildScrollMap = (previewDOM) => {

app/components/Git/actions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export function commit () {
2323
files: stagedFilesPathList,
2424
message: GitState.commitMessage || initialCommitMessage,
2525
}).then((filetreeDelta) => {
26+
if (filetreeDelta.code) {
27+
notify({ notifyType: NOTIFY_TYPE.ERROR, message: filetreeDelta.msg });
28+
return;
29+
}
2630
dispatch(updateCommitMessage(''))
2731
notify({ message: i18n`git.action.commitSuccess` })
2832
dismissModal()

app/components/Setting/KeymapSetting.jsx

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1-
import React, { Component } from 'react'
1+
import React from 'react'
22
import { observer } from 'mobx-react'
33
import i18n from 'utils/createI18n'
44
import FormInputGroup from './FormInputGroup'
55

6+
const keymaps = [
7+
{ id: 0, cmd: i18n`settings.keymap.createFile`, mac: ['alt', 'n'], win: ['alt', 'n'] },
8+
{ id: 1, cmd: i18n`settings.keymap.createFolder`, mac: ['alt', 'shift', 'n'], win: ['alt', 'shift', 'n'] },
9+
{ id: 2, cmd: i18n`settings.keymap.saveFile`, mac: ['cmd', 's'], win: ['ctrl', 's'] },
10+
{ id: 3, cmd: i18n`settings.keymap.gitCommit`, mac: ['cmd', 'ctrl', 'c'], win: ['ctrl', 'alt', 'c'] },
11+
{ id: 4, cmd: i18n`settings.keymap.exitModal`, mac: ['esc'], win: ['esc'] },
12+
{ id: 5, cmd: i18n`settings.keymap.commandPalette`, mac: ['cmd', 'shift', 'p'], win: ['ctrl', 'shift', 'p'] },
13+
{ id: 6, cmd: i18n`settings.keymap.filePalette`, mac: ['cmd', 'p'], win: ['ctrl', 'p'] },
14+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', '1'], win: ['ctrl', 'alt', '1'] },
15+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', 'shift', '1'], win: ['ctrl', 'alt', 'shift', '1'] },
16+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', '2'], win: ['ctrl', 'alt', '2'] },
17+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', 'shift', '2'], win: ['ctrl', 'alt', 'shift', '2'] },
18+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', '3'], win: ['ctrl', 'alt', '3'] },
19+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', 'shift', '3'], win: ['ctrl', 'alt', 'shift', '3'] },
20+
// { cmd: i18n`tab.contextMenu.horizontalSplit`, mac: ['cmd', 'alt', '4'], win: ['ctrl', 'alt', '4'] },
21+
{ id: 7, cmd: i18n`settings.keymap.showSettings`, mac: ['cmd', ','], win: ['ctrl', ','] },
22+
{ id: 8, cmd: i18n`file.goto`, mac: ['ctrl', 'g'], win: ['ctrl', 'g'] },
23+
{ id: 9, cmd: i18n`settings.keymap.toggleFormat`, mac: ['alt', 'l'], win: ['alt', 'l'] },
24+
{ id: 10, cmd: i18n`settings.keymap.toggleComment`, mac: ['cmd', '/'], win: ['ctrl', '/'] },
25+
{ id: 11, cmd: i18n`settings.keymap.into_zenmode`, mac: ['cmd', 'f11'], win: ['ctrl', 'f11'] },
26+
{ id: 12, cmd: i18n`settings.keymap.exit_zenmode`, mac: ['esc'], win: ['esc'] },
27+
]
28+
629
export default observer(({ content }) => (
730
<div>
831
<h2 className='settings-content-header'>{i18n`settings.keymap.main`}</h2>
@@ -13,6 +36,30 @@ export default observer(({ content }) => (
1336
settingItem={settingItem}
1437
/>
1538
)}
39+
<table className="keymap-list">
40+
<thead>
41+
<tr>
42+
<th>{i18n`settings.keymap.command`}</th>
43+
<th>Mac {i18n`settings.keymap.keymap`}</th>
44+
<th>Win {i18n`settings.keymap.keymap`}</th>
45+
</tr>
46+
</thead>
47+
<tbody>
48+
{
49+
keymaps.map(keymap => <Row key={keymap.id} {...keymap} />)
50+
}
51+
</tbody>
52+
</table>
1653
</div>
1754
</div>
1855
))
56+
57+
const Row = ({ cmd, mac, win }) => {
58+
return (
59+
<tr>
60+
<td>{cmd}</td>
61+
<td>{mac.map(key => <span className="key" key={key}>{key}</span>)}</td>
62+
<td>{win.map(key => <span className="key" key={key}>{key}</span>)}</td>
63+
</tr>
64+
);
65+
}

app/components/Tab/Changelog.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import React, { Component } from 'react'
2-
import marked from 'marked'
2+
import Remarkable from 'remarkable'
33
import md from '../../../static/changelog/changelog.md'
44

55
const style = {
66
textAlign: 'left',
77
marginTop: '2em'
88
}
99

10+
const remarkable = new Remarkable('full', {
11+
html: true,
12+
xhtmlOut: false,
13+
breaks: false,
14+
langPrefix: 'language-',
15+
linkify: true,
16+
linkTarget: '_blank',
17+
typographer: false,
18+
quotes: '“”‘’',
19+
})
20+
1021
const Changelog = () => (
11-
<div dangerouslySetInnerHTML={{ __html: marked(md) }}
22+
<div dangerouslySetInnerHTML={{ __html: remarkable.render(md) }}
1223
className='welcome-page' style={style}
1324
>
1425
</div>

app/i18n/en_US/file.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"uploadSucceed": "Upload succeed",
2222
"uploadFailed": "Upload failed",
2323
"preparingDownload": "Preparing files..."
24-
}
24+
}

app/i18n/en_US/settings.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,27 @@
3131
},
3232
"keymap": {
3333
"main": "Keymap Setting",
34-
"keyboardMode": "Editor Keyboard Mode"
34+
"keymap": "Keymap",
35+
"keyboardMode": "Editor Keyboard Mode",
36+
"command": "Command",
37+
"createFile": "Create File",
38+
"createFolder": "Create Folder",
39+
"saveFile": "Save File",
40+
"commandPalette": "Command Palette",
41+
"filePalette": "File Palette",
42+
"showSettings": "Show Settings Modal",
43+
"exitModal": "Exit Modal",
44+
"gitCommit": "Git Commit",
45+
"toggleFormat": "Code Format",
46+
"toggleComment": "Toggle Comment",
47+
"into_zenmode": "Into Zen Mode",
48+
"exit_zenmode": "Exit Zen Mode"
3549
},
3650
"appearance": {
3751
"main": "Appearance Setting",
3852
"uiTheme": "UI theme",
3953
"uiThemeOption": {
40-
"baseTheme": "Default",
54+
"baseTheme": "White",
4155
"dark": "Dark"
4256
},
4357
"syntaxTheme": "Syntax Theme",

app/i18n/en_US/tab.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"verticalSplit": "Vertical Split",
1212
"horizontalSplit": "Horizontal Split"
1313
}
14-
}
14+
}

app/i18n/zh_CN/file.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"uploadSucceed": "上传完成",
2222
"uploadFailed": "上传失败",
2323
"preparingDownload": "正在准备下载文件..."
24-
}
24+
}

app/i18n/zh_CN/settings.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,27 @@
3030
},
3131
"keymap": {
3232
"main": "快捷键",
33-
"keyboardMode": "编辑器键盘模式"
33+
"keymap": "快捷键",
34+
"keyboardMode": "编辑器键盘模式",
35+
"command": "命令",
36+
"createFile": "新建文件",
37+
"createFolder": "新建文件夹",
38+
"saveFile": "保存文件",
39+
"commandPalette": "命令调色板",
40+
"filePalette": "文件调色板",
41+
"showSettings": "调出设置面板",
42+
"exitModal": "退出模态框",
43+
"gitCommit": "Git 提交",
44+
"toggleFormat": "代码格式化",
45+
"toggleComment": "切换注释",
46+
"into_zenmode": "进入禅模式",
47+
"exit_zenmode": "退出禅模式"
3448
},
3549
"appearance": {
3650
"main": "样式",
3751
"uiTheme": "UI 主题",
3852
"uiThemeOption": {
39-
"baseTheme": "默认",
53+
"baseTheme": "白色",
4054
"dark": "黑色"
4155
},
4256
"syntaxTheme": "代码着色",

app/i18n/zh_CN/tab.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"verticalSplit": "垂直切分",
1212
"horizontalSplit": "水平切分"
1313
}
14-
}
14+
}

app/styles/core-ui/Settings.styl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,27 @@
5858
padding: 0 $padding-lr 10px;
5959
flex-grow: 1;
6060
overflow: auto;
61+
table {
62+
width: 100%;
63+
tr {
64+
height: 30px;
65+
td {
66+
padding: 0 10px;
67+
}
68+
.key {
69+
padding: 2px 6px;
70+
margin: 0 4px;
71+
border-radius: 2px;
72+
color: #333;
73+
background-color: #d6d6d6;
74+
}
75+
}
76+
tbody {
77+
tr:nth-child(odd) {
78+
background-color: #f6f6f6;
79+
}
80+
}
81+
}
6182
}
6283
.settings-content-controls {
6384
flex-grow: 0;

app/styles/dark/index.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
@import './styles/mask';
1818
@import './styles/git-merge';
1919
@import './styles/diff';
20+
@import './styles/settings';
2021

2122
// 插件用样式
2223
@import './styles/weapp';

app/styles/dark/styles/settings.styl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.settings-content {
2+
.settings-content-container {
3+
table {
4+
tr {
5+
.key {
6+
color: #fff;
7+
background-color: #666;
8+
}
9+
}
10+
tbody {
11+
tr:nth-child(odd) {
12+
background-color: #444;
13+
}
14+
}
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)