Skip to content

Commit 073a5d4

Browse files
committed
Ctrl+V can paste an image
1 parent 7a3cab8 commit 073a5d4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

browser/components/CodeEditor.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,13 @@ export default class CodeEditor extends React.Component {
749749
this.handlePasteText(editor, pastedTxt)
750750
} else if (fetchUrlTitle && isURL(pastedTxt) && !isInLinkTag(editor)) {
751751
this.handlePasteUrl(editor, pastedTxt)
752-
} else if (enableSmartPaste || forceSmartPaste) {
752+
} else if (attachmentManagement.isAttachmentLink(pastedTxt)) {
753+
attachmentManagement
754+
.handleAttachmentLinkPaste(storageKey, noteKey, pastedTxt)
755+
.then(modifiedText => {
756+
this.editor.replaceSelection(modifiedText)
757+
})
758+
} else {
753759
const image = clipboard.readImage()
754760
if (!image.isEmpty()) {
755761
attachmentManagement.handlePastNativeImage(
@@ -758,22 +764,16 @@ export default class CodeEditor extends React.Component {
758764
noteKey,
759765
image
760766
)
761-
} else {
767+
} else if (enableSmartPaste || forceSmartPaste) {
762768
const pastedHtml = clipboard.readHTML()
763769
if (pastedHtml.length > 0) {
764770
this.handlePasteHtml(editor, pastedHtml)
765771
} else {
766772
this.handlePasteText(editor, pastedTxt)
767773
}
774+
} else {
775+
this.handlePasteText(editor, pastedTxt)
768776
}
769-
} else if (attachmentManagement.isAttachmentLink(pastedTxt)) {
770-
attachmentManagement
771-
.handleAttachmentLinkPaste(storageKey, noteKey, pastedTxt)
772-
.then(modifiedText => {
773-
this.editor.replaceSelection(modifiedText)
774-
})
775-
} else {
776-
this.handlePasteText(editor, pastedTxt)
777777
}
778778
}
779779

0 commit comments

Comments
 (0)