mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Fixed bug when switching to markdown notes
This commit is contained in:
@@ -519,6 +519,11 @@ export default class CodeEditor extends React.Component {
|
||||
|
||||
handleHighlight (editor, changeObject) {
|
||||
const lines = editor.options.linesHighlighted
|
||||
|
||||
if (lines == null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!lines.includes(changeObject)) {
|
||||
lines.push(changeObject)
|
||||
editor.addLineClass(changeObject, 'text', 'CodeMirror-activeline-background')
|
||||
@@ -566,11 +571,6 @@ export default class CodeEditor extends React.Component {
|
||||
this.editor.setCursor(cursor)
|
||||
}
|
||||
|
||||
restartHighlighting () {
|
||||
this.editor.options.linesHighlighted = this.props.linesHighlighted
|
||||
this.initialHighlighting()
|
||||
}
|
||||
|
||||
handleDropImage (dropEvent) {
|
||||
dropEvent.preventDefault()
|
||||
const { storageKey, noteKey } = this.props
|
||||
@@ -709,6 +709,10 @@ export default class CodeEditor extends React.Component {
|
||||
}
|
||||
|
||||
initialHighlighting () {
|
||||
if (this.editor.options.linesHighlighted == null) {
|
||||
return
|
||||
}
|
||||
|
||||
const count = this.editor.lineCount()
|
||||
for (let i = 0; i < count; i++) {
|
||||
if (this.editor.options.linesHighlighted.includes(i)) {
|
||||
@@ -717,6 +721,11 @@ export default class CodeEditor extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
restartHighlighting () {
|
||||
this.editor.options.linesHighlighted = this.props.linesHighlighted
|
||||
this.initialHighlighting()
|
||||
}
|
||||
|
||||
mapImageResponse (response, pastedTxt) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user