diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index adcb6bf0..8af89ded 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -209,13 +209,13 @@ export default class CodeEditor extends React.Component { } return CodeMirror.Pass } - }) + }) this.value = this.props.value this.editor = CodeMirror(this.refs.root, { rulers: buildCMRulers(rulers, enableRulers), value: this.props.value, - linesHighlighted:this.props.linesHighlighted, + linesHighlighted: this.props.linesHighlighted, lineNumbers: this.props.displayLineNumbers, lineWrapping: true, theme: this.props.theme, @@ -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) @@ -320,10 +320,10 @@ export default class CodeEditor extends React.Component { clientWidth: this.refs.root.clientWidth }) - this.initialHighlighting() + this.initialHighlighting() } - expandSnippet (line, cursor, cm, snippets) { + expandSnippet (line, cursor, cm, snippets) { const wordBeforeCursor = this.getWordBeforeCursor( line, cursor.line, @@ -518,13 +518,13 @@ export default class CodeEditor extends React.Component { } handleHighlight (editor, changeObject) { - let lines =editor.options.linesHighlighted - if(!lines.includes(changeObject)){ + const lines = editor.options.linesHighlighted + if (!lines.includes(changeObject)) { lines.push(changeObject) - editor.addLineClass(changeObject,'text',"CodeMirror-activeline-background") - }else{ - lines.splice(lines.indexOf(changeObject),1) - editor.removeLineClass(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') } if (this.props.onChange) { this.props.onChange(editor) @@ -566,7 +566,7 @@ export default class CodeEditor extends React.Component { this.editor.setCursor(cursor) } - restartHighlighting(){ + restartHighlighting () { this.editor.options.linesHighlighted = this.props.linesHighlighted this.initialHighlighting() } @@ -708,11 +708,11 @@ export default class CodeEditor extends React.Component { }) } - initialHighlighting(){ - var count = this.editor.lineCount(), i - for (i = 0; i < count; i++) { - if(this.editor.options.linesHighlighted.includes(i)){ - this.editor.addLineClass(i,'text',"CodeMirror-activeline-background") + initialHighlighting () { + 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') } } } diff --git a/browser/lib/newNote.js b/browser/lib/newNote.js index 9b701a02..2e407207 100644 --- a/browser/lib/newNote.js +++ b/browser/lib/newNote.js @@ -57,7 +57,7 @@ export function createSnippetNote (storage, folder, dispatch, location, params, name: '', mode: config.editor.snippetDefaultLanguage || 'text', content: '', - linesHighlighted:[], + linesHighlighted: [] } ] }) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index b8d0fe5b..3d1027ea 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -410,7 +410,7 @@ class SnippetNoteDetail extends React.Component { return (e) => { const snippets = this.state.note.snippets.slice() snippets[index].content = this.refs['code-' + index].value - snippets[index].linesHighlighted=e.options.linesHighlighted + snippets[index].linesHighlighted = e.options.linesHighlighted this.setState(state => ({note: Object.assign(state.note, {snippets: snippets})})) this.setState(state => ({ @@ -605,7 +605,7 @@ class SnippetNoteDetail extends React.Component { name: '', mode: config.editor.snippetDefaultLanguage || 'text', content: '', - linesHighlighted:[] + linesHighlighted: [] }]) const snippetIndex = note.snippets.length - 1 diff --git a/browser/main/lib/dataApi/createNote.js b/browser/main/lib/dataApi/createNote.js index 60bf1f42..0b6e6fbe 100644 --- a/browser/main/lib/dataApi/createNote.js +++ b/browser/main/lib/dataApi/createNote.js @@ -24,7 +24,7 @@ function validateInput (input) { name: '', mode: 'text', content: '', - linesHighlighted:[], + linesHighlighted: [] }] } break diff --git a/browser/main/lib/dataApi/updateNote.js b/browser/main/lib/dataApi/updateNote.js index 1c8bd882..b7a28613 100644 --- a/browser/main/lib/dataApi/updateNote.js +++ b/browser/main/lib/dataApi/updateNote.js @@ -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: [] }] } : { diff --git a/browser/main/lib/dataApi/updateSnippet.js b/browser/main/lib/dataApi/updateSnippet.js index 7a296130..f132d83f 100644 --- a/browser/main/lib/dataApi/updateSnippet.js +++ b/browser/main/lib/dataApi/updateSnippet.js @@ -12,8 +12,8 @@ function updateSnippet (snippet, snippetFile) { if ( currentSnippet.name === snippet.name && currentSnippet.prefix === snippet.prefix && - currentSnippet.content === snippet.content && - currentSnippet.linesHighlighted===snippet.linesHighlighted + currentSnippet.content === snippet.content && + currentSnippet.linesHighlighted === snippet.linesHighlighted ) { // if everything is the same then don't write to disk resolve(snippets)