1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-23 06:31:51 +00:00

Merge branch 'master' into Design-update

This commit is contained in:
Sota Sugiura
2017-04-22 15:17:03 +09:00
committed by GitHub
20 changed files with 6829 additions and 217 deletions

View File

@@ -1,8 +1,8 @@
GPL-3.0
Boostnote - the simplest note app
Boostnote - an open source note-taking app made for programmers just like you.
Copyright (C) 2016 MAISIN&CO.
Copyright (C) 2017 Maisin&Co., Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -83,37 +83,7 @@ export default class CodeEditor extends React.Component {
'Cmd-T': function (cm) {
// Do nothing
},
Enter: (cm) => {
const cursor = cm.getCursor()
const line = cm.getLine(cursor.line)
let bulletType
if (line.trim().startsWith('- ')) {
bulletType = 1 // dash
} else if (line.trim().startsWith('* ')) {
bulletType = 2 // star
} else if (line.trim().startsWith('+ ')) {
bulletType = 3 // plus
} else {
bulletType = 0 // not a bullet
}
const numberedListRegex = /^(\d+)\. .+/
const match = line.trim().match(numberedListRegex)
if (bulletType !== 0 || match) {
cm.execCommand('newlineAndIndent')
const range = {line: cursor.line + 1, ch: cm.getLine(cursor.line + 1).length}
if (match) {
cm.replaceRange((parseInt(match[1]) + 1) + '. ', range)
} else if (bulletType === 1) {
cm.replaceRange('- ', range)
} else if (bulletType === 2) {
cm.replaceRange('* ', range)
} else if (bulletType === 3) {
cm.replaceRange('+ ', range)
}
} else {
cm.execCommand('newlineAndIndent')
}
}
Enter: 'newlineAndIndentContinueMarkdownList'
}
})

View File

@@ -11,9 +11,7 @@ class MarkdownEditor extends React.Component {
this.escapeFromEditor = ['Control', 'w']
this.supportMdBold = ['Control', 'b']
this.supportMdWordBold = ['Control', ':']
this.supportMdSelectionBold = ['Control', ':']
this.state = {
status: 'PREVIEW',
@@ -171,22 +169,15 @@ class MarkdownEditor extends React.Component {
if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) {
document.activeElement.blur()
}
if (this.supportMdBold.every(isNoteHandlerKey)) {
this.addMdAndMoveCaretToCenter('****')
}
if (this.supportMdWordBold.every(isNoteHandlerKey)) {
this.addMdBetweenWord('**')
if (this.supportMdSelectionBold.every(isNoteHandlerKey)) {
this.addMdAroundWord('**')
}
}
addMdAndMoveCaretToCenter (mdElement) {
const currentCaret = this.refs.code.editor.getCursor()
const cmDoc = this.refs.code.editor.getDoc()
cmDoc.replaceRange(mdElement, currentCaret)
this.refs.code.editor.setCursor({ line: currentCaret.line, ch: currentCaret.ch + mdElement.length / 2 })
addMdAroundWord (mdElement) {
if (this.refs.code.editor.getSelection()) {
return this.addMdAroundSelection(mdElement)
}
addMdBetweenWord (mdElement) {
const currentCaret = this.refs.code.editor.getCursor()
const word = this.refs.code.editor.findWordAt(currentCaret)
const cmDoc = this.refs.code.editor.getDoc()
@@ -194,6 +185,10 @@ class MarkdownEditor extends React.Component {
cmDoc.replaceRange(mdElement, { line: word.head.line, ch: word.head.ch + mdElement.length })
}
addMdAroundSelection (mdElement) {
this.refs.code.editor.replaceSelection(`${mdElement}${this.refs.code.editor.getSelection()}${mdElement}`)
}
handleKeyUp (e) {
const keyPressed = Object.assign(this.state.keyPressed, {
[e.key]: false

View File

@@ -96,6 +96,7 @@ class SnippetTab extends React.Component {
{!this.state.isRenaming
? <button styleName='button'
onClick={(e) => this.handleClick(e)}
onDoubleClick={(e) => this.handleRenameClick(e)}
onContextMenu={(e) => this.handleContextMenu(e)}
>
{snippet.name.trim().length > 0

View File

@@ -143,7 +143,7 @@ class InitModal extends React.Component {
type: 'SNIPPET_NOTE',
folder: data.storage.folders[0].key,
title: 'Snippet note example',
description: 'Snippet note example\nYou can store a series of snippet as a single note like Gist.',
description: 'Snippet note example\nYou can store a series of snippets as a single note, like Gist.',
snippets: [
{
name: 'example.html',
@@ -214,10 +214,10 @@ class InitModal extends React.Component {
>Close</button>
<div styleName='body'>
<div styleName='body-welcome'>
Welcome you!
Welcome!
</div>
<div styleName='body-description'>
Boostnote will use this directory as a default storage.
Please select a directory for Boostnote storage.
</div>
<div styleName='body-path'>
<input styleName='body-path-input'

View File

@@ -104,10 +104,17 @@
margin-left: 10px
font-size: 12px
.code-mirror
width 400px
height 140px
margin-top 10px
margin-bottom 10px
colorDarkControl()
border-color $ui-dark-borderColor
background-color $ui-dark-backgroundColor
color $ui-dark-text-color
body[data-theme="dark"]
.root
color $ui-dark-text-color

View File

@@ -49,13 +49,18 @@ class InfoTab extends React.Component {
<li>
<a href='https://www.patreon.com/boostnote'
onClick={(e) => this.handleLinkClick(e)}
>Donation via Patreon</a>: Thank you for your support 🎉
>Donate via Patreon</a> : Thank you for your support 🎉
</li>
<li>
<a href='https://github.com/BoostIO/Boostnote/issues'
onClick={(e) => this.handleLinkClick(e)}
>GitHub Issues</a> : We'd love to hear your feedback 🙌
</li>
<li>
<a href='https://github.com/BoostIO/Boostnote/blob/master/docs/build.md'
onClick={(e) => this.handleLinkClick(e)}
>Development</a> : Development configurations for Boostnote 🚀
</li>
<li styleName='cc'>
Copyright (C) 2017 Maisin&Co.
</li>

View File

@@ -4,28 +4,43 @@ import styles from './ConfigTab.styl'
import ConfigManager from 'browser/main/lib/ConfigManager'
import store from 'browser/main/store'
import consts from 'browser/lib/consts'
import ReactCodeMirror from 'react-codemirror'
import CodeMirror from 'codemirror'
const OSX = global.process.platform === 'darwin'
class UiTab extends React.Component {
constructor (props) {
super(props)
this.state = {
config: props.config
config: props.config,
codemirrorTheme: props.config.editor.theme
}
}
componentWillMount () {
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
}
handleUIChange (e) {
let { config } = this.state
const { codemirrorTheme } = this.state
let checkHighLight = document.getElementById('checkHighLight')
config.ui = {
if (checkHighLight === null) {
checkHighLight = document.createElement('link')
checkHighLight.setAttribute('id', 'checkHighLight')
checkHighLight.setAttribute('rel', 'stylesheet')
document.head.appendChild(checkHighLight)
}
const newConfig = {
ui: {
theme: this.refs.uiTheme.value,
disableDirectWrite: this.refs.uiD2w != null
? this.refs.uiD2w.checked
: false
}
config.editor = {
},
editor: {
theme: this.refs.editorTheme.value,
fontSize: this.refs.editorFontSize.value,
fontFamily: this.refs.editorFontFamily.value,
@@ -33,15 +48,22 @@ class UiTab extends React.Component {
indentSize: this.refs.editorIndentSize.value,
switchPreview: this.refs.editorSwitchPreview.value,
keyMap: this.refs.editorKeyMap.value
}
config.preview = {
},
preview: {
fontSize: this.refs.previewFontSize.value,
fontFamily: this.refs.previewFontFamily.value,
codeBlockTheme: this.refs.previewCodeBlockTheme.value,
lineNumber: this.refs.previewLineNumber.checked
}
}
this.setState({ config })
const newCodemirrorTheme = this.refs.editorTheme.value
if (newCodemirrorTheme !== codemirrorTheme) {
checkHighLight.setAttribute('href', `../node_modules/codemirror/theme/${newCodemirrorTheme}.css`)
}
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme })
}
handleSaveUIClick (e) {
@@ -61,8 +83,8 @@ class UiTab extends React.Component {
render () {
const themes = consts.THEMES
const { config } = this.state
const { config, codemirrorTheme } = this.state
const codemirrorSampleCode = 'function iamHappy (happy) {\n\tif (happy) {\n\t console.log("I am Happy!")\n\t} else {\n\t console.log("I am not Happy!")\n\t}\n};'
return (
<div styleName='root'>
<div styleName='group'>
@@ -113,6 +135,9 @@ class UiTab extends React.Component {
})
}
</select>
<div styleName='code-mirror'>
<ReactCodeMirror value={codemirrorSampleCode} options={{ lineNumbers: true, readOnly: true, mode: 'javascript', theme: codemirrorTheme }} />
</div>
</div>
</div>
<div styleName='group-section'>

View File

@@ -1,5 +1,12 @@
# Contributing to Boostnote
## When you open an issue of a bug report
There are no issue template. But there is a request.
**Please paste screenshots of Boostnote with developer tool open**
Thank you for your help in advance.
## About copyright of Pull Request
If you make a pull request, It means you agree to transfer the copyright of the code changes to MAISIN&CO.
@@ -11,6 +18,13 @@ Because GPL v3 is too strict to be compatible with any other License, We thought
# Contributing to Boostnote(Japanese)
## バグレポートに関してのissueを立てる時
イシューテンプレートはありませんが、1つお願いがあります。
**開発者ツールを開いた状態のBoostnoteのスクリーンショットを貼ってください**
よろしくお願いします。
## Pull requestの著作権について
Pull requestをすることはその変化分のコードの著作権をMAISIN&CO.に譲渡することに同意することになります。

View File

@@ -3,44 +3,44 @@
## Development
We use Webpack HMR to develop Boostnote.
You can use following commands to use default configuration at the top of project directory.
Running the following commands, at the top of the project directory, will start Boostnote with the default configurations.
Install requirement packages.
Install the required packages using yarn.
```
$ npm install
$ yarn
```
Build codes and run.
Build and run.
```
$ npm run dev-start
$ yarn run dev-start
```
This command runs `npm run webpack` and `npm run hot` in parallel. It means it is the same thing to run those commands in 2 terminals.
This command runs `yarn run webpack` and `yarn run hot` in parallel. It is the same as running these commands in two terminals.
And webpack will watch the code changes and apply it automatically.
The `webpack` will watch for code changes and then apply them automatically.
If this error: `Failed to load resource: net::ERR_CONNECTION_REFUSED` happens, please reload Boostnote.
If the following error occurs: `Failed to load resource: net::ERR_CONNECTION_REFUSED`, please reload Boostnote.
![net::ERR_CONNECTION_REFUSED](https://cloud.githubusercontent.com/assets/11307908/24343004/081e66ae-1279-11e7-8d9e-7f478043d835.png)
> ### Notice
> There are some cases you have to refresh app yourself.
> 1. When editing constructor method of a component
> 2. When adding a new css class(same to 1: CSS class is re-written by each component. This process occurs at Constructor method.)
> There are some cases where you have to refresh the app manually.
> 1. When editing a constructor method of a component
> 2. When adding a new css class (similar to 1: the CSS class is re-written by each component. This process occurs at the Constructor method.)
## Deploy
We use Grunt.
Acutal deploy can be run by `grunt`. However, you shouldn't use because the default task is including codesign and authenticode.
We use Grunt to automate deployment.
You can build the program by using `grunt`. However, we don't recommend this because the default task includes codesign and authenticode.
So, we prepare a script which just make an executable file.
So, we've prepared a separate script which just makes an executable file.
```
grunt pre-build
```
You will find the executable from `dist`. In this case, auto updater won't work because the app isn't signed.
You will find the executable in the `dist` directory. Note, the auto updater won't work because the app isn't signed.
If you are necessary, you can do codesign or authenticode by this excutable.
If you find it necessary, you can use codesign or authenticode with this executable.

View File

@@ -1,20 +1,20 @@
# How to debug Boostnote (electron app)
The electron that makes Boostnote is made from Chromium, developers can use `Developer Tools` as same as Google Chrome.
# How to debug Boostnote (Electron app)
Boostnote is an Electron app so it's based on Chromium; developers can use `Developer Tools` just like Google Chrome.
This is how to toggle Developer Tools:
You can toggle the `Developer Tools` like this:
![how_to_toggle_devTools](https://cloud.githubusercontent.com/assets/11307908/24343585/162187e2-127c-11e7-9c01-23578db03ecf.png)
The Developer Tools is like this:
The `Developer Tools` will look like this:
![Developer_Tools](https://cloud.githubusercontent.com/assets/11307908/24343545/eff9f3a6-127b-11e7-94cf-cb67bfda634a.png)
When errors occur, the error messages are displayed at the `console`.
## Debugging
For example, there is a way to put `debugger` as a breakpoint into the code like this:
For example, you can use the `debugger` to set a breakpoint in the code like this:
![debugger](https://cloud.githubusercontent.com/assets/11307908/24343879/9459efea-127d-11e7-9943-f60bf7f66d4a.png)
But this is only an example. You need to find a way to debug which fits with you.
This is just an illustrative example, you should find a way to debug which fits your style.
## References
* [Official document of Google Chrome about debugging](https://developer.chrome.com/devtools)

View File

@@ -8,16 +8,16 @@ Webpack HRMを使います。
依存するパッケージをインストールします。
```
$ npm install
$ yarn
```
ビルドして実行します。
```
$ npm run dev-start
$ yarn run dev-start
```
このコマンドは `npm run webpack``npm run hot`を並列に実行します。つまりこのコマンドは2つのターミナルで同時にこれらのコマンドを実行するのと同じことです。
このコマンドは `yarn run webpack``yarn run hot`を並列に実行します。つまりこのコマンドは2つのターミナルで同時にこれらのコマンドを実行するのと同じことです。
そして、Webpackが自動的にコードの変更を確認し、それを適用してくれるようになります。

View File

@@ -6,7 +6,7 @@ Webpack HRM을 개발을 위해 사용합니다.
다음 명령을 통해 저희가 해둔 설정을 사용 할 수 있습니다.
```
npm run webpack
yarn run webpack
```
몇 초 후, 다음 메세지를 보게 될겁니다.
@@ -18,10 +18,10 @@ webpack: bundle is now VALID.
그럼 앱을 실행합시다.
```
npm run hot
yarn run hot
```
> 원래 앱은 `npm start`로 실행가능합니다. 하지만 이 경우, 컴파일된 스크립트를 사용할 것입니다.
> 원래 앱은 `yarn start`로 실행가능합니다. 하지만 이 경우, 컴파일된 스크립트를 사용할 것입니다.
이로써 웹팩이 자동적으로 코드변경을 확인하고 적용해줄 것입니다.

View File

@@ -1,84 +0,0 @@
const electron = require('electron')
const BrowserWindow = electron.BrowserWindow
const OSX = process.platform === 'darwin'
// const WIN = process.platform === 'win32'
var edit = {
label: 'Edit',
submenu: [
{
label: 'Undo',
accelerator: 'Command+Z',
selector: 'undo:'
},
{
label: 'Redo',
accelerator: 'Shift+Command+Z',
selector: 'redo:'
},
{
type: 'separator'
},
{
label: 'Cut',
accelerator: 'Command+X',
selector: 'cut:'
},
{
label: 'Copy',
accelerator: 'Command+C',
selector: 'copy:'
},
{
label: 'Paste',
accelerator: 'Command+V',
selector: 'paste:'
},
{
label: 'Select All',
accelerator: 'Command+A',
selector: 'selectAll:'
}
]
}
var view = {
label: 'View',
submenu: [
{
label: 'Focus Search',
accelerator: 'Control + Alt + F',
click: function () {
console.log('focus find')
}
},
{
type: 'separator'
},
{
label: 'Toggle Markdown Preview',
accelerator: OSX ? 'Command + P' : 'Ctrl + P',
click: function () {
console.log('markdown')
}
},
{
type: 'separator'
},
{
label: 'Reload',
accelerator: (function () {
if (process.platform === 'darwin') return 'Command+R'
else return 'Ctrl+R'
})(),
click: function () {
BrowserWindow.getFocusedWindow().reload()
}
}
]
}
module.exports = process.platform === 'darwin'
? [edit, view]
: [view]

View File

@@ -54,7 +54,7 @@ var file = {
submenu: [
{
label: 'New Note',
accelerator: 'CmdOrCtrl + N',
accelerator: 'CommandOrControl+N',
click: function () {
mainWindow.webContents.send('top:new-note')
}
@@ -154,14 +154,14 @@ var view = {
submenu: [
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
accelerator: 'CommandOrControl+R',
click: function () {
BrowserWindow.getFocusedWindow().reload()
}
},
{
label: 'Toggle Developer Tools',
accelerator: OSX ? 'Command+Alt+I' : 'Ctrl+Shift+I',
accelerator: OSX ? 'Command+Alt+I' : 'Control+Shift+I',
click: function () {
BrowserWindow.getFocusedWindow().toggleDevTools()
}

View File

@@ -40,12 +40,19 @@ mainWindow.webContents.sendInputEvent({
if (process.platform !== 'linux' || process.env.DESKTOP_SESSION === 'cinnamon') {
mainWindow.on('close', function (e) {
e.preventDefault()
if (process.platform === 'win32') {
mainWindow.minimize()
} else {
if (mainWindow.isFullScreen()) {
mainWindow.once('leave-full-screen', function () {
mainWindow.hide()
})
mainWindow.setFullScreen(false)
} else {
mainWindow.hide()
}
e.preventDefault()
}
})
app.on('before-quit', function (e) {

View File

@@ -56,7 +56,7 @@
"font-awesome": "^4.3.0",
"immutable": "^3.8.1",
"js-sequence-diagrams": "^1000000.0.6",
"katex": "^0.6.0",
"katex": "^0.7.1",
"lodash": "^4.11.1",
"markdown-it": "^6.0.1",
"markdown-it-checkbox": "^1.1.0",
@@ -68,6 +68,7 @@
"node-ipc": "^8.1.0",
"raphael": "^2.2.7",
"react": "^15.0.2",
"react-codemirror": "^0.3.0",
"react-dom": "^15.0.2",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
@@ -101,10 +102,8 @@
"jsdom": "^9.4.2",
"merge-stream": "^1.0.0",
"nib": "^1.1.0",
"react": "^15.3.0",
"react-color": "^2.2.2",
"react-css-modules": "^3.7.6",
"react-dom": "^15.3.0",
"react-input-autosize": "^1.1.0",
"react-router": "^2.4.0",
"react-router-redux": "^4.0.4",

View File

@@ -25,7 +25,7 @@
## slack group
私たちにはslack groupもあります世界中のプログラマー達と、Boostnoteについてディスカッションをしましょう <br>
[こちらから](https://boostnote-group.slack.com/shared_invite/MTU5OTMwNjMyNjQxLTE0OTA2NzkyNzktYzkzYmZhYjk0Nw)
[こちらから](https://boostnote-group.slack.com/shared_invite/MTcxMjIwODk5Mzk3LTE0OTI1NjQxNDUtMTkwZTBjOWFkMg)
## More Information
* Website: http://boostnote.io/

View File

@@ -13,7 +13,7 @@
[![Build Status](https://travis-ci.org/BoostIO/Boostnote.svg?branch=master)](https://travis-ci.org/BoostIO/Boostnote)
## Author & Maintainer
## Authors & Maintainers
- [Rokt33r](https://github.com/rokt33r)
- [sota1235](https://github.com/sota1235)
- [Kohei TAKATA](https://github.com/kohei-takata)
@@ -23,16 +23,16 @@
## Contributors
[Great contributors](https://github.com/BoostIO/Boostnote/graphs/contributors) :tada:
## slack group
Let's talk about Boostnote's feature, request, Japanese gourmet and things like that🍣 <br>
[Join us](https://boostnote-group.slack.com/shared_invite/MTU5OTMwNjMyNjQxLTE0OTA2NzkyNzktYzkzYmZhYjk0Nw)
## Slack Group
Let's talk about Boostnote's great features, new feature requests and things like Japanese gourmet. 🍣 <br>
[Join us](https://boostnote-group.slack.com/shared_invite/MTcxMjIwODk5Mzk3LTE0OTI1NjQxNDUtMTkwZTBjOWFkMg)
## More Information
* Website: http://boostnote.io/
* Roadmap(upcoming features and bug fixes): https://github.com/BoostIO/Boostnote/wiki/List-of-the-requested-features
* Boostnote Shop(Products are shipped to all over the world :+1:): https://boostnote.paintory.com/
* Donation: [Patreon](https://www.patreon.com/boostnote)
* Development: https://github.com/BoostIO/Boostnote/blob/master/docs/build.md
* [Website](https://boostnote.io)
* [Boostnote Shop](https://boostnote.paintory.com/) : Products are shipped to all over the world 🌏
* [Donate via Patreon](https://www.patreon.com/boostnote) : Thank you for your support 🎉
* [GitHub Issues](https://github.com/BoostIO/Boostnote/issues) : We'd love to hear your feedback 🙌
* [Development](https://github.com/BoostIO/Boostnote/blob/master/docs/build.md) : Development configurations for Boostnote 🚀
* Copyright (C) 2017 Maisin&Co.
## License

6673
yarn.lock Normal file

File diff suppressed because it is too large Load Diff