1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

replace selection with pasted image

This commit is contained in:
Maurits Lourens
2017-11-13 22:44:18 +01:00
parent 10ec5c1342
commit dad6a93944

View File

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