MCPcopy Create free account
hub / github.com/hackmdio/codimd / deleteLine

Method deleteLine

public/js/lib/editor/table-editor.js:62–88  ·  view source on GitHub ↗
(row)

Source from the content-addressed store, hash-verified

60 }
61
62 deleteLine (row) {
63 const lastRow = this.getLastRow()
64 if (row >= lastRow) {
65 if (lastRow > 0) {
66 const preLastLine = this.getLine(lastRow - 1)
67 const lastLine = this.getLine(lastRow)
68 this.doc.replaceRange(
69 '',
70 { line: lastRow - 1, ch: preLastLine.length },
71 { line: lastRow, ch: lastLine.length }
72 )
73 } else {
74 const lastLine = this.getLine(lastRow)
75 this.doc.replaceRange(
76 '',
77 { line: lastRow, ch: 0 },
78 { line: lastRow, ch: lastLine.length }
79 )
80 }
81 } else {
82 this.doc.replaceRange(
83 '',
84 { line: row, ch: 0 },
85 { line: row + 1, ch: 0 }
86 )
87 }
88 }
89
90 replaceLines (startRow, endRow, lines) {
91 const lastRow = this.getLastRow()

Callers

nothing calls this directly

Calls 2

getLastRowMethod · 0.95
getLineMethod · 0.95

Tested by

no test coverage detected