Skip to content

Commit 5fd9866

Browse files
authored
Merge pull request #1 from BoostIO/master
update fork
2 parents 2d7a37c + ff7024e commit 5fd9866

File tree

14 files changed

+119
-97
lines changed

14 files changed

+119
-97
lines changed

browser/components/CodeEditor.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -83,37 +83,7 @@ export default class CodeEditor extends React.Component {
8383
'Cmd-T': function (cm) {
8484
// Do nothing
8585
},
86-
Enter: (cm) => {
87-
const cursor = cm.getCursor()
88-
const line = cm.getLine(cursor.line)
89-
let bulletType
90-
if (line.trim().startsWith('- ')) {
91-
bulletType = 1 // dash
92-
} else if (line.trim().startsWith('* ')) {
93-
bulletType = 2 // star
94-
} else if (line.trim().startsWith('+ ')) {
95-
bulletType = 3 // plus
96-
} else {
97-
bulletType = 0 // not a bullet
98-
}
99-
const numberedListRegex = /^(\d+)\. .+/
100-
const match = line.trim().match(numberedListRegex)
101-
if (bulletType !== 0 || match) {
102-
cm.execCommand('newlineAndIndent')
103-
const range = {line: cursor.line + 1, ch: cm.getLine(cursor.line + 1).length}
104-
if (match) {
105-
cm.replaceRange((parseInt(match[1]) + 1) + '. ', range)
106-
} else if (bulletType === 1) {
107-
cm.replaceRange('- ', range)
108-
} else if (bulletType === 2) {
109-
cm.replaceRange('* ', range)
110-
} else if (bulletType === 3) {
111-
cm.replaceRange('+ ', range)
112-
}
113-
} else {
114-
cm.execCommand('newlineAndIndent')
115-
}
116-
}
86+
Enter: 'newlineAndIndentContinueMarkdownList'
11787
}
11888
})
11989

browser/components/MarkdownEditor.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class MarkdownEditor extends React.Component {
1111

1212
this.escapeFromEditor = ['Control', 'w']
1313

14-
this.supportMdWordBold = ['Control', ':']
14+
this.supportMdSelectionBold = ['Control', ':']
1515

1616
this.state = {
1717
status: 'PREVIEW',
@@ -169,19 +169,26 @@ class MarkdownEditor extends React.Component {
169169
if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) {
170170
document.activeElement.blur()
171171
}
172-
if (this.supportMdWordBold.every(isNoteHandlerKey)) {
173-
this.addMdBetweenWord('**')
172+
if (this.supportMdSelectionBold.every(isNoteHandlerKey)) {
173+
this.addMdAroundWord('**')
174174
}
175175
}
176176

177-
addMdBetweenWord (mdElement) {
177+
addMdAroundWord (mdElement) {
178+
if (this.refs.code.editor.getSelection()) {
179+
return this.addMdAroundSelection(mdElement)
180+
}
178181
const currentCaret = this.refs.code.editor.getCursor()
179182
const word = this.refs.code.editor.findWordAt(currentCaret)
180183
const cmDoc = this.refs.code.editor.getDoc()
181184
cmDoc.replaceRange(mdElement, word.anchor)
182185
cmDoc.replaceRange(mdElement, { line: word.head.line, ch: word.head.ch + mdElement.length })
183186
}
184187

188+
addMdAroundSelection (mdElement) {
189+
this.refs.code.editor.replaceSelection(`${mdElement}${this.refs.code.editor.getSelection()}${mdElement}`)
190+
}
191+
185192
handleKeyUp (e) {
186193
const keyPressed = Object.assign(this.state.keyPressed, {
187194
[e.key]: false

browser/components/SideNavFilter.styl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
color #e74c3c
2222
.menu-button-label
2323
color $ui-text-color
24+
&:active, &:active:hover
25+
background-color $ui-button--active-backgroundColor
26+
color #e74c3c
27+
.menu-button-label
28+
color $ui-text-color
2429

2530
.menu-button-star--active
2631
@extend .menu-button
@@ -33,6 +38,11 @@
3338
color #F9BF3B
3439
.menu-button-label
3540
color $ui-text-color
41+
&:active, &:active:hover
42+
background-color $ui-button--active-backgroundColor
43+
color #F9BF3B
44+
.menu-button-label
45+
color $ui-text-color
3646

3747
.menu-button-label
3848
margin-left 5px

browser/components/SnippetTab.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class SnippetTab extends React.Component {
9696
{!this.state.isRenaming
9797
? <button styleName='button'
9898
onClick={(e) => this.handleClick(e)}
99+
onDoubleClick={(e) => this.handleRenameClick(e)}
99100
onContextMenu={(e) => this.handleContextMenu(e)}
100101
>
101102
{snippet.name.trim().length > 0

browser/components/StorageItem.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
padding 0 15px
3939
height 26px
4040
line-height 26px
41-
border-width 0 0 0 1px
41+
border-width 0 0 0 2px
4242
border-style solid
4343
border-color transparent
4444
overflow hidden

browser/main/Detail/FolderSelect.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
background-color $ui-button--active-backgroundColor
8282
color $ui-button--active-color
8383
.search-optionList-item-name
84-
border-left solid 4px transparent
84+
border-left solid 2px transparent
8585
padding 2px 5px
8686
.search-optionList-item-name-surfix
8787
font-size 10px

browser/main/modals/InitModal.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ class InitModal extends React.Component {
4141
}
4242
}
4343

44-
handleCloseButtonClick (e) {
45-
this.props.close()
46-
}
47-
4844
handlePathChange (e) {
4945
this.setState({
5046
path: e.target.value
@@ -187,12 +183,6 @@ class InitModal extends React.Component {
187183
})
188184
}
189185

190-
handleKeyDown (e) {
191-
if (e.keyCode === 27) {
192-
this.props.close()
193-
}
194-
}
195-
196186
render () {
197187
if (this.state.isLoading) {
198188
return <div styleName='root--loading'>
@@ -209,9 +199,6 @@ class InitModal extends React.Component {
209199
<div styleName='header'>
210200
<div styleName='header-title'>Initialize Storage</div>
211201
</div>
212-
<button styleName='closeButton'
213-
onClick={(e) => this.handleCloseButtonClick(e)}
214-
>Close</button>
215202
<div styleName='body'>
216203
<div styleName='body-welcome'>
217204
Welcome!

browser/main/modals/PreferencesModal/ConfigTab.styl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,17 @@
104104
margin-left: 10px
105105
font-size: 12px
106106

107+
.code-mirror
108+
width 400px
109+
height 120px
110+
margin 5px 0
111+
font-size 12px
112+
107113
colorDarkControl()
108114
border-color $ui-dark-borderColor
109115
background-color $ui-dark-backgroundColor
110116
color $ui-dark-text-color
117+
111118
body[data-theme="dark"]
112119
.root
113120
color $ui-dark-text-color

browser/main/modals/PreferencesModal/HotkeyTab.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class HotkeyTab extends React.Component {
139139
<li><code>VolumeUp</code>, <code>VolumeDown</code> and <code>VolumeMute</code></li>
140140
<li><code>MediaNextTrack</code>, <code>MediaPreviousTrack</code>, <code>MediaStop</code> and <code>MediaPlayPause</code></li>
141141
<li><code>Control</code> (or <code>Ctrl</code> for short)</li>
142+
<li><code>Shift</code></li>
142143
</ul>
143144
</div>
144145
}

browser/main/modals/PreferencesModal/StorageItem.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
background-color darken(white, 3%)
7272
.folderList-item-left
7373
height 30px
74-
border-left solid 1px transparent
74+
border-left solid 2px transparent
7575
padding 0 10px
7676
line-height 30px
7777
float left

0 commit comments

Comments
 (0)