1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

fix lint errors

This commit is contained in:
Baptiste Augrain
2018-08-20 20:29:10 +02:00
parent 657806c8cf
commit 7cf9dda821
4 changed files with 61 additions and 65 deletions

View File

@@ -7,38 +7,38 @@ export default class TextEditorInterface {
this.transaction = false
}
getCursorPosition() {
getCursorPosition () {
const { line, ch } = this.doc.getCursor()
return new Point(line, ch)
}
setCursorPosition(pos) {
setCursorPosition (pos) {
this.doc.setCursor({
line: pos.row,
ch: pos.column
})
}
setSelectionRange(range) {
setSelectionRange (range) {
this.doc.setSelection(
{ line: range.start.row, ch: range.start.column },
{ line: range.end.row, ch: range.end.column }
)
}
getLastRow() {
getLastRow () {
return this.doc.lineCount() - 1
}
acceptsTableEdit() {
acceptsTableEdit () {
return true
}
getLine(row) {
getLine (row) {
return this.doc.getLine(row)
}
insertLine(row, line) {
insertLine (row, line) {
const lastRow = this.getLastRow()
if (row > lastRow) {
const lastLine = this.getLine(lastRow)
@@ -47,8 +47,7 @@ export default class TextEditorInterface {
{ line: lastRow, ch: lastLine.length },
{ line: lastRow, ch: lastLine.length }
)
}
else {
} else {
this.doc.replaceRange(
line + '\n',
{ line: row, ch: 0 },
@@ -57,7 +56,7 @@ export default class TextEditorInterface {
}
}
deleteLine(row) {
deleteLine (row) {
const lastRow = this.getLastRow()
if (row >= lastRow) {
if (lastRow > 0) {
@@ -68,8 +67,7 @@ export default class TextEditorInterface {
{ line: lastRow - 1, ch: preLastLine.length },
{ line: lastRow, ch: lastLine.length }
)
}
else {
} else {
const lastLine = this.getLine(lastRow)
this.doc.replaceRange(
'',
@@ -77,8 +75,7 @@ export default class TextEditorInterface {
{ line: lastRow, ch: lastLine.length }
)
}
}
else {
} else {
this.doc.replaceRange(
'',
{ line: row, ch: 0 },
@@ -87,7 +84,7 @@ export default class TextEditorInterface {
}
}
replaceLines(startRow, endRow, lines) {
replaceLines (startRow, endRow, lines) {
const lastRow = this.getLastRow()
if (endRow > lastRow) {
const lastLine = this.getLine(lastRow)
@@ -96,8 +93,7 @@ export default class TextEditorInterface {
{ line: startRow, ch: 0 },
{ line: lastRow, ch: lastLine.length }
)
}
else {
} else {
this.doc.replaceRange(
lines.join('\n') + '\n',
{ line: startRow, ch: 0 },
@@ -106,7 +102,7 @@ export default class TextEditorInterface {
}
}
transact(func) {
transact (func) {
this.transaction = true
func()
this.transaction = false