mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Small changes
This commit is contained in:
@@ -518,11 +518,12 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleHighlight (editor, changeObject) {
|
handleHighlight (editor, changeObject) {
|
||||||
if(!editor.options.linesHighlighted.includes(changeObject)){
|
let lines =editor.options.linesHighlighted
|
||||||
editor.options.linesHighlighted.push(changeObject)
|
if(!lines.includes(changeObject)){
|
||||||
|
lines.push(changeObject)
|
||||||
editor.addLineClass(changeObject,'text',"CodeMirror-activeline-background")
|
editor.addLineClass(changeObject,'text',"CodeMirror-activeline-background")
|
||||||
}else{
|
}else{
|
||||||
editor.options.linesHighlighted.splice(editor.options.linesHighlighted.indexOf(changeObject),1)
|
lines.splice(lines.indexOf(changeObject),1)
|
||||||
editor.removeLineClass(changeObject,'text',"CodeMirror-activeline-background")
|
editor.removeLineClass(changeObject,'text',"CodeMirror-activeline-background")
|
||||||
}
|
}
|
||||||
if (this.props.onChange) {
|
if (this.props.onChange) {
|
||||||
@@ -567,7 +568,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
|
|
||||||
restartHighlighting(){
|
restartHighlighting(){
|
||||||
this.editor.options.linesHighlighted = this.props.linesHighlighted
|
this.editor.options.linesHighlighted = this.props.linesHighlighted
|
||||||
this.initialHighlighting();
|
this.initialHighlighting()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDropImage (dropEvent) {
|
handleDropImage (dropEvent) {
|
||||||
@@ -708,7 +709,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialHighlighting(){
|
initialHighlighting(){
|
||||||
var count = this.editor.lineCount(), i;
|
var count = this.editor.lineCount(), i
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if(this.editor.options.linesHighlighted.includes(i)){
|
if(this.editor.options.linesHighlighted.includes(i)){
|
||||||
this.editor.addLineClass(i,'text',"CodeMirror-activeline-background")
|
this.editor.addLineClass(i,'text',"CodeMirror-activeline-background")
|
||||||
|
|||||||
Reference in New Issue
Block a user