mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Fixed image not displaying after paste
This commit is contained in:
@@ -331,10 +331,15 @@ export default class CodeEditor extends React.Component {
|
||||
const imageDir = path.join(storagePath, 'images')
|
||||
if (!fs.existsSync(imageDir)) fs.mkdirSync(imageDir)
|
||||
const imagePath = path.join(imageDir, `${imageName}.png`)
|
||||
fs.writeFile(imagePath, binaryData, 'binary')
|
||||
fs.writeFile(imagePath, binaryData, 'binary', (error) => {
|
||||
if (error) {
|
||||
throw error
|
||||
} else {
|
||||
const imageMd = `})`
|
||||
this.insertImageMd(imageMd)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (this.props.fetchUrlTitle && isURL(pastedTxt) && !isInLinkTag(editor)) {
|
||||
this.handlePasteUrl(e, editor, pastedTxt)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user