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

Fix image insesration problem, Use a function of CodeMirror instead of dom function

This commit is contained in:
asmsuechan
2017-08-20 08:11:00 +09:00
parent acba61f36a
commit d88dd26186

View File

@@ -201,7 +201,7 @@ export default class CodeEditor extends React.Component {
insertImageMd (imageMd) {
const textarea = this.editor.getInputField()
const cm = this.editor
textarea.value = `${textarea.value.substr(0, textarea.selectionStart)}${imageMd}${textarea.value.substr(textarea.selectionEnd)}`
cm.replaceSelection(`${textarea.value.substr(0, textarea.selectionStart)}${imageMd}${textarea.value.substr(textarea.selectionEnd)}`)
}
render () {