mirror of https://github.com/status-im/codimd.git
Fix all newly introduced linting issues
Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
49db5bc653
commit
8fe26988d1
|
@ -16,11 +16,11 @@ export function wrapTextWith (editor, cm, symbol) {
|
||||||
let headIndex = editor.indexFromPos(ranges[i].head)
|
let headIndex = editor.indexFromPos(ranges[i].head)
|
||||||
cm.replaceRange(symbol + selection + symbol, from, to, '+input')
|
cm.replaceRange(symbol + selection + symbol, from, to, '+input')
|
||||||
if (anchorIndex > headIndex) {
|
if (anchorIndex > headIndex) {
|
||||||
ranges[i].anchor.ch+= symbol.length
|
ranges[i].anchor.ch += symbol.length
|
||||||
ranges[i].head.ch+= symbol.length
|
ranges[i].head.ch += symbol.length
|
||||||
} else {
|
} else {
|
||||||
ranges[i].head.ch+= symbol.length
|
ranges[i].head.ch += symbol.length
|
||||||
ranges[i].anchor.ch+= symbol.length
|
ranges[i].anchor.ch += symbol.length
|
||||||
}
|
}
|
||||||
cm.setSelections(ranges)
|
cm.setSelections(ranges)
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,7 +54,7 @@ export function insertText (cm, text, cursorEnd = 0) {
|
||||||
cm.setCursor({line: cursor.line, ch: cursor.ch + cursorEnd})
|
cm.setCursor({line: cursor.line, ch: cursor.ch + cursorEnd})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function insertLink(cm, isImage) {
|
export function insertLink (cm, isImage) {
|
||||||
let cursor = cm.getCursor()
|
let cursor = cm.getCursor()
|
||||||
let ranges = cm.listSelections()
|
let ranges = cm.listSelections()
|
||||||
const linkEnd = '](https://)'
|
const linkEnd = '](https://)'
|
||||||
|
@ -71,16 +71,16 @@ export function insertLink(cm, isImage) {
|
||||||
selection = symbol + selection + linkEnd
|
selection = symbol + selection + linkEnd
|
||||||
cm.replaceRange(selection, from, to)
|
cm.replaceRange(selection, from, to)
|
||||||
if (anchorIndex > headIndex) {
|
if (anchorIndex > headIndex) {
|
||||||
ranges[i].anchor.ch+= symbol.length
|
ranges[i].anchor.ch += symbol.length
|
||||||
ranges[i].head.ch+= symbol.length
|
ranges[i].head.ch += symbol.length
|
||||||
} else {
|
} else {
|
||||||
ranges[i].head.ch+= symbol.length
|
ranges[i].head.ch += symbol.length
|
||||||
ranges[i].anchor.ch+= symbol.length
|
ranges[i].anchor.ch += symbol.length
|
||||||
}
|
}
|
||||||
cm.setSelections(ranges)
|
cm.setSelections(ranges)
|
||||||
} else {
|
} else {
|
||||||
cm.replaceRange(symbol + linkEnd, cursor, cursor)
|
cm.replaceRange(symbol + linkEnd, cursor, cursor)
|
||||||
cm.setCursor({line: cursor.line, ch: cursor.ch + symbol.length + linkend.length})
|
cm.setCursor({line: cursor.line, ch: cursor.ch + symbol.length + linkEnd.length})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cm.focus()
|
cm.focus()
|
||||||
|
|
Loading…
Reference in New Issue