Skip to content

Commit ae9e83c

Browse files
committed
Merge branch 'master' into bug-1992
2 parents bacbfc8 + ff30266 commit ae9e83c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1506
-301
lines changed

ISSUE_TEMPLATE.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
# Current behavior
22

33
<!--
4-
Please paste some **screenshots** with the **developer tool** open (console tab) when you report a bug.
4+
Let us know what is currently happening.
55
6-
If your issue is regarding boostnote mobile, move to https://github.com/BoostIO/boostnote-mobile.
6+
Please include some **screenshots** with the **developer tools** open (console tab) when you report a bug.
7+
8+
If your issue is regarding Boostnote mobile, please open an issue in the Boostnote Mobile repo 👉 https://github.com/BoostIO/boostnote-mobile.
79
-->
810

911
# Expected behavior
1012

13+
<!--
14+
Let us know what you think should happen!
15+
-->
16+
1117
# Steps to reproduce
1218

19+
<!--
20+
Please be thorough, issues we can reproduce are easier to fix!
21+
-->
22+
1323
1.
1424
2.
1525
3.

browser/components/CodeEditor.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ export default class CodeEditor extends React.Component {
292292
this.editor.on('cursorActivity', this.editorActivityHandler)
293293
this.editor.on('changes', this.editorActivityHandler)
294294
}
295+
296+
this.setState({
297+
clientWidth: this.refs.root.clientWidth
298+
})
295299
}
296300

297301
expandSnippet (line, cursor, cm, snippets) {
@@ -441,6 +445,14 @@ export default class CodeEditor extends React.Component {
441445
this.editor.setOption('extraKeys', this.defaultKeyMap)
442446
}
443447

448+
if (this.state.clientWidth !== this.refs.root.clientWidth) {
449+
this.setState({
450+
clientWidth: this.refs.root.clientWidth
451+
})
452+
453+
needRefresh = true
454+
}
455+
444456
if (needRefresh) {
445457
this.editor.refresh()
446458
}

browser/components/MarkdownEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class MarkdownEditor extends React.Component {
250250
: 'codeEditor--hide'
251251
}
252252
ref='code'
253-
mode='GitHub Flavored Markdown'
253+
mode='Boost Flavored Markdown'
254254
value={value}
255255
theme={config.editor.theme}
256256
keyMap={config.editor.keyMap}

browser/components/MarkdownEditor.styl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
.preview
1717
display block
1818
absolute top bottom left right
19-
z-index 100
2019
background-color white
2120
height 100%
2221
width 100%

browser/components/MarkdownPreview.js

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ import copy from 'copy-to-clipboard'
1717
import mdurl from 'mdurl'
1818
import exportNote from 'browser/main/lib/dataApi/exportNote'
1919
import { escapeHtmlCharacters } from 'browser/lib/utils'
20+
import context from 'browser/lib/context'
21+
import i18n from 'browser/lib/i18n'
22+
import fs from 'fs'
2023

21-
const { remote } = require('electron')
24+
const { remote, shell } = require('electron')
2225
const attachmentManagement = require('../main/lib/dataApi/attachmentManagement')
2326

2427
const { app } = remote
@@ -27,6 +30,8 @@ const fileUrl = require('file-url')
2730

2831
const dialog = remote.dialog
2932

33+
const uri2path = require('file-uri-to-path')
34+
3035
const markdownStyle = require('!!css!stylus?sourceMap!./markdown.styl')[0][1]
3136
const appPath = fileUrl(
3237
process.env.NODE_ENV === 'production' ? app.getAppPath() : path.resolve()
@@ -161,7 +166,6 @@ const scrollBarDarkStyle = `
161166
}
162167
`
163168

164-
const { shell } = require('electron')
165169
const OSX = global.process.platform === 'darwin'
166170

167171
const defaultFontFamily = ['helvetica', 'arial', 'sans-serif']
@@ -219,8 +223,32 @@ export default class MarkdownPreview extends React.Component {
219223
}
220224
}
221225

222-
handleContextMenu (e) {
223-
this.props.onContextMenu(e)
226+
handleContextMenu (event) {
227+
// If a contextMenu handler was passed to us, use it instead of the self-defined one -> return
228+
if (_.isFunction(this.props.onContextMenu)) {
229+
this.props.onContextMenu(event)
230+
return
231+
}
232+
// No contextMenu was passed to us -> execute our own link-opener
233+
if (event.target.tagName.toLowerCase() === 'a') {
234+
const href = event.target.href
235+
const isLocalFile = href.startsWith('file:')
236+
if (isLocalFile) {
237+
const absPath = uri2path(href)
238+
try {
239+
if (fs.lstatSync(absPath).isFile()) {
240+
context.popup([
241+
{
242+
label: i18n.__('Show in explorer'),
243+
click: (e) => shell.showItemInFolder(absPath)
244+
}
245+
])
246+
}
247+
} catch (e) {
248+
console.log('Error while evaluating if the file is locally available', e)
249+
}
250+
}
251+
}
224252
}
225253

226254
handleDoubleClick (e) {
@@ -397,6 +425,7 @@ export default class MarkdownPreview extends React.Component {
397425
case 'dark':
398426
case 'solarized-dark':
399427
case 'monokai':
428+
case 'dracula':
400429
return scrollBarDarkStyle
401430
default:
402431
return scrollBarStyle
@@ -455,6 +484,10 @@ export default class MarkdownPreview extends React.Component {
455484
eventEmitter.on('export:save-md', this.saveAsMdHandler)
456485
eventEmitter.on('export:save-html', this.saveAsHtmlHandler)
457486
eventEmitter.on('print', this.printHandler)
487+
eventEmitter.on('config-renew', () => {
488+
this.markdown.updateConfig()
489+
this.rewriteIframe()
490+
})
458491
}
459492

460493
componentWillUnmount () {

browser/components/MarkdownSplitEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class MarkdownSplitEditor extends React.Component {
145145
styleName='codeEditor'
146146
ref='code'
147147
width={this.state.codeEditorWidthInPercent + '%'}
148-
mode='GitHub Flavored Markdown'
148+
mode='Boost Flavored Markdown'
149149
value={value}
150150
theme={config.editor.theme}
151151
keyMap={config.editor.keyMap}

browser/components/NoteItem.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,22 @@ const NoteItem = ({
7474
? note.title
7575
: <span styleName='item-title-empty'>{i18n.__('Empty note')}</span>}
7676
</div>
77-
{['ALL', 'STORAGE'].includes(viewType) &&
78-
<div styleName='item-middle'>
79-
<div styleName='item-middle-time'>{dateDisplay}</div>
80-
<div styleName='item-middle-app-meta'>
81-
<div
82-
title={
83-
viewType === 'ALL'
84-
? storageName
85-
: viewType === 'STORAGE' ? folderName : null
86-
}
87-
styleName='item-middle-app-meta-label'
88-
>
89-
{viewType === 'ALL' && storageName}
90-
{viewType === 'STORAGE' && folderName}
91-
</div>
77+
<div styleName='item-middle'>
78+
<div styleName='item-middle-time'>{dateDisplay}</div>
79+
<div styleName='item-middle-app-meta'>
80+
<div
81+
title={
82+
viewType === 'ALL'
83+
? storageName
84+
: viewType === 'STORAGE' ? folderName : null
85+
}
86+
styleName='item-middle-app-meta-label'
87+
>
88+
{viewType === 'ALL' && storageName}
89+
{viewType === 'STORAGE' && folderName}
9290
</div>
93-
</div>}
94-
91+
</div>
92+
</div>
9593
<div styleName='item-bottom'>
9694
<div styleName='item-bottom-tagList'>
9795
{note.tags.length > 0

browser/components/NoteItem.styl

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,13 @@ body[data-theme="monokai"]
368368
.item-title
369369
.item-title-icon
370370
.item-bottom-time
371-
color $ui-monokai-text-color
371+
color $ui-monokai-active-color
372372
.item-bottom-tagList-item
373373
background-color alpha(white, 10%)
374374
color $ui-monokai-text-color
375375
&:hover
376376
// background-color alpha($ui-monokai-button--active-backgroundColor, 60%)
377-
color #c0392b
377+
color #f92672
378378
.item-bottom-tagList-item
379379
background-color alpha(#fff, 20%)
380380

@@ -394,3 +394,76 @@ body[data-theme="monokai"]
394394
.item-bottom-tagList-empty
395395
color $ui-inactive-text-color
396396
vertical-align middle
397+
398+
body[data-theme="dracula"]
399+
.root
400+
border-color $ui-dracula-borderColor
401+
background-color $ui-dracula-noteList-backgroundColor
402+
403+
.item
404+
border-color $ui-dracula-borderColor
405+
background-color $ui-dracula-noteList-backgroundColor
406+
&:hover
407+
transition 0.15s
408+
// background-color alpha($ui-dracula-noteList-backgroundColor, 20%)
409+
color $ui-dracula-text-color
410+
.item-title
411+
.item-title-icon
412+
.item-bottom-time
413+
transition 0.15s
414+
color $ui-dracula-text-color
415+
.item-bottom-tagList-item
416+
transition 0.15s
417+
background-color alpha($ui-dracula-noteList-backgroundColor, 20%)
418+
color $ui-dracula-text-color
419+
&:active
420+
transition 0.15s
421+
background-color $ui-dracula-noteList-backgroundColor
422+
color $ui-dracula-text-color
423+
.item-title
424+
.item-title-icon
425+
.item-bottom-time
426+
transition 0.15s
427+
color $ui-dracula-text-color
428+
.item-bottom-tagList-item
429+
transition 0.15s
430+
background-color alpha($ui-dracula-noteList-backgroundColor, 10%)
431+
color $ui-dracula-text-color
432+
433+
.item-wrapper
434+
border-color alpha($ui-dracula-button-backgroundColor, 60%)
435+
436+
.item--active
437+
border-color $ui-dracula-borderColor
438+
background-color $ui-dracula-button-backgroundColor
439+
.item-wrapper
440+
border-color transparent
441+
.item-title
442+
.item-title-icon
443+
.item-bottom-time
444+
color $ui-dracula-active-color
445+
.item-bottom-tagList-item
446+
background-color alpha(#f8f8f2, 10%)
447+
color $ui-dracula-text-color
448+
&:hover
449+
// background-color alpha($ui-dracula-button--active-backgroundColor, 60%)
450+
color #ff79c6
451+
.item-bottom-tagList-item
452+
background-color alpha(#f8f8f2, 20%)
453+
454+
.item-title
455+
color $ui-inactive-text-color
456+
457+
.item-title-icon
458+
color $ui-inactive-text-color
459+
460+
.item-title-empty
461+
color $ui-inactive-text-color
462+
463+
.item-bottom-tagList-item
464+
background-color alpha($ui-dark-button--active-backgroundColor, 40%)
465+
color $ui-inactive-text-color
466+
467+
.item-bottom-tagList-empty
468+
color $ui-inactive-text-color
469+
vertical-align middle

browser/components/NoteItemSimple.styl

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ body[data-theme="monokai"]
240240
.item-simple-title-icon
241241
.item-simple-bottom-time
242242
transition 0.15s
243-
color $ui-solarized-dark-text-color
243+
color $ui-monokai-text-color
244244
.item-simple-bottom-tagList-item
245245
transition 0.15s
246246
background-color alpha(#fff, 20%)
@@ -286,3 +286,67 @@ body[data-theme="monokai"]
286286
.item-simple-right-storageName
287287
padding-left 4px
288288
opacity 0.4
289+
290+
body[data-theme="dracula"]
291+
.root
292+
border-color $ui-dracula-borderColor
293+
background-color $ui-dracula-noteList-backgroundColor
294+
295+
.item-simple
296+
border-color $ui-dracula-borderColor
297+
background-color $ui-dracula-noteList-backgroundColor
298+
&:hover
299+
transition 0.15s
300+
background-color alpha($ui-dracula-button-backgroundColor, 60%)
301+
color $ui-dracula-text-color
302+
.item-simple-title
303+
.item-simple-title-empty
304+
.item-simple-title-icon
305+
.item-simple-bottom-time
306+
transition 0.15s
307+
color $ui-dracula-text-color
308+
.item-simple-bottom-tagList-item
309+
transition 0.15s
310+
background-color alpha(#f8f8f2, 20%)
311+
color $ui-dracula-text-color
312+
&:active
313+
transition 0.15s
314+
background-color $ui-dracula-button--active-backgroundColor
315+
color $ui-dracula-text-color
316+
.item-simple-title
317+
.item-simple-title-empty
318+
.item-simple-title-icon
319+
.item-simple-bottom-time
320+
transition 0.15s
321+
color $ui-dracula-text-color
322+
.item-simple-bottom-tagList-item
323+
transition 0.15s
324+
background-color alpha(#f8f8f2, 10%)
325+
color $ui-dracula-text-color
326+
327+
.item-simple--active
328+
border-color $ui-dracula-borderColor
329+
background-color $ui-dracula-button--active-backgroundColor
330+
.item-simple-wrapper
331+
border-color transparent
332+
.item-simple-title
333+
.item-simple-title-empty
334+
.item-simple-title-icon
335+
.item-simple-bottom-time
336+
color $ui-dracula-text-color
337+
.item-simple-bottom-tagList-item
338+
background-color alpha(#f8f8f2, 10%)
339+
color $ui-dracula-text-color
340+
&:hover
341+
// background-color alpha($ui-dark-button--active-backgroundColor, 60%)
342+
color #c0392b
343+
.item-simple-bottom-tagList-item
344+
background-color alpha(#f8f8f2, 20%)
345+
.item-simple-title
346+
color $ui-dark-text-color
347+
border-bottom $ui-dark-borderColor
348+
.item-simple-right
349+
float right
350+
.item-simple-right-storageName
351+
padding-left 4px
352+
opacity 0.4

browser/components/RealtimeNotification.styl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,15 @@ body[data-theme="monokai"]
5151
border none
5252
background-color $ui-monokai-button-backgroundColor
5353
&:hover
54-
color #5CB85C
54+
color #5CB85C
55+
56+
body[data-theme="dracula"]
57+
.notification-area
58+
background-color none
59+
60+
.notification-link
61+
color $ui-dracula-text-color
62+
border none
63+
background-color $ui-dracula-button-backgroundColor
64+
&:hover
65+
color #ff79c6

0 commit comments

Comments
 (0)