diff --git a/.boostnoterc.sample b/.boostnoterc.sample index 2caa2c1a..8419061d 100644 --- a/.boostnoterc.sample +++ b/.boostnoterc.sample @@ -10,7 +10,6 @@ "theme": "monokai" }, "hotkey": { - "toggleFinder": "Cmd + Alt + S", "toggleMain": "Cmd + Alt + L" }, "isSideNavFolded": false, diff --git a/.travis.yml b/.travis.yml index 013169e8..c68d1063 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: node_js node_js: - - stable - - lts/* + - 6 script: - npm run lint && npm run test - 'if [[ ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} = "master" ]]; then npm install -g grunt npm@5.2 && grunt pre-build; fi' diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index d50f3d8e..7e59ea65 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -51,9 +51,10 @@ export default class CodeEditor extends React.Component { componentDidMount () { this.value = this.props.value + this.editor = CodeMirror(this.refs.root, { value: this.props.value, - lineNumbers: true, + lineNumbers: this.props.displayLineNumbers, lineWrapping: true, theme: this.props.theme, indentUnit: this.props.indentSize, @@ -71,7 +72,7 @@ export default class CodeEditor extends React.Component { if (cm.somethingSelected()) cm.indentSelection('add') else { const tabs = cm.getOption('indentWithTabs') - if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)\] )?$/)) { + if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)] )?$/)) { cm.execCommand('goLineStart') if (tabs) { cm.execCommand('insertTab') @@ -156,6 +157,10 @@ export default class CodeEditor extends React.Component { this.editor.setOption('indentWithTabs', this.props.indentType !== 'space') } + if (prevProps.displayLineNumbers !== this.props.displayLineNumbers) { + this.editor.setOption('lineNumbers', this.props.displayLineNumbers) + } + if (prevProps.scrollPastEnd !== this.props.scrollPastEnd) { this.editor.setOption('scrollPastEnd', this.props.scrollPastEnd) } diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index 62c4414a..19f9e280 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -242,6 +242,7 @@ class MarkdownEditor extends React.Component { fontSize={editorFontSize} indentType={config.editor.indentType} indentSize={editorIndentSize} + displayLineNumbers={config.editor.displayLineNumbers} scrollPastEnd={config.editor.scrollPastEnd} storageKey={storageKey} fetchUrlTitle={config.editor.fetchUrlTitle} diff --git a/browser/components/MarkdownSplitEditor.js b/browser/components/MarkdownSplitEditor.js index 15498662..38ce903c 100644 --- a/browser/components/MarkdownSplitEditor.js +++ b/browser/components/MarkdownSplitEditor.js @@ -62,6 +62,7 @@ class MarkdownSplitEditor extends React.Component { keyMap={config.editor.keyMap} fontFamily={config.editor.fontFamily} fontSize={editorFontSize} + displayLineNumbers={config.editor.displayLineNumbers} indentType={config.editor.indentType} indentSize={editorIndentSize} scrollPastEnd={config.editor.scrollPastEnd} diff --git a/browser/components/TodoListPercentage.styl b/browser/components/TodoListPercentage.styl index d4cb7485..329663f9 100644 --- a/browser/components/TodoListPercentage.styl +++ b/browser/components/TodoListPercentage.styl @@ -1,6 +1,6 @@ .percentageBar position absolute - top 50px + top 72px right 0px left 0px background-color #DADFE1 diff --git a/browser/finder/FinderMain.styl b/browser/finder/FinderMain.styl deleted file mode 100644 index 8ba7c3b9..00000000 --- a/browser/finder/FinderMain.styl +++ /dev/null @@ -1,156 +0,0 @@ -$search-height = 50px -$nav-width = 175px -$list-width = 250px - -.root - absolute top left right bottom - -.search - height $search-height - padding 10px - box-sizing border-box - border-bottom $ui-border - text-align center - -.search-input - height 30px - width 100% - margin 0 auto - font-size 18px - border none - outline none - text-align center - background-color transparent - -.result - absolute left right bottom - top $search-height - background-color $ui-noteDetail-backgroundColor - -.result-nav - user-select none - absolute left top bottom - width $nav-width - background-color $ui-backgroundColor - -.result-nav-filter - margin-bottom 10px - -.result-nav-filter-option - height 25px - line-height 25px - padding 0 10px - label - cursor pointer - -.result-nav-menu - navButtonColor() - height 32px - padding 0 10px - font-size 14px - width 100% - outline none - text-align left - line-height 32px - box-sizing border-box - cursor pointer - -.result-nav-menu--active - @extend .result-nav-menu - background-color $ui-button--active-backgroundColor - color $ui-button--active-color - &:hover - background-color $ui-button--active-backgroundColor - -.result-nav-storageList - absolute bottom left right - top 110px + 32px + 10px + 10px + 20px - overflow-y auto - -.result-list - user-select none - absolute top bottom - left $nav-width - width $list-width - box-sizing border-box - overflow-y auto - box-shadow 2px 0 15px -8px #b1b1b1 - z-index 1 - -.result-detail - absolute top bottom right - left $nav-width + $list-width - background-color $ui-noteDetail-backgroundColor - -body[data-theme="dark"] - .root - background-color $ui-dark-backgroundColor - .search - border-color $ui-dark-borderColor - .search-input - color $ui-dark-text-color - - .result - background-color $ui-dark-noteList-backgroundColor - - .result-nav - background-color $ui-dark-backgroundColor - label - color $ui-dark-text-color - - .result-nav-menu - navDarkButtonColor() - - .result-nav-menu--active - background-color $ui-dark-button--active-backgroundColor - color $ui-dark-button--active-color - &:hover - background-color $ui-dark-button--active-backgroundColor - - .result-list - border-color $ui-dark-borderColor - box-shadow none - top 0 - - .result-detail - absolute top bottom right - left $nav-width + $list-width - background-color $ui-dark-noteDetail-backgroundColor - - - -body[data-theme="solarized-dark"] - .root - background-color $ui-solarized-dark-backgroundColor - .search - border-color $ui-solarized-dark-borderColor - .search-input - color $ui-dark-text-color - - .result - background-color $ui-solarized-dark-backgroundColor - - .result-nav - background-color $ui-solarized-dark-backgroundColor - label - color $ui-dark-text-color - - .result-nav-menu - navDarkButtonColor() - - .result-nav-menu--active - background-color $ui-solarized-dark-button-backgroundColor - color $ui-dark-button--active-color - &:hover - background-color $ui-dark-button--active-backgroundColor - - .result-list - border-color $ui-solarized-dark-borderColor - box-shadow none - top 0 - - .result-detail - absolute top bottom right - left $nav-width + $list-width - background-color $ui-solarized-dark-backgroundColor - diff --git a/browser/finder/NoteDetail.js b/browser/finder/NoteDetail.js index 1325e87f..e69de29b 100644 --- a/browser/finder/NoteDetail.js +++ b/browser/finder/NoteDetail.js @@ -1,212 +0,0 @@ -import React from 'react' -import CSSModules from 'browser/lib/CSSModules' -import styles from './NoteDetail.styl' -import MarkdownPreview from 'browser/components/MarkdownPreview' -import MarkdownEditor from 'browser/components/MarkdownEditor' -import CodeEditor from 'browser/components/CodeEditor' -import CodeMirror from 'codemirror' -import 'codemirror-mode-elixir' -import { findStorage } from 'browser/lib/findStorage' - -const electron = require('electron') -const { clipboard } = electron -const path = require('path') - -function pass (name) { - switch (name) { - case 'ejs': - return 'Embedded Javascript' - case 'html_ruby': - return 'Embedded Ruby' - case 'objectivec': - return 'Objective C' - case 'text': - return 'Plain Text' - default: - return name - } -} -function notify (title, options) { - if (global.process.platform === 'win32') { - options.icon = path.join('file://', global.__dirname, '../../resources/app.png') - } - return new window.Notification(title, options) -} - -class NoteDetail extends React.Component { - constructor (props) { - super(props) - - this.state = { - snippetIndex: 0 - } - } - - componentWillReceiveProps (nextProps) { - if (nextProps.note !== this.props.note) { - this.setState({ - snippetIndex: 0 - }, () => { - if (nextProps.note.type === 'SNIPPET_NOTE') { - nextProps.note.snippets.forEach((snippet, index) => { - this.refs['code-' + index].reload() - }) - } - }) - } - } - - selectPriorSnippet () { - const { note } = this.props - if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) { - this.setState({ - snippetIndex: (this.state.snippetIndex + note.snippets.length - 1) % note.snippets.length - }) - } - } - - selectNextSnippet () { - const { note } = this.props - if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) { - this.setState({ - snippetIndex: (this.state.snippetIndex + 1) % note.snippets.length - }) - } - } - - saveToClipboard () { - const { note } = this.props - - if (note.type === 'MARKDOWN_NOTE') { - clipboard.writeText(note.content) - } else { - clipboard.writeText(note.snippets[this.state.snippetIndex].content) - } - - notify('Saved to Clipboard!', { - body: 'Paste it wherever you want!', - silent: true - }) - } - - handleTabButtonClick (e, index) { - this.setState({ - snippetIndex: index - }) - } - - render () { - const { note, config } = this.props - if (note == null) { - return ( -
- ) - } - - let editorFontSize = parseInt(config.editor.fontSize, 10) - if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14 - let editorIndentSize = parseInt(config.editor.indentSize, 10) - if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4 - - const storage = findStorage(note.storage) - - if (note.type === 'SNIPPET_NOTE') { - const tabList = note.snippets.map((snippet, index) => { - const isActive = this.state.snippetIndex === index - return
- -
- }) - - const viewList = note.snippets.map((snippet, index) => { - const isActive = this.state.snippetIndex === index - - let syntax = CodeMirror.findModeByName(pass(snippet.mode)) - if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text') - - return
- {snippet.mode === 'markdown' - ? - : - } -
- }) - - return ( -
-
-