Skip to content

Commit a287afb

Browse files
committed
Merge branch 'master' into text-deflist
2 parents f57c4f3 + fdfa3bb commit a287afb

File tree

15 files changed

+99
-27
lines changed

15 files changed

+99
-27
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Space indentation
7+
[*]
8+
indent_style = space
9+
indent_size = 2
10+
trim_trailing_whitespace = true
11+
12+
# The indent size used in the `package.json` file cannot be changed
13+
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
14+
[{*.yml,*.yaml,package.json}]
15+
indent_style = space
16+
indent_size = 2

browser/components/CodeEditor.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default class CodeEditor extends React.Component {
2424
constructor (props) {
2525
super(props)
2626

27-
this.state = { isReady: false }
2827
this.scrollHandler = _.debounce(this.handleScroll.bind(this), 100, {
2928
leading: false,
3029
trailing: true
@@ -215,7 +214,7 @@ export default class CodeEditor extends React.Component {
215214
CodeMirror.Vim.defineEx('wq', 'wq', this.quitEditor)
216215
CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor)
217216
CodeMirror.Vim.map('ZZ', ':q', 'normal')
218-
this.setState({ isReady: true })
217+
219218
this.tableEditor = new TableEditor(new TextEditorInterface(this.editor))
220219
eventEmitter.on('code:format-table', this.formatTable)
221220
}
@@ -582,8 +581,7 @@ export default class CodeEditor extends React.Component {
582581
style={{
583582
fontFamily,
584583
fontSize: fontSize,
585-
width: width,
586-
opacity: this.state.isReady ? '1' : '0'
584+
width: width
587585
}}
588586
onDrop={e => this.handleDropImage(e)}
589587
/>

browser/components/MarkdownEditor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import CodeEditor from 'browser/components/CodeEditor'
66
import MarkdownPreview from 'browser/components/MarkdownPreview'
77
import eventEmitter from 'browser/main/lib/eventEmitter'
88
import { findStorage } from 'browser/lib/findStorage'
9-
import debounceRender from 'react-debounce-render'
109

1110
class MarkdownEditor extends React.Component {
1211
constructor (props) {
@@ -313,4 +312,4 @@ MarkdownEditor.propTypes = {
313312
ignorePreviewPointerEvents: PropTypes.bool
314313
}
315314

316-
export default debounceRender(CSSModules(MarkdownEditor, styles))
315+
export default CSSModules(MarkdownEditor, styles)

browser/components/MarkdownPreview.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ const defaultCodeBlockFontFamily = [
180180
export default class MarkdownPreview extends React.Component {
181181
constructor (props) {
182182
super(props)
183-
this.state = {
184-
isReady: false
185-
}
183+
186184
this.contextMenuHandler = e => this.handleContextMenu(e)
187185
this.mouseDownHandler = e => this.handleMouseDown(e)
188186
this.mouseUpHandler = e => this.handleMouseUp(e)
@@ -457,7 +455,6 @@ export default class MarkdownPreview extends React.Component {
457455
eventEmitter.on('export:save-md', this.saveAsMdHandler)
458456
eventEmitter.on('export:save-html', this.saveAsHtmlHandler)
459457
eventEmitter.on('print', this.printHandler)
460-
setTimeout(() => this.setState({ isReady: true }))
461458
}
462459

463460
componentWillUnmount () {
@@ -850,11 +847,7 @@ export default class MarkdownPreview extends React.Component {
850847
className={
851848
className != null ? 'MarkdownPreview ' + className : 'MarkdownPreview'
852849
}
853-
style={
854-
this.state.isReady
855-
? Object.assign(style, { opacity: '1' })
856-
: Object.assign(style, { opacity: '0' })
857-
}
850+
style={style}
858851
tabIndex={tabIndex}
859852
ref='root'
860853
/>

browser/components/SnippetTab.styl

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,48 @@ body[data-theme="solarized-dark"]
136136
color $ui-solarized-dark-text-color
137137

138138
.deleteButton
139-
color alpha($ui-solarized-dark-text-color, 30%)
139+
color alpha($ui-solarized-dark-text-color, 30%)
140+
141+
body[data-theme="monokai"]
142+
.root
143+
color $ui-monokai-text-color
144+
border-color $ui-dark-borderColor
145+
&:hover
146+
background-color $ui-monokai-noteDetail-backgroundColor
147+
.deleteButton
148+
color $ui-monokai-text-color
149+
&:hover
150+
background-color darken($ui-monokai-noteDetail-backgroundColor, 15%)
151+
&:active
152+
color $ui-monokai-text-color
153+
background-color $ui-dark-button--active-backgroundColor
154+
155+
.root--active
156+
color $ui-monokai-text-color
157+
border-color $ui-monokai-borderColor
158+
&:hover
159+
background-color $ui-monokai-noteDetail-backgroundColor
160+
.deleteButton
161+
color $ui-monokai-text-color
162+
&:hover
163+
background-color darken($ui-monokai-noteDetail-backgroundColor, 15%)
164+
&:active
165+
color $ui-monokai-text-color
166+
background-color $ui-dark-button--active-backgroundColor
167+
168+
.button
169+
border none
170+
color $ui-monokai-text-color
171+
background-color transparent
172+
transition color background-color 0.15s
173+
border-left 4px solid transparent
174+
&:hover
175+
color $ui-monokai-text-color
176+
background-color $ui-monokai-noteDetail-backgroundColor
177+
178+
.input
179+
background-color $ui-monokai-noteDetail-backgroundColor
180+
color $ui-monokai-text-color
181+
182+
.deleteButton
183+
color alpha($ui-monokai-text-color, 30%)

browser/components/markdown.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ table
257257
display block
258258
width 100%
259259
margin 0 0 1em
260+
overflow-x auto
260261
thead
261262
tr
262263
background-color tableHeadBgColor

browser/main/Detail/SnippetNoteDetail.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,12 @@ class SnippetNoteDetail extends React.Component {
573573
}
574574

575575
addSnippet () {
576+
const { config } = this.props
576577
const { note } = this.state
577578

578579
note.snippets = note.snippets.concat([{
579580
name: '',
580-
mode: 'Plain Text',
581+
mode: config.editor.snippetDefaultLanguage || 'text',
581582
content: ''
582583
}])
583584
const snippetIndex = note.snippets.length - 1

browser/main/NewNoteButton/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ class NewNoteButton extends React.Component {
3434
}
3535

3636
handleNewNoteButtonClick (e) {
37-
const { location, dispatch } = this.props
37+
const { location, dispatch, config } = this.props
3838
const { storage, folder } = this.resolveTargetFolder()
3939

4040
modal.open(NewNoteModal, {
4141
storage: storage.key,
4242
folder: folder.key,
4343
dispatch,
44-
location
44+
location,
45+
config
4546
})
4647
}
4748

browser/main/modals/NewNoteModal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class NewNoteModal extends React.Component {
6161
handleSnippetNoteButtonClick (e) {
6262
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_SNIPPET')
6363
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_ALLNOTE')
64-
const { storage, folder, dispatch, location } = this.props
64+
const { storage, folder, dispatch, location, config } = this.props
6565

6666
dataApi
6767
.createNote(storage, {
@@ -72,7 +72,7 @@ class NewNoteModal extends React.Component {
7272
snippets: [
7373
{
7474
name: '',
75-
mode: 'text',
75+
mode: config.editor.snippetDefaultLanguage || 'text',
7676
content: ''
7777
}
7878
]

browser/main/modals/PreferencesModal/ConfigTab.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
line-height 30px
2525

2626
.group-section-label
27-
width 150px
27+
width 200px
2828
text-align left
2929
margin-right 10px
3030
font-size 14px

0 commit comments

Comments
 (0)