mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Changes to pass tests and lint code
This commit is contained in:
@@ -242,7 +242,7 @@ export default class CodeEditor extends React.Component {
|
||||
this.editor.on('focus', this.focusHandler)
|
||||
this.editor.on('blur', this.blurHandler)
|
||||
this.editor.on('change', this.changeHandler)
|
||||
this.editor.on("gutterClick",this.highlightHandler)
|
||||
this.editor.on('gutterClick', this.highlightHandler)
|
||||
this.editor.on('paste', this.pasteHandler)
|
||||
this.editor.on('contextmenu', this.contextMenuHandler)
|
||||
eventEmitter.on('top:search', this.searchHandler)
|
||||
@@ -518,13 +518,13 @@ export default class CodeEditor extends React.Component {
|
||||
}
|
||||
|
||||
handleHighlight (editor, changeObject) {
|
||||
let lines =editor.options.linesHighlighted
|
||||
const lines = editor.options.linesHighlighted
|
||||
if (!lines.includes(changeObject)) {
|
||||
lines.push(changeObject)
|
||||
editor.addLineClass(changeObject,'text',"CodeMirror-activeline-background")
|
||||
editor.addLineClass(changeObject, 'text', 'CodeMirror-activeline-background')
|
||||
} else {
|
||||
lines.splice(lines.indexOf(changeObject), 1)
|
||||
editor.removeLineClass(changeObject,'text',"CodeMirror-activeline-background")
|
||||
editor.removeLineClass(changeObject, 'text', 'CodeMirror-activeline-background')
|
||||
}
|
||||
if (this.props.onChange) {
|
||||
this.props.onChange(editor)
|
||||
@@ -709,10 +709,10 @@ export default class CodeEditor extends React.Component {
|
||||
}
|
||||
|
||||
initialHighlighting () {
|
||||
var count = this.editor.lineCount(), i
|
||||
for (i = 0; i < count; i++) {
|
||||
const count = this.editor.lineCount()
|
||||
for (let i = 0; i < count; i++) {
|
||||
if (this.editor.options.linesHighlighted.includes(i)) {
|
||||
this.editor.addLineClass(i,'text',"CodeMirror-activeline-background")
|
||||
this.editor.addLineClass(i, 'text', 'CodeMirror-activeline-background')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export function createSnippetNote (storage, folder, dispatch, location, params,
|
||||
name: '',
|
||||
mode: config.editor.snippetDefaultLanguage || 'text',
|
||||
content: '',
|
||||
linesHighlighted:[],
|
||||
linesHighlighted: []
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ function validateInput (input) {
|
||||
name: '',
|
||||
mode: 'text',
|
||||
content: '',
|
||||
linesHighlighted:[],
|
||||
linesHighlighted: []
|
||||
}]
|
||||
}
|
||||
break
|
||||
|
||||
@@ -52,7 +52,7 @@ function validateInput (input) {
|
||||
name: '',
|
||||
mode: 'text',
|
||||
content: '',
|
||||
linesHighlighted:[],
|
||||
linesHighlighted: []
|
||||
}]
|
||||
} else {
|
||||
validatedInput.snippets = input.snippets
|
||||
@@ -98,7 +98,7 @@ function updateNote (storageKey, noteKey, input) {
|
||||
name: '',
|
||||
mode: 'text',
|
||||
content: '',
|
||||
linesHighlighted:[],
|
||||
linesHighlighted: []
|
||||
}]
|
||||
}
|
||||
: {
|
||||
|
||||
Reference in New Issue
Block a user