1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00

Change an arg name md to mdElement

This commit is contained in:
asmsuechan
2017-03-12 16:07:40 -07:00
parent 49a4ec5e16
commit 48514d1020

View File

@@ -179,19 +179,19 @@ class MarkdownEditor extends React.Component {
} }
} }
addMdAndMoveCaretToCenter (md) { addMdAndMoveCaretToCenter (mdElement) {
const currentCaret = this.refs.code.editor.getCursor() const currentCaret = this.refs.code.editor.getCursor()
const cmDoc = this.refs.code.editor.getDoc() const cmDoc = this.refs.code.editor.getDoc()
cmDoc.replaceRange(md, currentCaret) cmDoc.replaceRange(mdElement, currentCaret)
this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + md.length/2}) this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + mdElement.length/2})
} }
addMdBetweenWord (md) { addMdBetweenWord (mdElement) {
const currentCaret = this.refs.code.editor.getCursor() const currentCaret = this.refs.code.editor.getCursor()
const word = this.refs.code.editor.findWordAt(currentCaret) const word = this.refs.code.editor.findWordAt(currentCaret)
const cmDoc = this.refs.code.editor.getDoc() const cmDoc = this.refs.code.editor.getDoc()
cmDoc.replaceRange(md, word.anchor) cmDoc.replaceRange(mdElement, word.anchor)
cmDoc.replaceRange(md, { line: word.head.line, ch: word.head.ch + md.length }) cmDoc.replaceRange(mdElement, { line: word.head.line, ch: word.head.ch + mdElement.length })
} }
handleKeyUp (e) { handleKeyUp (e) {