diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 0f035676..523926a2 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -21,7 +21,6 @@ const buildEditorContextMenu = require('browser/lib/contextMenuBuilder') import { createTurndownService } from '../lib/turndown' import { languageMaps } from '../lib/CMLanguageList' import snippetManager from '../lib/SnippetManager' -import { gfm } from 'turndown-plugin-gfm' import { findStorage } from 'browser/lib/findStorage' import { sendWakatimeHeartBeat } from 'browser/lib/wakatime-plugin' import { @@ -120,8 +119,15 @@ export default class CodeEditor extends React.Component { // wakatime const { storageKey, noteKey } = this.props const storage = findStorage(storageKey) - if (storage) sendWakatimeHeartBeat(storage.path, noteKey, storage.name, false, false, true) - + if (storage) + sendWakatimeHeartBeat( + storage.path, + noteKey, + storage.name, + false, + false, + true + ) } handleSearch(msg) { @@ -807,9 +813,25 @@ export default class CodeEditor extends React.Component { const storage = findStorage(storageKey) if (this.props.onChange) { this.props.onChange(editor) - if (storage) sendWakatimeHeartBeat(storage.path, noteKey, storage.name, true, true, false) + if (storage) + sendWakatimeHeartBeat( + storage.path, + noteKey, + storage.name, + true, + true, + false + ) } else { - if (storage) sendWakatimeHeartBeat(storage.path, noteKey, storage.name, false, false, false) + if (storage) + sendWakatimeHeartBeat( + storage.path, + noteKey, + storage.name, + false, + false, + false + ) } } @@ -942,7 +964,15 @@ export default class CodeEditor extends React.Component { // wakatime const { storageKey, noteKey } = this.props const storage = findStorage(storageKey) - if (storage) sendWakatimeHeartBeat(storage.path, noteKey, storage.name, false, false, true) + if (storage) + sendWakatimeHeartBeat( + storage.path, + noteKey, + storage.name, + false, + false, + true + ) } setValue(value) { diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index 9ddea318..65dab33f 100755 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -1299,9 +1299,4 @@ MarkdownPreview.propTypes = { breaks: PropTypes.bool } -export default connect( - null, - null, - null, - { forwardRef: true } -)(MarkdownPreview) +export default connect(null, null, null, { forwardRef: true })(MarkdownPreview) diff --git a/browser/lib/markdown.js b/browser/lib/markdown.js index 29a3b70b..41b1af34 100644 --- a/browser/lib/markdown.js +++ b/browser/lib/markdown.js @@ -278,9 +278,7 @@ class Markdown { flowchart: token => { return `
${token.fileName}
- ${
- token.content
- }
+ ${token.content}
`
},
gallery: token => {
@@ -299,25 +297,19 @@ class Markdown {
return `
${token.fileName}
- ${content}
+ ${content}
`
},
mermaid: token => {
return `
${token.fileName}
- ${
- token.content
- }
+ ${token.content}
`
},
sequence: token => {
return `
${token.fileName}
- ${
- token.content
- }
+ ${token.content}
`
}
},
diff --git a/browser/lib/wakatime-plugin.js b/browser/lib/wakatime-plugin.js
index 8d05d14e..c9c4c266 100644
--- a/browser/lib/wakatime-plugin.js
+++ b/browser/lib/wakatime-plugin.js
@@ -3,7 +3,14 @@ const exec = require('child_process').exec
const path = require('path')
let lastHeartbeat = 0
-function sendWakatimeHeartBeat (storagePath, noteKey, storageName, isWrite, hasFileChanges, isFileChange) {
+function sendWakatimeHeartBeat(
+ storagePath,
+ noteKey,
+ storageName,
+ isWrite,
+ hasFileChanges,
+ isFileChange
+) {
if (new Date().getTime() - lastHeartbeat > 120000 || isFileChange) {
const notePath = path.join(storagePath, 'notes', noteKey + '.cson')
@@ -14,14 +21,25 @@ function sendWakatimeHeartBeat (storagePath, noteKey, storageName, isWrite, hasF
lastHeartbeat = new Date()
const wakatimeKey = config.get().wakatime.key
if (wakatimeKey) {
- exec(`wakatime --file ${notePath} --project '${storageName}' --key ${wakatimeKey} --plugin Boostnote-wakatime`, (error, stdOut, stdErr) => {
- if (error) {
- console.log(error)
- lastHeartbeat = 0
- } else {
- console.log('wakatime', 'isWrite', isWrite, 'hasChanges', hasFileChanges, 'isFileChange', isFileChange)
+ exec(
+ `wakatime --file ${notePath} --project '${storageName}' --key ${wakatimeKey} --plugin Boostnote-wakatime`,
+ (error, stdOut, stdErr) => {
+ if (error) {
+ console.log(error)
+ lastHeartbeat = 0
+ } else {
+ console.log(
+ 'wakatime',
+ 'isWrite',
+ isWrite,
+ 'hasChanges',
+ hasFileChanges,
+ 'isFileChange',
+ isFileChange
+ )
+ }
}
- })
+ )
}
}
}
diff --git a/browser/main/modals/PreferencesModal/PluginsTab.js b/browser/main/modals/PreferencesModal/PluginsTab.js
index 0fdc3ac8..1b1ebfa4 100644
--- a/browser/main/modals/PreferencesModal/PluginsTab.js
+++ b/browser/main/modals/PreferencesModal/PluginsTab.js
@@ -11,7 +11,7 @@ const electron = require('electron')
const ipc = electron.ipcRenderer
class PluginsTab extends React.Component {
- constructor (props) {
+ constructor(props) {
super(props)
this.state = {
@@ -19,27 +19,34 @@ class PluginsTab extends React.Component {
}
}
- componentDidMount () {
+ componentDidMount() {
this.handleSettingDone = () => {
- this.setState({pluginsAlert: {
- type: 'success',
- message: i18n.__('Successfully applied!')
- }})
+ this.setState({
+ pluginsAlert: {
+ type: 'success',
+ message: i18n.__('Successfully applied!')
+ }
+ })
}
- this.handleSettingError = (err) => {
+ this.handleSettingError = err => {
if (
this.state.config.wakatime.key === '' ||
this.state.config.wakatime.key === null
) {
- this.setState({pluginsAlert: {
- type: 'success',
- message: i18n.__('Successfully applied!')
- }})
+ this.setState({
+ pluginsAlert: {
+ type: 'success',
+ message: i18n.__('Successfully applied!')
+ }
+ })
} else {
- this.setState({pluginsAlert: {
- type: 'error',
- message: err.message != null ? err.message : i18n.__('An error occurred!')
- }})
+ this.setState({
+ pluginsAlert: {
+ type: 'error',
+ message:
+ err.message != null ? err.message : i18n.__('An error occurred!')
+ }
+ })
}
}
this.oldWakatimekey = this.state.config.wakatime
@@ -47,12 +54,12 @@ class PluginsTab extends React.Component {
ipc.addListener('APP_SETTING_ERROR', this.handleSettingError)
}
- componentWillUnmount () {
+ componentWillUnmount() {
ipc.removeListener('APP_SETTING_DONE', this.handleSettingDone)
ipc.removeListener('APP_SETTING_ERROR', this.handleSettingError)
}
- handleSaveButtonClick (e) {
+ handleSaveButtonClick(e) {
const newConfig = {
wakatime: this.state.config.wakatime
}
@@ -67,7 +74,7 @@ class PluginsTab extends React.Component {
this.props.haveToSave()
}
- handleWakatimeKeyChange (e) {
+ handleWakatimeKeyChange(e) {
const { config } = this.state
config.wakatime = { key: this.refs.key.value }
this.setState({
@@ -84,7 +91,7 @@ class PluginsTab extends React.Component {
}
}
- clearMessage () {
+ clearMessage() {
_.debounce(() => {
this.setState({
pluginsAlert: null
@@ -92,13 +99,12 @@ class PluginsTab extends React.Component {
}, 2000)()
}
- render () {
+ render() {
const pluginsAlert = this.state.pluginsAlert
- const pluginsAlertElement = pluginsAlert != null
- ? - {pluginsAlert.message} -
- : null + const pluginsAlertElement = + pluginsAlert != null ? ( +{pluginsAlert.message}
+ ) : null const { config } = this.state return ( @@ -108,8 +114,9 @@ class PluginsTab extends React.Component {