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

fix double paste when pasting attachement links

This commit is contained in:
Baptiste Augrain
2018-11-28 15:12:18 +01:00
parent 2aa296ff33
commit df3b2cd8fe

View File

@@ -645,6 +645,7 @@ export default class CodeEditor extends React.Component {
} }
const pastedTxt = clipboard.readText() const pastedTxt = clipboard.readText()
console.log(pastedTxt)
if (isInFencedCodeBlock(editor)) { if (isInFencedCodeBlock(editor)) {
this.handlePasteText(editor, pastedTxt) this.handlePasteText(editor, pastedTxt)
@@ -667,16 +668,14 @@ export default class CodeEditor extends React.Component {
this.handlePasteText(editor, pastedTxt) this.handlePasteText(editor, pastedTxt)
} }
} }
} else { } else if (attachmentManagement.isAttachmentLink(pastedTxt)) {
this.handlePasteText(editor, pastedTxt)
}
if (attachmentManagement.isAttachmentLink(pastedTxt)) {
attachmentManagement attachmentManagement
.handleAttachmentLinkPaste(storageKey, noteKey, pastedTxt) .handleAttachmentLinkPaste(storageKey, noteKey, pastedTxt)
.then(modifiedText => { .then(modifiedText => {
this.editor.replaceSelection(modifiedText) this.editor.replaceSelection(modifiedText)
}) })
} else {
this.handlePasteText(editor, pastedTxt)
} }
} }