mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 18:26:26 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8116b569c1 | ||
|
|
da791c5fed | ||
|
|
fbd9c59bfd | ||
|
|
3a1b3d19c5 | ||
|
|
238076f534 | ||
|
|
214d74ae11 | ||
|
|
30324f6113 | ||
|
|
68f0a25873 | ||
|
|
cd5bc4e930 | ||
|
|
1d8f729c95 | ||
|
|
f0d2fb53d4 | ||
|
|
0445c680ba | ||
|
|
12453942c8 | ||
|
|
b18a5be940 | ||
|
|
c2234747e8 | ||
|
|
d6c9ab43ec | ||
|
|
db16a87f74 | ||
|
|
5b0d2ec97b | ||
|
|
b906db3b24 | ||
|
|
df0af2a11f | ||
|
|
706dd3e616 | ||
|
|
bbec58e049 | ||
|
|
381b7d85f4 | ||
|
|
c17c056af3 | ||
|
|
a26a85cd1f | ||
|
|
9b68b1d327 | ||
|
|
6a6631052e | ||
|
|
d4ad3a953a | ||
|
|
7bb63a78c5 | ||
|
|
26c859f14c | ||
|
|
dd5c9bf3f6 | ||
|
|
3db40fea31 | ||
|
|
8f1c198406 | ||
|
|
ac65a3c86e | ||
|
|
79abcd90f6 | ||
|
|
d614abdec6 | ||
|
|
44d754c59d | ||
|
|
247d1db5d5 |
@@ -37,6 +37,9 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
this.props.onBlur != null && this.props.onBlur(e)
|
this.props.onBlur != null && this.props.onBlur(e)
|
||||||
}
|
}
|
||||||
|
this.loadStyleHandler = (e) => {
|
||||||
|
this.editor.refresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
@@ -50,6 +53,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
tabSize: this.props.indentSize,
|
tabSize: this.props.indentSize,
|
||||||
indentWithTabs: this.props.indentType !== 'space',
|
indentWithTabs: this.props.indentType !== 'space',
|
||||||
keyMap: 'sublime',
|
keyMap: 'sublime',
|
||||||
|
inputStyle: 'textarea',
|
||||||
extraKeys: {
|
extraKeys: {
|
||||||
Tab: function (cm) {
|
Tab: function (cm) {
|
||||||
if (cm.somethingSelected()) cm.indentSelection('add')
|
if (cm.somethingSelected()) cm.indentSelection('add')
|
||||||
@@ -71,11 +75,16 @@ export default class CodeEditor extends React.Component {
|
|||||||
|
|
||||||
this.editor.on('blur', this.blurHandler)
|
this.editor.on('blur', this.blurHandler)
|
||||||
this.editor.on('change', this.changeHandler)
|
this.editor.on('change', this.changeHandler)
|
||||||
|
|
||||||
|
let editorTheme = document.getElementById('editorTheme')
|
||||||
|
editorTheme.addEventListener('load', this.loadStyleHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
this.editor.off('blur', this.blurHandler)
|
this.editor.off('blur', this.blurHandler)
|
||||||
this.editor.off('change', this.changeHandler)
|
this.editor.off('change', this.changeHandler)
|
||||||
|
let editorTheme = document.getElementById('editorTheme')
|
||||||
|
editorTheme.removeEventListener('load', this.loadStyleHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps, prevState) {
|
componentDidUpdate (prevProps, prevState) {
|
||||||
@@ -85,7 +94,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
if (prevProps.theme !== this.props.theme) {
|
if (prevProps.theme !== this.props.theme) {
|
||||||
this.editor.setOption('theme', this.props.theme)
|
this.editor.setOption('theme', this.props.theme)
|
||||||
needRefresh = true
|
// editor should be refreshed after css loaded
|
||||||
}
|
}
|
||||||
if (prevProps.fontSize !== this.props.fontSize) {
|
if (prevProps.fontSize !== this.props.fontSize) {
|
||||||
needRefresh = true
|
needRefresh = true
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ class MarkdownEditor extends React.Component {
|
|||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
status: 'PREVIEW'
|
status: 'PREVIEW',
|
||||||
|
renderValue: props.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,6 +22,33 @@ class MarkdownEditor extends React.Component {
|
|||||||
this.value = this.refs.code.value
|
this.value = this.refs.code.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps (props) {
|
||||||
|
if (props.value !== this.props.value) {
|
||||||
|
this.queueRendering(props.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
this.cancelQueue()
|
||||||
|
}
|
||||||
|
|
||||||
|
queueRendering (value) {
|
||||||
|
clearTimeout(this.renderTimer)
|
||||||
|
this.renderTimer = setTimeout(() => {
|
||||||
|
this.renderPreview(value)
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelQueue () {
|
||||||
|
clearTimeout(this.renderTimer)
|
||||||
|
}
|
||||||
|
|
||||||
|
renderPreview (value) {
|
||||||
|
this.setState({
|
||||||
|
renderValue: value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
handleChange (e) {
|
handleChange (e) {
|
||||||
this.value = this.refs.code.value
|
this.value = this.refs.code.value
|
||||||
this.props.onChange(e)
|
this.props.onChange(e)
|
||||||
@@ -110,10 +138,13 @@ class MarkdownEditor extends React.Component {
|
|||||||
|
|
||||||
reload () {
|
reload () {
|
||||||
this.refs.code.reload()
|
this.refs.code.reload()
|
||||||
|
this.cancelQueue()
|
||||||
|
this.renderPreview(this.props.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { className, value, config } = this.props
|
let { className, value, config } = this.props
|
||||||
|
|
||||||
let editorFontSize = parseInt(config.editor.fontSize, 10)
|
let editorFontSize = parseInt(config.editor.fontSize, 10)
|
||||||
if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14
|
if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14
|
||||||
let editorIndentSize = parseInt(config.editor.indentSize, 10)
|
let editorIndentSize = parseInt(config.editor.indentSize, 10)
|
||||||
@@ -153,10 +184,11 @@ class MarkdownEditor extends React.Component {
|
|||||||
codeBlockTheme={config.preview.codeBlockTheme}
|
codeBlockTheme={config.preview.codeBlockTheme}
|
||||||
codeBlockFontFamily={config.editor.fontFamily}
|
codeBlockFontFamily={config.editor.fontFamily}
|
||||||
lineNumber={config.preview.lineNumber}
|
lineNumber={config.preview.lineNumber}
|
||||||
|
indentSize={editorIndentSize}
|
||||||
ref='preview'
|
ref='preview'
|
||||||
onContextMenu={(e) => this.handleContextMenu(e)}
|
onContextMenu={(e) => this.handleContextMenu(e)}
|
||||||
tabIndex='0'
|
tabIndex='0'
|
||||||
value={value}
|
value={this.state.renderValue}
|
||||||
onMouseUp={(e) => this.handlePreviewMouseUp(e)}
|
onMouseUp={(e) => this.handlePreviewMouseUp(e)}
|
||||||
onMouseDown={(e) => this.handlePreviewMouseDown(e)}
|
onMouseDown={(e) => this.handlePreviewMouseDown(e)}
|
||||||
onCheckboxClick={(e) => this.handleCheckboxClick(e)}
|
onCheckboxClick={(e) => this.handleCheckboxClick(e)}
|
||||||
|
|||||||
@@ -1,11 +1,63 @@
|
|||||||
import React, { PropTypes } from 'react'
|
import React, { PropTypes } from 'react'
|
||||||
import markdown from 'browser/lib/markdown'
|
import markdown from 'browser/lib/markdown'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import hljsTheme from 'browser/lib/hljsThemes'
|
import CodeMirror from 'codemirror'
|
||||||
|
import consts from 'browser/lib/consts'
|
||||||
|
import Raphael from 'raphael'
|
||||||
|
import flowchart from 'flowchart'
|
||||||
|
import SequenceDiagram from 'sequence-diagram'
|
||||||
|
|
||||||
|
function decodeHTMLEntities (text) {
|
||||||
|
var entities = [
|
||||||
|
['apos', '\''],
|
||||||
|
['amp', '&'],
|
||||||
|
['lt', '<'],
|
||||||
|
['gt', '>']
|
||||||
|
]
|
||||||
|
|
||||||
|
for (var i = 0, max = entities.length; i < max; ++i) {
|
||||||
|
text = text.replace(new RegExp('&' + entities[i][0] + ';', 'g'), entities[i][1])
|
||||||
|
}
|
||||||
|
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
|
||||||
|
const { remote } = require('electron')
|
||||||
|
const { app } = remote
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
const markdownStyle = require('!!css!stylus?sourceMap!./markdown.styl')[0][1]
|
const markdownStyle = require('!!css!stylus?sourceMap!./markdown.styl')[0][1]
|
||||||
const { shell } = require('electron')
|
const appPath = 'file://' + (process.env.NODE_ENV === 'production'
|
||||||
|
? app.getAppPath()
|
||||||
|
: path.resolve())
|
||||||
|
|
||||||
|
function buildStyle (fontFamily, fontSize, codeBlockFontFamily, lineNumber) {
|
||||||
|
return `
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Lato';
|
||||||
|
src: url('${appPath}/resources/fonts/Lato-Regular.woff2') format('woff2'), /* Modern Browsers */
|
||||||
|
url('${appPath}/resources/fonts/Lato-Regular.woff') format('woff'), /* Modern Browsers */
|
||||||
|
url('${appPath}/resources/fonts/Lato-Regular.ttf') format('truetype');
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
}
|
||||||
|
${markdownStyle}
|
||||||
|
body {
|
||||||
|
font-family: ${fontFamily.join(', ')};
|
||||||
|
font-size: ${fontSize}px;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
font-family: ${codeBlockFontFamily.join(', ')};
|
||||||
|
}
|
||||||
|
.lineNumber {
|
||||||
|
${lineNumber && 'display: block !important;'}
|
||||||
|
font-family: ${codeBlockFontFamily.join(', ')};
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
const { shell } = require('electron')
|
||||||
const OSX = global.process.platform === 'darwin'
|
const OSX = global.process.platform === 'darwin'
|
||||||
|
|
||||||
const defaultFontFamily = ['helvetica', 'arial', 'sans-serif']
|
const defaultFontFamily = ['helvetica', 'arial', 'sans-serif']
|
||||||
@@ -30,14 +82,15 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
||||||
let href = e.target.getAttribute('href')
|
let anchor = e.target.closest('a')
|
||||||
|
let href = anchor.getAttribute('href')
|
||||||
if (_.isString(href) && href.match(/^#/)) {
|
if (_.isString(href) && href.match(/^#/)) {
|
||||||
let targetElement = this.refs.root.contentWindow.document.getElementById(href.substring(1, href.length))
|
let targetElement = this.refs.root.contentWindow.document.getElementById(href.substring(1, href.length))
|
||||||
if (targetElement != null) {
|
if (targetElement != null) {
|
||||||
this.getWindow().scrollTo(0, targetElement.offsetTop)
|
this.getWindow().scrollTo(0, targetElement.offsetTop)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shell.openExternal(e.target.href)
|
shell.openExternal(href)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,9 +121,17 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
this.refs.root.setAttribute('sandbox', 'allow-same-origin')
|
this.refs.root.setAttribute('sandbox', 'allow-scripts')
|
||||||
this.refs.root.contentWindow.document.body.addEventListener('contextmenu', this.contextMenuHandler)
|
this.refs.root.contentWindow.document.body.addEventListener('contextmenu', this.contextMenuHandler)
|
||||||
|
|
||||||
|
this.refs.root.contentWindow.document.head.innerHTML = `
|
||||||
|
<style id='style'></style>
|
||||||
|
<link rel="stylesheet" href="${appPath}/compiled/katex-style.css">
|
||||||
|
<link rel="stylesheet" href="${appPath}/node_modules/codemirror/lib/codemirror.css">
|
||||||
|
<link rel="stylesheet" id="codeTheme">
|
||||||
|
`
|
||||||
this.rewriteIframe()
|
this.rewriteIframe()
|
||||||
|
this.applyStyle()
|
||||||
|
|
||||||
this.refs.root.contentWindow.document.addEventListener('mousedown', this.mouseDownHandler)
|
this.refs.root.contentWindow.document.addEventListener('mousedown', this.mouseDownHandler)
|
||||||
this.refs.root.contentWindow.document.addEventListener('mouseup', this.mouseUpHandler)
|
this.refs.root.contentWindow.document.addEventListener('mouseup', this.mouseUpHandler)
|
||||||
@@ -83,71 +144,113 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
if (prevProps.value !== this.props.value ||
|
if (prevProps.value !== this.props.value) this.rewriteIframe()
|
||||||
prevProps.fontFamily !== this.props.fontFamily ||
|
if (prevProps.fontFamily !== this.props.fontFamily ||
|
||||||
prevProps.fontSize !== this.props.fontSize ||
|
prevProps.fontSize !== this.props.fontSize ||
|
||||||
prevProps.codeBlockFontFamily !== this.props.codeBlockFontFamily ||
|
prevProps.codeBlockFontFamily !== this.props.codeBlockFontFamily ||
|
||||||
prevProps.codeBlockTheme !== this.props.codeBlockTheme ||
|
prevProps.codeBlockTheme !== this.props.codeBlockTheme ||
|
||||||
prevProps.lineNumber !== this.props.lineNumber ||
|
prevProps.lineNumber !== this.props.lineNumber ||
|
||||||
prevProps.theme !== this.props.theme
|
prevProps.theme !== this.props.theme) {
|
||||||
) this.rewriteIframe()
|
this.applyStyle()
|
||||||
|
this.rewriteIframe()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rewriteIframe () {
|
applyStyle () {
|
||||||
Array.prototype.forEach.call(this.refs.root.contentWindow.document.querySelectorAll('a'), (el) => {
|
let { fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme } = this.props
|
||||||
el.removeEventListener('click', this.anchorClickHandler)
|
|
||||||
})
|
|
||||||
Array.prototype.forEach.call(this.refs.root.contentWindow.document.querySelectorAll('input[type="checkbox"]'), (el) => {
|
|
||||||
el.removeEventListener('click', this.checkboxClickHandler)
|
|
||||||
})
|
|
||||||
|
|
||||||
let { value, fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme, theme } = this.props
|
|
||||||
fontFamily = _.isString(fontFamily) && fontFamily.trim().length > 0
|
fontFamily = _.isString(fontFamily) && fontFamily.trim().length > 0
|
||||||
? [fontFamily].concat(defaultFontFamily)
|
? [fontFamily].concat(defaultFontFamily)
|
||||||
: defaultFontFamily
|
: defaultFontFamily
|
||||||
codeBlockFontFamily = _.isString(codeBlockFontFamily) && codeBlockFontFamily.trim().length > 0
|
codeBlockFontFamily = _.isString(codeBlockFontFamily) && codeBlockFontFamily.trim().length > 0
|
||||||
? [codeBlockFontFamily].concat(defaultCodeBlockFontFamily)
|
? [codeBlockFontFamily].concat(defaultCodeBlockFontFamily)
|
||||||
: defaultCodeBlockFontFamily
|
: defaultCodeBlockFontFamily
|
||||||
codeBlockTheme = hljsTheme().some((theme) => theme.name === codeBlockTheme) ? codeBlockTheme : 'xcode'
|
|
||||||
|
|
||||||
this.refs.root.contentWindow.document.head.innerHTML = `
|
this.setCodeTheme(codeBlockTheme)
|
||||||
<style>
|
this.getWindow().document.getElementById('style').innerHTML = buildStyle(fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme, lineNumber)
|
||||||
@font-face {
|
|
||||||
font-family: 'Lato';
|
|
||||||
src: url('../resources/fonts/Lato-Regular.woff2') format('woff2'), /* Modern Browsers */
|
|
||||||
url('../resources/fonts/Lato-Regular.woff') format('woff'), /* Modern Browsers */
|
|
||||||
url('../resources/fonts/Lato-Regular.ttf') format('truetype');
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
text-rendering: optimizeLegibility;
|
|
||||||
}
|
}
|
||||||
${markdownStyle}
|
|
||||||
body {
|
setCodeTheme (theme) {
|
||||||
font-family: ${fontFamily.join(', ')};
|
theme = consts.THEMES.some((_theme) => _theme === theme)
|
||||||
font-size: ${fontSize}px;
|
? theme
|
||||||
|
: 'default'
|
||||||
|
this.getWindow().document.getElementById('codeTheme').href = `${appPath}/node_modules/codemirror/theme/${theme}.css`
|
||||||
}
|
}
|
||||||
code {
|
|
||||||
font-family: ${codeBlockFontFamily.join(', ')};
|
rewriteIframe () {
|
||||||
}
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('a'), (el) => {
|
||||||
.lineNumber {
|
el.removeEventListener('click', this.anchorClickHandler)
|
||||||
${lineNumber && 'display: block !important;'}
|
})
|
||||||
font-family: ${codeBlockFontFamily.join(', ')};
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('input[type="checkbox"]'), (el) => {
|
||||||
opacity: 0.5;
|
el.removeEventListener('click', this.checkboxClickHandler)
|
||||||
}
|
})
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../node_modules/highlight.js/styles/${codeBlockTheme}.css">
|
let { value, theme, indentSize, codeBlockTheme } = this.props
|
||||||
<link rel="stylesheet" href="../compiled/katex-style.css">
|
|
||||||
`
|
|
||||||
|
|
||||||
this.refs.root.contentWindow.document.body.setAttribute('data-theme', theme)
|
this.refs.root.contentWindow.document.body.setAttribute('data-theme', theme)
|
||||||
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value)
|
this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value)
|
||||||
|
|
||||||
Array.prototype.forEach.call(this.refs.root.contentWindow.document.querySelectorAll('a'), (el) => {
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('a'), (el) => {
|
||||||
el.addEventListener('click', this.anchorClickHandler)
|
el.addEventListener('click', this.anchorClickHandler)
|
||||||
})
|
})
|
||||||
Array.prototype.forEach.call(this.refs.root.contentWindow.document.querySelectorAll('input[type="checkbox"]'), (el) => {
|
|
||||||
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('input[type="checkbox"]'), (el) => {
|
||||||
el.addEventListener('click', this.checkboxClickHandler)
|
el.addEventListener('click', this.checkboxClickHandler)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
codeBlockTheme = consts.THEMES.some((_theme) => _theme === codeBlockTheme)
|
||||||
|
? codeBlockTheme
|
||||||
|
: 'default'
|
||||||
|
|
||||||
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('.code code'), (el) => {
|
||||||
|
let syntax = CodeMirror.findModeByName(el.className)
|
||||||
|
if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text')
|
||||||
|
CodeMirror.requireMode(syntax.mode, () => {
|
||||||
|
let content = el.innerHTML
|
||||||
|
el.innerHTML = ''
|
||||||
|
el.parentNode.className += ` cm-s-${codeBlockTheme} CodeMirror`
|
||||||
|
CodeMirror.runMode(content, syntax.mime, el, {
|
||||||
|
tabSize: indentSize
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
let opts = {}
|
||||||
|
// if (this.props.theme === 'dark') {
|
||||||
|
// opts['font-color'] = '#DDD'
|
||||||
|
// opts['line-color'] = '#DDD'
|
||||||
|
// opts['element-color'] = '#DDD'
|
||||||
|
// opts['fill'] = '#3A404C'
|
||||||
|
// }
|
||||||
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('.flowchart'), (el) => {
|
||||||
|
Raphael.setWindow(this.getWindow())
|
||||||
|
try {
|
||||||
|
let diagram = flowchart.parse(decodeHTMLEntities(el.innerHTML))
|
||||||
|
el.innerHTML = ''
|
||||||
|
diagram.drawSVG(el, opts)
|
||||||
|
_.forEach(el.querySelectorAll('a'), (el) => {
|
||||||
|
el.addEventListener('click', this.anchorClickHandler)
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
el.className = 'flowchart-error'
|
||||||
|
el.innerHTML = 'Flowchart parse error: ' + e.message
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('.sequence'), (el) => {
|
||||||
|
Raphael.setWindow(this.getWindow())
|
||||||
|
try {
|
||||||
|
let diagram = SequenceDiagram.parse(decodeHTMLEntities(el.innerHTML))
|
||||||
|
el.innerHTML = ''
|
||||||
|
diagram.drawSVG(el, {theme: 'simple'})
|
||||||
|
_.forEach(el.querySelectorAll('a'), (el) => {
|
||||||
|
el.addEventListener('click', this.anchorClickHandler)
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
el.className = 'sequence-error'
|
||||||
|
el.innerHTML = 'Sequence diagram parse error: ' + e.message
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
focus () {
|
focus () {
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ body
|
|||||||
padding 5px
|
padding 5px
|
||||||
margin -5px
|
margin -5px
|
||||||
border-radius 5px
|
border-radius 5px
|
||||||
|
.flowchart-error, .sequence-error
|
||||||
|
background-color errorBackgroundColor
|
||||||
|
color errorTextColor
|
||||||
|
padding 5px
|
||||||
|
border-radius 5px
|
||||||
|
justify-content left
|
||||||
li
|
li
|
||||||
label.taskListItem
|
label.taskListItem
|
||||||
margin-left -2em
|
margin-left -2em
|
||||||
@@ -191,7 +197,7 @@ code
|
|||||||
padding 0.2em 0.4em
|
padding 0.2em 0.4em
|
||||||
background-color #f7f7f7
|
background-color #f7f7f7
|
||||||
border-radius 3px
|
border-radius 3px
|
||||||
font-size 0.85em
|
font-size 1em
|
||||||
text-decoration none
|
text-decoration none
|
||||||
margin-right 2px
|
margin-right 2px
|
||||||
pre
|
pre
|
||||||
@@ -200,26 +206,40 @@ pre
|
|||||||
border-radius 5px
|
border-radius 5px
|
||||||
overflow-x auto
|
overflow-x auto
|
||||||
margin 0 0 1em
|
margin 0 0 1em
|
||||||
line-height 1.35
|
display flex
|
||||||
|
line-height 1.4em
|
||||||
|
&.flowchart, &.sequence
|
||||||
|
display flex
|
||||||
|
justify-content center
|
||||||
|
background-color white
|
||||||
|
&.CodeMirror
|
||||||
|
height initial
|
||||||
|
&>code
|
||||||
|
flex 1
|
||||||
|
overflow-x auto
|
||||||
code
|
code
|
||||||
margin 0
|
|
||||||
background-color inherit
|
background-color inherit
|
||||||
|
margin 0
|
||||||
padding 0
|
padding 0
|
||||||
border none
|
border none
|
||||||
border-radius 0
|
border-radius 0
|
||||||
pre
|
|
||||||
border none
|
|
||||||
margin -5px
|
|
||||||
&>span.lineNumber
|
&>span.lineNumber
|
||||||
display none
|
display none
|
||||||
float left
|
font-size 1em
|
||||||
font-size 0.85em
|
padding 0.5em 0
|
||||||
margin 0 0.5em 0 -0.5em
|
margin -0.5em 0.5em -0.5em -0.5em
|
||||||
border-right 1px solid
|
border-right 1px solid
|
||||||
text-align right
|
text-align right
|
||||||
|
border-top-left-radius 4px
|
||||||
|
border-bottom-left-radius 4px
|
||||||
|
&.CodeMirror-gutters
|
||||||
|
position initial
|
||||||
|
top initial
|
||||||
|
left initial
|
||||||
|
min-height 0 !important
|
||||||
&>span
|
&>span
|
||||||
display block
|
display block
|
||||||
padding 0 .5em 0 1em
|
padding 0 .5em 0
|
||||||
table
|
table
|
||||||
display block
|
display block
|
||||||
width 100%
|
width 100%
|
||||||
@@ -269,7 +289,7 @@ body[data-theme="dark"]
|
|||||||
|
|
||||||
code
|
code
|
||||||
border-color darken(themeDarkBorder, 10%)
|
border-color darken(themeDarkBorder, 10%)
|
||||||
background-color lighten(themeDarkPreview, 5%)
|
background-color lighten(themeDarkPreview, 10%)
|
||||||
|
|
||||||
pre
|
pre
|
||||||
border-color lighten(#21252B, 20%)
|
border-color lighten(#21252B, 20%)
|
||||||
|
|||||||
@@ -185,11 +185,13 @@ class NoteDetail extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<MarkdownPreview styleName='root'
|
<MarkdownPreview styleName='root'
|
||||||
|
theme={config.ui.theme}
|
||||||
fontSize={config.preview.fontSize}
|
fontSize={config.preview.fontSize}
|
||||||
fontFamily={config.preview.fontFamily}
|
fontFamily={config.preview.fontFamily}
|
||||||
codeBlockTheme={config.preview.codeBlockTheme}
|
codeBlockTheme={config.preview.codeBlockTheme}
|
||||||
codeBlockFontFamily={config.editor.fontFamily}
|
codeBlockFontFamily={config.editor.fontFamily}
|
||||||
lineNumber={config.preview.lineNumber}
|
lineNumber={config.preview.lineNumber}
|
||||||
|
indentSize={editorIndentSize}
|
||||||
value={note.content}
|
value={note.content}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import CodeMirror from 'codemirror'
|
import CodeMirror from 'codemirror'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
CodeMirror.modeInfo.push({name: 'Stylus', mime: 'text/x-styl', mode: 'stylus', ext: ['styl']})
|
CodeMirror.modeInfo.push({name: 'Stylus', mime: 'text/x-styl', mode: 'stylus', ext: ['styl'], alias: ['styl']})
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
const hljsThemeList = [
|
|
||||||
{caption: 'Default', name: 'default'},
|
|
||||||
{caption: 'Agate', name: 'agate'},
|
|
||||||
{caption: 'Androidstudio', name: 'androidstudio'},
|
|
||||||
{caption: 'Arduino Light', name: 'arduino-light'},
|
|
||||||
{caption: 'Arta', name: 'arta'},
|
|
||||||
{caption: 'Ascetic', name: 'ascetic'},
|
|
||||||
{caption: 'Atelier Cave Dark', name: 'atelier-cave-dark'},
|
|
||||||
{caption: 'Atelier Cave Light', name: 'atelier-cave-light'},
|
|
||||||
{caption: 'Atelier Dune Dark', name: 'atelier-dune-dark'},
|
|
||||||
{caption: 'Atelier Dune Light', name: 'atelier-dune-light'},
|
|
||||||
{caption: 'Atelier Estuary Dark', name: 'atelier-estuary-dark'},
|
|
||||||
{caption: 'Atelier Estuary Light', name: 'atelier-estuary-light'},
|
|
||||||
{caption: 'Atelier Forest Dark', name: 'atelier-forest-dark'},
|
|
||||||
{caption: 'Atelier Forest Light', name: 'atelier-forest-light'},
|
|
||||||
{caption: 'Atelier Heath Dark', name: 'atelier-heath-dark'},
|
|
||||||
{caption: 'Atelier Heath Light', name: 'atelier-heath-light'},
|
|
||||||
{caption: 'Atelier Lakeside Dark', name: 'atelier-lakeside-dark'},
|
|
||||||
{caption: 'Atelier Lakeside Light', name: 'atelier-lakeside-light'},
|
|
||||||
{caption: 'Atelier Plateau Dark', name: 'atelier-plateau-dark'},
|
|
||||||
{caption: 'Atelier Plateau Light', name: 'atelier-plateau-light'},
|
|
||||||
{caption: 'Atelier Savanna Dark', name: 'atelier-savanna-dark'},
|
|
||||||
{caption: 'Atelier Savanna Light', name: 'atelier-savanna-light'},
|
|
||||||
{caption: 'Atelier Seaside Dark', name: 'atelier-seaside-dark'},
|
|
||||||
{caption: 'Atelier Seaside Light', name: 'atelier-seaside-light'},
|
|
||||||
{caption: 'Atelier Sulphurpool Dark', name: 'atelier-sulphurpool-dark'},
|
|
||||||
{caption: 'Atelier Sulphurpool Light', name: 'atelier-sulphurpool-light'},
|
|
||||||
{caption: 'Brown Paper', name: 'brown-paper'},
|
|
||||||
{caption: 'Codepen Embed', name: 'codepen-embed'},
|
|
||||||
{caption: 'Color Brewer', name: 'color-brewer'},
|
|
||||||
{caption: 'Dark', name: 'dark'},
|
|
||||||
{caption: 'Darkula', name: 'darkula'},
|
|
||||||
{caption: 'Docco', name: 'docco'},
|
|
||||||
{caption: 'Dracula', name: 'dracula'},
|
|
||||||
{caption: 'Far', name: 'far'},
|
|
||||||
{caption: 'Foundation', name: 'foundation'},
|
|
||||||
{caption: 'Github Gist', name: 'github-gist'},
|
|
||||||
{caption: 'Github', name: 'github'},
|
|
||||||
{caption: 'Googlecode', name: 'googlecode'},
|
|
||||||
{caption: 'Grayscale', name: 'grayscale'},
|
|
||||||
{caption: 'Gruvbox Dark', name: 'gruvbox.dark'},
|
|
||||||
{caption: 'Gruvbox Light', name: 'gruvbox.light'},
|
|
||||||
{caption: 'Hopscotch', name: 'hopscotch'},
|
|
||||||
{caption: 'Hybrid', name: 'hybrid'},
|
|
||||||
{caption: 'Idea', name: 'idea'},
|
|
||||||
{caption: 'Ir Black', name: 'ir-black'},
|
|
||||||
{caption: 'Kimbie Dark', name: 'kimbie.dark'},
|
|
||||||
{caption: 'Kimbie Light', name: 'kimbie.light'},
|
|
||||||
{caption: 'Magula', name: 'magula'},
|
|
||||||
{caption: 'Mono Blue', name: 'mono-blue'},
|
|
||||||
{caption: 'Monokai Sublime', name: 'monokai-sublime'},
|
|
||||||
{caption: 'Monokai', name: 'monokai'},
|
|
||||||
{caption: 'Obsidian', name: 'obsidian'},
|
|
||||||
{caption: 'Paraiso Dark', name: 'paraiso-dark'},
|
|
||||||
{caption: 'Paraiso Light', name: 'paraiso-light'},
|
|
||||||
{caption: 'Pojoaque', name: 'pojoaque'},
|
|
||||||
{caption: 'Qtcreator Dark', name: 'qtcreator_dark'},
|
|
||||||
{caption: 'Qtcreator Light', name: 'qtcreator_light'},
|
|
||||||
{caption: 'Railscasts', name: 'railscasts'},
|
|
||||||
{caption: 'Rainbow', name: 'rainbow'},
|
|
||||||
{caption: 'School Book', name: 'school-book'},
|
|
||||||
{caption: 'Solarized Dark', name: 'solarized-dark'},
|
|
||||||
{caption: 'Solarized Light', name: 'solarized-light'},
|
|
||||||
{caption: 'Sunburst', name: 'sunburst'},
|
|
||||||
{caption: 'Tomorrow Night Blue', name: 'tomorrow-night-blue'},
|
|
||||||
{caption: 'Tomorrow Night Bright', name: 'tomorrow-night-bright'},
|
|
||||||
{caption: 'Tomorrow Night Eighties', name: 'tomorrow-night-eighties'},
|
|
||||||
{caption: 'Tomorrow Night', name: 'tomorrow-night'},
|
|
||||||
{caption: 'Tomorrow', name: 'tomorrow'},
|
|
||||||
{caption: 'Vs', name: 'vs'},
|
|
||||||
{caption: 'Xcode', name: 'xcode'},
|
|
||||||
{caption: 'Xt 256', name: 'xt256'},
|
|
||||||
{caption: 'Zenburn', name: 'zenburn'}
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function hljsTheme () {
|
|
||||||
return hljsThemeList
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import markdownit from 'markdown-it'
|
import markdownit from 'markdown-it'
|
||||||
import emoji from 'markdown-it-emoji'
|
import emoji from 'markdown-it-emoji'
|
||||||
import math from '@rokt33r/markdown-it-math'
|
import math from '@rokt33r/markdown-it-math'
|
||||||
import hljs from 'highlight.js'
|
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
const katex = window.katex
|
const katex = window.katex
|
||||||
@@ -10,9 +9,9 @@ function createGutter (str) {
|
|||||||
let lc = (str.match(/\n/g) || []).length
|
let lc = (str.match(/\n/g) || []).length
|
||||||
let lines = []
|
let lines = []
|
||||||
for (let i = 1; i <= lc; i++) {
|
for (let i = 1; i <= lc; i++) {
|
||||||
lines.push('<span>' + i + '</span>')
|
lines.push('<span class="CodeMirror-linenumber">' + i + '</span>')
|
||||||
}
|
}
|
||||||
return '<span class="lineNumber">' + lines.join('') + '</span>'
|
return '<span class="lineNumber CodeMirror-gutters">' + lines.join('') + '</span>'
|
||||||
}
|
}
|
||||||
|
|
||||||
var md = markdownit({
|
var md = markdownit({
|
||||||
@@ -21,19 +20,16 @@ var md = markdownit({
|
|||||||
html: true,
|
html: true,
|
||||||
xhtmlOut: true,
|
xhtmlOut: true,
|
||||||
highlight: function (str, lang) {
|
highlight: function (str, lang) {
|
||||||
if (lang && hljs.getLanguage(lang)) {
|
if (lang === 'flowchart') {
|
||||||
try {
|
return `<pre class="flowchart">${str}</pre>`
|
||||||
return '<pre class="hljs">' +
|
|
||||||
createGutter(str) +
|
|
||||||
'<code>' +
|
|
||||||
hljs.highlight(lang, str).value +
|
|
||||||
'</code></pre>'
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
}
|
||||||
return '<pre class="hljs">' +
|
if (lang === 'sequence') {
|
||||||
|
return `<pre class="sequence">${str}</pre>`
|
||||||
|
}
|
||||||
|
return '<pre class="code">' +
|
||||||
createGutter(str) +
|
createGutter(str) +
|
||||||
'<code>' +
|
'<code class="' + lang + '">' +
|
||||||
str.replace(/\&/g, '&').replace(/\</g, '<').replace(/\>/g, '>').replace(/\"/g, '"') +
|
str +
|
||||||
'</code></pre>'
|
'</code></pre>'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -139,13 +135,13 @@ function strip (input) {
|
|||||||
.replace(/`{3}.*\n/g, '')
|
.replace(/`{3}.*\n/g, '')
|
||||||
.replace(/<(.*?)>/g, '$1')
|
.replace(/<(.*?)>/g, '$1')
|
||||||
.replace(/^[=\-]{2,}\s*$/g, '')
|
.replace(/^[=\-]{2,}\s*$/g, '')
|
||||||
.replace(/\[\^.+?\](\: .*?$)?/g, '')
|
.replace(/\[\^.+?\](: .*?$)?/g, '')
|
||||||
.replace(/\s{0,2}\[.*?\]: .*?$/g, '')
|
.replace(/\s{0,2}\[.*?\]: .*?$/g, '')
|
||||||
.replace(/\!\[.*?\][\[\(].*?[\]\)]/g, '')
|
.replace(/!\[.*?\][\[\(].*?[\]\)]/g, '')
|
||||||
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
|
||||||
.replace(/>/g, '')
|
.replace(/>/g, '')
|
||||||
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
|
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
|
||||||
.replace(/^\#{1,6}\s*([^#]*)\s*(\#{1,6})?/gm, '$1')
|
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
|
||||||
.replace(/([\*_]{1,3})(\S.*?\S)\1/g, '$2')
|
.replace(/([\*_]{1,3})(\S.*?\S)\1/g, '$2')
|
||||||
.replace(/(`{3,})(.*?)\1/gm, '$2')
|
.replace(/(`{3,})(.*?)\1/gm, '$2')
|
||||||
.replace(/^-{3,}\s*$/g, '')
|
.replace(/^-{3,}\s*$/g, '')
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ class SnippetNoteDetail extends React.Component {
|
|||||||
key={index}
|
key={index}
|
||||||
style={{zIndex: isActive ? 5 : 4}}
|
style={{zIndex: isActive ? 5 : 4}}
|
||||||
>
|
>
|
||||||
{snippet.mode === 'markdown'
|
{snippet.mode === 'Markdown' || snippet.mode === 'GitHub Flavored Markdown'
|
||||||
? <MarkdownEditor styleName='tabView-content'
|
? <MarkdownEditor styleName='tabView-content'
|
||||||
value={snippet.content}
|
value={snippet.content}
|
||||||
config={config}
|
config={config}
|
||||||
|
|||||||
@@ -165,3 +165,6 @@ body[data-theme="dark"]
|
|||||||
|
|
||||||
.tabList .plusButton
|
.tabList .plusButton
|
||||||
navDarkButtonColor()
|
navDarkButtonColor()
|
||||||
|
.override
|
||||||
|
button
|
||||||
|
border-color $ui-dark-borderColor
|
||||||
|
|||||||
@@ -133,7 +133,6 @@
|
|||||||
border-top-right-radius 2px
|
border-top-right-radius 2px
|
||||||
border-bottom-right-radius 2px
|
border-bottom-right-radius 2px
|
||||||
height 26px
|
height 26px
|
||||||
margin-top -26px
|
|
||||||
line-height 26px
|
line-height 26px
|
||||||
|
|
||||||
.root--folded
|
.root--folded
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.root
|
.root
|
||||||
absolute bottom left right
|
absolute bottom left right
|
||||||
height $statusBar-height - 1
|
height $statusBar-height
|
||||||
background-color $ui-backgroundColor
|
background-color $ui-backgroundColor
|
||||||
border-top $ui-border
|
border-top $ui-border
|
||||||
display flex
|
display flex
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
body[data-theme="dark"]
|
body[data-theme="dark"]
|
||||||
.root
|
.root
|
||||||
background-color $ui-dark-backgroundColor
|
background-color $ui-dark-backgroundColor
|
||||||
|
border-color $ui-dark-borderColor
|
||||||
|
|
||||||
.zoom
|
.zoom
|
||||||
border-color $ui-dark-borderColor
|
border-color $ui-dark-borderColor
|
||||||
|
|||||||
@@ -71,10 +71,10 @@ class TopBar extends React.Component {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (storage == null) throw new Error('No storage to create a note')
|
if (storage == null) alert('No storage to create a note')
|
||||||
let folder = _.find(storage.folders, {key: params.folderKey})
|
let folder = _.find(storage.folders, {key: params.folderKey})
|
||||||
if (folder == null) folder = storage.folders[0]
|
if (folder == null) folder = storage.folders[0]
|
||||||
if (folder == null) throw new Error('No folder to craete a note')
|
if (folder == null) alert('No folder to create a note')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
storage,
|
storage,
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ body[data-theme="dark"]
|
|||||||
font-family inherit !important
|
font-family inherit !important
|
||||||
line-height 1.4em
|
line-height 1.4em
|
||||||
height 100%
|
height 100%
|
||||||
|
.CodeMirror > div > textarea
|
||||||
|
margin-bottom -1em
|
||||||
.CodeMirror-focused .CodeMirror-selected
|
.CodeMirror-focused .CodeMirror-selected
|
||||||
background #B1D7FE
|
background #B1D7FE
|
||||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection
|
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, { PropTypes } from 'react'
|
import React, { PropTypes } from 'react'
|
||||||
import CSSModules from 'browser/lib/CSSModules'
|
import CSSModules from 'browser/lib/CSSModules'
|
||||||
import styles from './ConfigTab.styl'
|
import styles from './ConfigTab.styl'
|
||||||
import hljsTheme from 'browser/lib/hljsThemes'
|
|
||||||
import ConfigManager from 'browser/main/lib/ConfigManager'
|
import ConfigManager from 'browser/main/lib/ConfigManager'
|
||||||
import store from 'browser/main/store'
|
import store from 'browser/main/store'
|
||||||
import consts from 'browser/lib/consts'
|
import consts from 'browser/lib/consts'
|
||||||
@@ -154,7 +153,6 @@ class ConfigTab extends React.Component {
|
|||||||
</p>
|
</p>
|
||||||
: null
|
: null
|
||||||
let themes = consts.THEMES
|
let themes = consts.THEMES
|
||||||
let hljsThemeList = hljsTheme()
|
|
||||||
let { config } = this.state
|
let { config } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -369,8 +367,8 @@ class ConfigTab extends React.Component {
|
|||||||
onChange={(e) => this.handleUIChange(e)}
|
onChange={(e) => this.handleUIChange(e)}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
hljsThemeList.map((theme) => {
|
themes.map((theme) => {
|
||||||
return (<option value={theme.name} key={theme.name}>{theme.caption}</option>)
|
return (<option value={theme} key={theme}>{theme}</option>)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -86,6 +86,10 @@
|
|||||||
p
|
p
|
||||||
line-height 1.2
|
line-height 1.2
|
||||||
|
|
||||||
|
colorDarkControl()
|
||||||
|
border-color $ui-dark-borderColor
|
||||||
|
background-color $ui-dark-backgroundColor
|
||||||
|
color $ui-dark-text-color
|
||||||
body[data-theme="dark"]
|
body[data-theme="dark"]
|
||||||
.root
|
.root
|
||||||
color $ui-dark-text-color
|
color $ui-dark-text-color
|
||||||
@@ -108,6 +112,7 @@ body[data-theme="dark"]
|
|||||||
.group-control-rightButton
|
.group-control-rightButton
|
||||||
colorDarkPrimaryButton()
|
colorDarkPrimaryButton()
|
||||||
.group-hint
|
.group-hint
|
||||||
border-color $ui-dark-borderColor
|
colorDarkControl()
|
||||||
background-color $ui-dark-backgroundColor
|
.group-section-control
|
||||||
color $ui-dark-text-color
|
select, .group-section-control-input
|
||||||
|
colorDarkControl()
|
||||||
|
|||||||
@@ -300,10 +300,10 @@ class StorageItem extends React.Component {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
let { storage, dispatch } = this.props
|
let { storage } = this.props
|
||||||
dataApi.removeStorage(storage.key)
|
dataApi.removeStorage(storage.key)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
dispatch({
|
store.dispatch({
|
||||||
type: 'REMOVE_STORAGE',
|
type: 'REMOVE_STORAGE',
|
||||||
storageKey: storage.key
|
storageKey: storage.key
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ $ npm run hot
|
|||||||
```
|
```
|
||||||
> Actually the app can be start with `npm start`. However, the app will use the compiled script.
|
> Actually the app can be start with `npm start`. However, the app will use the compiled script.
|
||||||
|
|
||||||
|
If the app gets stuck on load, you may need to run the following.
|
||||||
|
```
|
||||||
|
$ npm run vendor
|
||||||
|
```
|
||||||
|
|
||||||
By this, webpack will watch the code changes and apply it automatically.
|
By this, webpack will watch the code changes and apply it automatically.
|
||||||
|
|
||||||
> ### Notice
|
> ### Notice
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
||||||
<link rel="stylesheet" href="../node_modules/highlight.js/styles/xcode.css" id="hljs-css">
|
|
||||||
<link rel="shortcut icon" href="favicon.ico">
|
<link rel="shortcut icon" href="favicon.ico">
|
||||||
<link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
|
<link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
|
||||||
|
|
||||||
@@ -34,6 +33,9 @@
|
|||||||
<script src="../node_modules/codemirror/keymap/sublime.js"></script>
|
<script src="../node_modules/codemirror/keymap/sublime.js"></script>
|
||||||
<script src="../node_modules/codemirror/addon/runmode/runmode.js"></script>
|
<script src="../node_modules/codemirror/addon/runmode/runmode.js"></script>
|
||||||
|
|
||||||
|
<script src="../compiled/raphael.js"></script>
|
||||||
|
<script src="../compiled/flowchart.js"></script>
|
||||||
|
|
||||||
<script src="../compiled/katex.js"></script>
|
<script src="../compiled/katex.js"></script>
|
||||||
<script src="../compiled/react.js"></script>
|
<script src="../compiled/react.js"></script>
|
||||||
<script src="../compiled/react-dom.js"></script>
|
<script src="../compiled/react-dom.js"></script>
|
||||||
@@ -43,12 +45,12 @@
|
|||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
electron.webFrame.setZoomLevelLimits(1, 1)
|
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
var scriptUrl = _.find(electron.remote.process.argv, a => a === '--hot')
|
var scriptUrl = _.find(electron.remote.process.argv, (a) => a === '--hot')
|
||||||
? 'http://localhost:8080/assets/finder.js'
|
? 'http://localhost:8080/assets/finder.js'
|
||||||
: '../compiled/finder.js'
|
: '../compiled/finder.js'
|
||||||
var scriptEl = document.createElement('script')
|
var scriptEl = document.createElement('script')
|
||||||
scriptEl.setAttribute("type","text/javascript")
|
scriptEl.setAttribute('type', 'text/javascript')
|
||||||
scriptEl.setAttribute("src", scriptUrl)
|
scriptEl.setAttribute('src', scriptUrl)
|
||||||
document.body.appendChild(scriptEl)
|
document.body.appendChild(scriptEl)
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ var file = {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'New Note',
|
label: 'New Note',
|
||||||
accelerator: OSX ? 'Command + N' : 'Control + N',
|
accelerator: 'CmdOrCtrl + N',
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.webContents.send('top:new-note')
|
mainWindow.webContents.send('top:new-note')
|
||||||
}
|
}
|
||||||
@@ -125,20 +125,14 @@ var view = {
|
|||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: (function () {
|
accelerator: 'CmdOrCtrl+R',
|
||||||
if (process.platform === 'darwin') return 'Command+R'
|
|
||||||
else return 'Ctrl+R'
|
|
||||||
})(),
|
|
||||||
click: function () {
|
click: function () {
|
||||||
BrowserWindow.getFocusedWindow().reload()
|
BrowserWindow.getFocusedWindow().reload()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle Developer Tools',
|
label: 'Toggle Developer Tools',
|
||||||
accelerator: (function () {
|
accelerator: OSX ? 'Command+Alt+I' : 'Ctrl+Shift+I',
|
||||||
if (process.platform === 'darwin') return 'Command+Alt+I'
|
|
||||||
else return 'Ctrl+Shift+I'
|
|
||||||
})(),
|
|
||||||
click: function () {
|
click: function () {
|
||||||
BrowserWindow.getFocusedWindow().toggleDevTools()
|
BrowserWindow.getFocusedWindow().toggleDevTools()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ const app = electron.app
|
|||||||
const BrowserWindow = electron.BrowserWindow
|
const BrowserWindow = electron.BrowserWindow
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
var showMenu = process.platform !== 'win32'
|
||||||
|
|
||||||
var mainWindow = new BrowserWindow({
|
var mainWindow = new BrowserWindow({
|
||||||
width: 1080,
|
width: 1080,
|
||||||
height: 720,
|
height: 720,
|
||||||
minWidth: 420,
|
minWidth: 420,
|
||||||
minHeight: 320,
|
minHeight: 320,
|
||||||
|
autoHideMenuBar: showMenu,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
zoomFactor: 1.0,
|
zoomFactor: 1.0,
|
||||||
blinkFeatures: 'OverlayScrollbars'
|
blinkFeatures: 'OverlayScrollbars'
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
|
||||||
|
|
||||||
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
|
||||||
<link rel="stylesheet" href="../node_modules/highlight.js/styles/xcode.css" id="hljs-css">
|
|
||||||
<link rel="shortcut icon" href="../resources/favicon.ico">
|
<link rel="shortcut icon" href="../resources/favicon.ico">
|
||||||
<link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
|
<link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
|
||||||
<title>Boostnote</title>
|
<title>Boostnote</title>
|
||||||
@@ -62,6 +61,13 @@
|
|||||||
|
|
||||||
<script src="../node_modules/codemirror/addon/edit/continuelist.js"></script>
|
<script src="../node_modules/codemirror/addon/edit/continuelist.js"></script>
|
||||||
|
|
||||||
|
<script src="../compiled/raphael.js"></script>
|
||||||
|
<script src="../compiled/flowchart.js"></script>
|
||||||
|
<script>
|
||||||
|
window._ = require('lodash')
|
||||||
|
</script>
|
||||||
|
<script src="../compiled/sequence-diagram.js"></script>
|
||||||
|
|
||||||
<script src="../compiled/katex.js"></script>
|
<script src="../compiled/katex.js"></script>
|
||||||
<script src="../compiled/react.js"></script>
|
<script src="../compiled/react.js"></script>
|
||||||
<script src="../compiled/react-dom.js"></script>
|
<script src="../compiled/react-dom.js"></script>
|
||||||
@@ -70,8 +76,7 @@
|
|||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
electron.webFrame.setZoomLevelLimits(1, 1)
|
electron.webFrame.setZoomLevelLimits(1, 1)
|
||||||
const _ = require('lodash')
|
var scriptUrl = window._.find(electron.remote.process.argv, (a) => a === '--hot')
|
||||||
var scriptUrl = _.find(electron.remote.process.argv, (a) => a === '--hot')
|
|
||||||
? 'http://localhost:8080/assets/main.js'
|
? 'http://localhost:8080/assets/main.js'
|
||||||
: '../compiled/main.js'
|
: '../compiled/main.js'
|
||||||
var scriptEl = document.createElement('script')
|
var scriptEl = document.createElement('script')
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
"redux": "https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js",
|
"redux": "https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js",
|
||||||
"react-redux": "https://unpkg.com/react-redux@4.4.5/dist/react-redux.min.js",
|
"react-redux": "https://unpkg.com/react-redux@4.4.5/dist/react-redux.min.js",
|
||||||
"katex": "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js",
|
"katex": "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js",
|
||||||
"katex-style": "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css"
|
"katex-style": "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css",
|
||||||
|
"raphael": "https://raw.githubusercontent.com/DmitryBaranovskiy/raphael/master/raphael.js",
|
||||||
|
"flowchart": "https://cdnjs.cloudflare.com/ajax/libs/flowchart/1.6.3/flowchart.js",
|
||||||
|
"sequence-diagram": "https://cdn.rawgit.com/bramp/js-sequence-diagrams/master/build/sequence-diagram-min.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "boost",
|
"name": "boost",
|
||||||
"version": "0.7.0",
|
"version": "0.7.3",
|
||||||
"description": "Boostnote",
|
"description": "Boostnote",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
@@ -36,7 +36,10 @@
|
|||||||
"Romain Bazile (https://github.com/gromain)",
|
"Romain Bazile (https://github.com/gromain)",
|
||||||
"Bruno Paz (https://github.com/brpaz)",
|
"Bruno Paz (https://github.com/brpaz)",
|
||||||
"Fabian Mueller (https://github.com/dotcs)",
|
"Fabian Mueller (https://github.com/dotcs)",
|
||||||
"Yoshihisa Mochihara (https://github.com/yosmoc)"
|
"Yoshihisa Mochihara (https://github.com/yosmoc)",
|
||||||
|
"Mike Resoli (https://github.com/mikeres0)",
|
||||||
|
"tjado (https://github.com/tejado)",
|
||||||
|
"Sota Sugiura (https://github.com/sota1235)"
|
||||||
],
|
],
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/BoostIO/Boostnote/issues"
|
"url": "https://github.com/BoostIO/Boostnote/issues"
|
||||||
@@ -48,7 +51,6 @@
|
|||||||
"codemirror": "^5.19.0",
|
"codemirror": "^5.19.0",
|
||||||
"electron-gh-releases": "^2.0.2",
|
"electron-gh-releases": "^2.0.2",
|
||||||
"font-awesome": "^4.3.0",
|
"font-awesome": "^4.3.0",
|
||||||
"highlight.js": "^9.3.0",
|
|
||||||
"immutable": "^3.8.1",
|
"immutable": "^3.8.1",
|
||||||
"lodash": "^4.11.1",
|
"lodash": "^4.11.1",
|
||||||
"markdown-it": "^6.0.1",
|
"markdown-it": "^6.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Boostnote
|
# Boostnote
|
||||||
|
|
||||||
> [Boostnote store](#goods)をはじめました!! :tada: そして、[Pateron](https://www.patreon.com/boostnote)からも私達を支援することができます!
|
> [Boostnote store](https://boostnote.paintory.com/)をはじめました!! :tada: そして、[Pateron](https://www.patreon.com/boostnote)からも私達を支援することができます!
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
@@ -73,6 +73,10 @@
|
|||||||
- [Romain Bazile](https://github.com/gromain)
|
- [Romain Bazile](https://github.com/gromain)
|
||||||
- [Bruno Paz](https://github.com/brpaz)
|
- [Bruno Paz](https://github.com/brpaz)
|
||||||
- [Fabian Mueller](https://github.com/dotcs)
|
- [Fabian Mueller](https://github.com/dotcs)
|
||||||
|
- [Yoshihisa Mochihara](https://github.com/yosmoc)
|
||||||
|
- [Mike Resoli](https://github.com/mikeres0)
|
||||||
|
- [tjado](https://github.com/tejado)
|
||||||
|
- [sota1235](https://github.com/sota1235)
|
||||||
|
|
||||||
## Copyright & License
|
## Copyright & License
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Boostnote
|
# Boostnote
|
||||||
|
|
||||||
> [Boostnote store](#goods)가 생겼습니다!! :tada: 그리고,[Pateron](https://www.patreon.com/boostnote)에서도 저희를 지원 하실 수 있습니다.!
|
> [Boostnote store](https://boostnote.paintory.com/)가 생겼습니다!! :tada: 그리고,[Pateron](https://www.patreon.com/boostnote)에서도 저희를 지원 하실 수 있습니다.!
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
@@ -74,6 +74,10 @@
|
|||||||
- [Romain Bazile](https://github.com/gromain)
|
- [Romain Bazile](https://github.com/gromain)
|
||||||
- [Bruno Paz](https://github.com/brpaz)
|
- [Bruno Paz](https://github.com/brpaz)
|
||||||
- [Fabian Mueller](https://github.com/dotcs)
|
- [Fabian Mueller](https://github.com/dotcs)
|
||||||
|
- [Yoshihisa Mochihara](https://github.com/yosmoc)
|
||||||
|
- [Mike Resoli](https://github.com/mikeres0)
|
||||||
|
- [tjado](https://github.com/tejado)
|
||||||
|
- [sota1235](https://github.com/sota1235)
|
||||||
|
|
||||||
## Copyright & License
|
## Copyright & License
|
||||||
|
|
||||||
|
|||||||
79
readme.md
79
readme.md
@@ -1,35 +1,37 @@
|
|||||||
# Boostnote
|
<h1 align="center">
|
||||||
|
<a href="https://github.com/BoostIO/Boostnote"><img src="http://b00st.io/assets/img/logo.png" alt="Boostnote" width="180"></a>
|
||||||
|
<br>
|
||||||
|
Boostnote
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</h1>
|
||||||
|
<h4 align="center">Note app built for developers. </h4>
|
||||||
|
<h5 align="center">macOS, Windows and Linux</h5>
|
||||||
|
<h5 align="center">Built with Electron, React + Redux, Webpack and CSSModules</h5>
|
||||||
|
<h1> </h1>
|
||||||
|
|
||||||
> We launched [Boostnote store](#goods)!! :tada: Also, you can support us from [Patreon](https://www.patreon.com/boostnote)!
|
> We launched our [Boostnote store](https://boostnote.paintory.com/)!! :tada: Also, you can support us via [Patreon](https://www.patreon.com/boostnote) and [Open collective](https://opencollective.com/boostnote)!
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
Simple opensource note app for developer.
|
[日本語](./readme-ja.md) - [한국어](./readme-ko.md)
|
||||||
|
|
||||||
You can use the issue tracker of this repository for
|
## Goals
|
||||||
- asking a question about Boostnote
|
* We want our users to enjoying writing _anything_. :grinning:
|
||||||
- giving a feedback about Boostnote and its future plan
|
* Open sourced forever!
|
||||||
- reporting a bug of Boostnote
|
|
||||||
- wanting to contribute Boostnote
|
|
||||||
|
|
||||||
We have a slack if you want to engage us deeply, ask @rokt33r to join.
|
See upcoming features and bug fixes [here](https://github.com/BoostIO/Boostnote/issues/68)
|
||||||
|
## Feedback
|
||||||
|
Please use the [issue tracker](https://github.com/BoostIO/Boostnote/issues) for questions, bug reporting and contribution information.
|
||||||
|
|
||||||
- [日本語](./readme-ja.md)
|
## Development
|
||||||
- [한국어](./readme-ko.md)
|
If you want to join our dev Slack group ask @rokt33r.
|
||||||
|
**[Build instructions](docs/build.md)**
|
||||||
|
|
||||||
## Goal
|
[](https://github.com/feross/standard)
|
||||||
|
|
||||||
We just want you to enjoying writing anything. :grinning:
|
|
||||||
|
|
||||||
- Target OS : OSX, Windows, Linux(also mobile somewhen!)
|
|
||||||
- Cloud : Google drive, Dropbox, One drive, iCloud...
|
|
||||||
- Remaining opensource forever!
|
|
||||||
|
|
||||||
Check planned features [here](https://github.com/BoostIO/Boostnote/issues/68)!
|
|
||||||
|
|
||||||
## Inspired by
|
|
||||||
|
|
||||||
|
## Inspirations
|
||||||
- Atom
|
- Atom
|
||||||
- Quiver
|
- Quiver
|
||||||
- Evernote
|
- Evernote
|
||||||
@@ -39,50 +41,33 @@ Check planned features [here](https://github.com/BoostIO/Boostnote/issues/68)!
|
|||||||
- Gistbox
|
- Gistbox
|
||||||
- Snippets Lab
|
- Snippets Lab
|
||||||
|
|
||||||
## Using stack
|
## Store
|
||||||
|
|
||||||
- Electron
|
|
||||||
- React
|
|
||||||
- Webpack
|
|
||||||
- Redux
|
|
||||||
- CSSModules
|
|
||||||
|
|
||||||
## Codestyle
|
|
||||||
|
|
||||||
[](https://github.com/feross/standard)
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
- [Build](docs/build.md)
|
|
||||||
|
|
||||||
## Goods
|
|
||||||
|
|
||||||
<img src="https://b00st.io/images/t3.png" width="250"/>
|
<img src="https://b00st.io/images/t3.png" width="250"/>
|
||||||
<img src="https://b00st.io/images/t1.png" width="250"/>
|
<img src="https://b00st.io/images/t1.png" width="250"/>
|
||||||
|
|
||||||
We're currently selling some goods from [Boostnote store](https://boostnote.paintory.com/).
|
We're selling Boostnote goods on the [Boostnote store](https://boostnote.paintory.com/).
|
||||||
|
|
||||||
The product can be sent anywhere in the world. This store is powered by [Paintory](https://paintory.com/)
|
Products are shipped worldwide. Powered by [Paintory](https://paintory.com/)
|
||||||
|
|
||||||
## Donation
|
## Donation
|
||||||
|
* [Patreon](https://www.patreon.com/boostnote)
|
||||||
We launched a [Patreon page](https://www.patreon.com/boostnote).
|
* [Open collective](https://opencollective.com/boostnote)
|
||||||
|
|
||||||
## Author & Maintainer
|
## Author & Maintainer
|
||||||
|
|
||||||
[Rokt33r(Dick Choi of MAISIN&CO.)](https://github.com/rokt33r)
|
[Rokt33r(Dick Choi of MAISIN&CO.)](https://github.com/rokt33r)
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
- [Kazu Yokomizo](https://github.com/kazup01)
|
- [Kazu Yokomizo](https://github.com/kazup01)
|
||||||
- [dojineko](https://github.com/dojineko)
|
- [dojineko](https://github.com/dojineko)
|
||||||
- [Romain Bazile](https://github.com/gromain)
|
- [Romain Bazile](https://github.com/gromain)
|
||||||
- [Bruno Paz](https://github.com/brpaz)
|
- [Bruno Paz](https://github.com/brpaz)
|
||||||
- [Fabian Mueller](https://github.com/dotcs)
|
- [Fabian Mueller](https://github.com/dotcs)
|
||||||
- [Yoshihisa Mochihara](https://github.com/yosmoc)
|
- [Yoshihisa Mochihara](https://github.com/yosmoc)
|
||||||
|
- [Mike Resoli](https://github.com/mikeres0)
|
||||||
|
- [tjado](https://github.com/tejado)
|
||||||
|
- [sota1235](https://github.com/sota1235)
|
||||||
|
|
||||||
## Copyright & License
|
## Copyright & License
|
||||||
|
|
||||||
Copyright (C) 2016 MAISIN&CO.
|
Copyright (C) 2016 MAISIN&CO.
|
||||||
|
|
||||||
[GPL v3](./LICENSE).
|
[GPL v3](./LICENSE).
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ var config = {
|
|||||||
'lodash',
|
'lodash',
|
||||||
'markdown-it',
|
'markdown-it',
|
||||||
'moment',
|
'moment',
|
||||||
'highlight.js',
|
|
||||||
'markdown-it-emoji',
|
'markdown-it-emoji',
|
||||||
'fs-jetpack',
|
'fs-jetpack',
|
||||||
'@rokt33r/markdown-it-math',
|
'@rokt33r/markdown-it-math',
|
||||||
@@ -48,7 +47,10 @@ var config = {
|
|||||||
'react-dom': 'var ReactDOM',
|
'react-dom': 'var ReactDOM',
|
||||||
'react-redux': 'var ReactRedux',
|
'react-redux': 'var ReactRedux',
|
||||||
'codemirror': 'var CodeMirror',
|
'codemirror': 'var CodeMirror',
|
||||||
'redux': 'var Redux'
|
'redux': 'var Redux',
|
||||||
|
'raphael': 'var Raphael',
|
||||||
|
'flowchart': 'var flowchart',
|
||||||
|
'sequence-diagram': 'var Diagram'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user