Skip to content

Commit bf727b5

Browse files
committed
refactor: fix lint warning on public/js/lib/editor/utils.js
Signed-off-by: BoHong Li <[email protected]>
1 parent 45ba0c6 commit bf727b5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

public/js/lib/editor/utils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function insertText (cm, text, cursorEnd = 0) {
5151
let cursor = cm.getCursor()
5252
cm.replaceSelection(text, cursor, cursor)
5353
cm.focus()
54-
cm.setCursor({line: cursor.line, ch: cursor.ch + cursorEnd})
54+
cm.setCursor({ line: cursor.line, ch: cursor.ch + cursorEnd })
5555
}
5656

5757
export function insertLink (cm, isImage) {
@@ -80,16 +80,16 @@ export function insertLink (cm, isImage) {
8080
cm.setSelections(ranges)
8181
} else {
8282
cm.replaceRange(symbol + linkEnd, cursor, cursor)
83-
cm.setCursor({line: cursor.line, ch: cursor.ch + symbol.length + linkEnd.length})
83+
cm.setCursor({ line: cursor.line, ch: cursor.ch + symbol.length + linkEnd.length })
8484
}
8585
}
8686
cm.focus()
8787
}
8888

8989
export function insertHeader (cm) {
9090
let cursor = cm.getCursor()
91-
let startOfLine = {line: cursor.line, ch: 0}
92-
let startOfLineText = cm.getRange(startOfLine, {line: cursor.line, ch: 1})
91+
let startOfLine = { line: cursor.line, ch: 0 }
92+
let startOfLineText = cm.getRange(startOfLine, { line: cursor.line, ch: 1 })
9393
// See if it is already a header
9494
if (startOfLineText === '#') {
9595
cm.replaceRange('#', startOfLine, startOfLine)
@@ -108,14 +108,14 @@ export function insertOnStartOfLines (cm, symbol) {
108108
if (!range.empty()) {
109109
const from = range.from()
110110
const to = range.to()
111-
let selection = cm.getRange({line: from.line, ch: 0}, to)
111+
let selection = cm.getRange({ line: from.line, ch: 0 }, to)
112112
selection = selection.replace(/\n/g, '\n' + symbol)
113113
selection = symbol + selection
114114
cm.replaceRange(selection, from, to)
115115
} else {
116-
cm.replaceRange(symbol, {line: cursor.line, ch: 0}, {line: cursor.line, ch: 0})
116+
cm.replaceRange(symbol, { line: cursor.line, ch: 0 }, { line: cursor.line, ch: 0 })
117117
}
118118
}
119-
cm.setCursor({line: cursor.line, ch: cursor.ch + symbol.length})
119+
cm.setCursor({ line: cursor.line, ch: cursor.ch + symbol.length })
120120
cm.focus()
121121
}

0 commit comments

Comments
 (0)