mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-17 19:51:42 +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) {
|
handleHighlight (editor, changeObject) {
|
||||||
const lines = editor.options.linesHighlighted
|
const lines = editor.options.linesHighlighted
|
||||||
|
|
||||||
|
if (lines == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!lines.includes(changeObject)) {
|
if (!lines.includes(changeObject)) {
|
||||||
lines.push(changeObject)
|
lines.push(changeObject)
|
||||||
editor.addLineClass(changeObject, 'text', 'CodeMirror-activeline-background')
|
editor.addLineClass(changeObject, 'text', 'CodeMirror-activeline-background')
|
||||||
@@ -566,11 +571,6 @@ export default class CodeEditor extends React.Component {
|
|||||||
this.editor.setCursor(cursor)
|
this.editor.setCursor(cursor)
|
||||||
}
|
}
|
||||||
|
|
||||||
restartHighlighting () {
|
|
||||||
this.editor.options.linesHighlighted = this.props.linesHighlighted
|
|
||||||
this.initialHighlighting()
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDropImage (dropEvent) {
|
handleDropImage (dropEvent) {
|
||||||
dropEvent.preventDefault()
|
dropEvent.preventDefault()
|
||||||
const { storageKey, noteKey } = this.props
|
const { storageKey, noteKey } = this.props
|
||||||
@@ -709,6 +709,10 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialHighlighting () {
|
initialHighlighting () {
|
||||||
|
if (this.editor.options.linesHighlighted == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const count = this.editor.lineCount()
|
const count = this.editor.lineCount()
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
if (this.editor.options.linesHighlighted.includes(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) {
|
mapImageResponse (response, pastedTxt) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user