mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 10:16:26 +00:00
Fixed image drag and drop
Added escaping and changed function that wasn't working
This commit is contained in:
@@ -201,13 +201,13 @@ export default class CodeEditor extends React.Component {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
let imagePath = e.dataTransfer.files[0].path
|
let imagePath = e.dataTransfer.files[0].path
|
||||||
let filename = path.basename(imagePath)
|
let filename = path.basename(imagePath)
|
||||||
let imageMd = ``
|
let imageMd = `})`
|
||||||
this.insertImage(imageMd)
|
this.insertImage(imageMd)
|
||||||
}
|
}
|
||||||
|
|
||||||
insertImage (imageMd) {
|
insertImage (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.setValue(cm.getValue() + imageMd)
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|||||||
Reference in New Issue
Block a user