mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-24 07:01:48 +00:00
Merge branch 'master' into date-iso8601
This commit is contained in:
@@ -21,6 +21,8 @@ const buildEditorContextMenu = require('browser/lib/contextMenuBuilder')
|
||||
import { createTurndownService } from '../lib/turndown'
|
||||
import { languageMaps } from '../lib/CMLanguageList'
|
||||
import snippetManager from '../lib/SnippetManager'
|
||||
import { findStorage } from 'browser/lib/findStorage'
|
||||
import { sendWakatimeHeartBeat } from 'browser/lib/wakatime-plugin'
|
||||
import {
|
||||
generateInEditor,
|
||||
tocExistsInEditor
|
||||
@@ -113,6 +115,16 @@ export default class CodeEditor extends React.Component {
|
||||
this.editorActivityHandler = () => this.handleEditorActivity()
|
||||
|
||||
this.turndownService = createTurndownService()
|
||||
|
||||
// wakatime
|
||||
const { storageKey, noteKey } = this.props
|
||||
const storage = findStorage(storageKey)
|
||||
if (storage)
|
||||
sendWakatimeHeartBeat(storage.path, noteKey, storage.name, {
|
||||
isWrite: false,
|
||||
hasFileChanges: false,
|
||||
isFileChange: true
|
||||
})
|
||||
}
|
||||
|
||||
handleSearch(msg) {
|
||||
@@ -801,9 +813,23 @@ export default class CodeEditor extends React.Component {
|
||||
this.updateHighlight(editor, changeObject)
|
||||
|
||||
this.value = editor.getValue()
|
||||
|
||||
const { storageKey, noteKey } = this.props
|
||||
const storage = findStorage(storageKey)
|
||||
if (this.props.onChange) {
|
||||
this.props.onChange(editor)
|
||||
}
|
||||
|
||||
const isWrite = !!this.props.onChange
|
||||
const hasFileChanges = isWrite
|
||||
|
||||
if (storage) {
|
||||
sendWakatimeHeartBeat(storage.path, noteKey, storage.name, {
|
||||
isWrite,
|
||||
hasFileChanges,
|
||||
isFileChange: false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
linePossibleContainsHeadline(currentLine) {
|
||||
@@ -931,6 +957,16 @@ export default class CodeEditor extends React.Component {
|
||||
this.restartHighlighting()
|
||||
this.editor.on('change', this.changeHandler)
|
||||
this.editor.refresh()
|
||||
|
||||
// wakatime
|
||||
const { storageKey, noteKey } = this.props
|
||||
const storage = findStorage(storageKey)
|
||||
if (storage)
|
||||
sendWakatimeHeartBeat(storage.path, noteKey, storage.name, {
|
||||
isWrite: false,
|
||||
hasFileChanges: false,
|
||||
isFileChange: true
|
||||
})
|
||||
}
|
||||
|
||||
setValue(value) {
|
||||
|
||||
@@ -1192,7 +1192,10 @@ class MarkdownPreview extends React.Component {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
|
||||
const rawHref = e.target.getAttribute('href')
|
||||
const el = e.target.closest('a[href]')
|
||||
if (!el) return
|
||||
|
||||
const rawHref = el.getAttribute('href')
|
||||
const { dispatch } = this.props
|
||||
if (!rawHref) return // not checked href because parser will create file://... string for [empty link]()
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import mermaidAPI from 'mermaid'
|
||||
import mermaidAPI from 'mermaid/dist/mermaid.min.js'
|
||||
import uiThemes from 'browser/lib/ui-themes'
|
||||
|
||||
// fixes bad styling in the mermaid dark theme
|
||||
@@ -61,7 +61,6 @@ function render(element, content, theme, enableHTMLLabel) {
|
||||
|
||||
el.setAttribute('ratio', ratio)
|
||||
el.setAttribute('height', el.parentNode.clientWidth / ratio)
|
||||
console.log(el)
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user