Skip to content

Commit 13c2f47

Browse files
authored
Merge pull request #2747 from daiyam/fix-paste-image
fix paste image
2 parents 604f17f + 50669f6 commit 13c2f47

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

browser/components/CodeEditor.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,13 @@ export default class CodeEditor extends React.Component {
866866
this.handlePasteText(editor, pastedTxt)
867867
} else if (fetchUrlTitle && isURL(pastedTxt) && !isInLinkTag(editor)) {
868868
this.handlePasteUrl(editor, pastedTxt)
869-
} else if (enableSmartPaste || forceSmartPaste) {
869+
} else if (attachmentManagement.isAttachmentLink(pastedTxt)) {
870+
attachmentManagement
871+
.handleAttachmentLinkPaste(storageKey, noteKey, pastedTxt)
872+
.then(modifiedText => {
873+
this.editor.replaceSelection(modifiedText)
874+
})
875+
} else {
870876
const image = clipboard.readImage()
871877
if (!image.isEmpty()) {
872878
attachmentManagement.handlePastNativeImage(
@@ -875,22 +881,16 @@ export default class CodeEditor extends React.Component {
875881
noteKey,
876882
image
877883
)
878-
} else {
884+
} else if (enableSmartPaste || forceSmartPaste) {
879885
const pastedHtml = clipboard.readHTML()
880886
if (pastedHtml.length > 0) {
881887
this.handlePasteHtml(editor, pastedHtml)
882888
} else {
883889
this.handlePasteText(editor, pastedTxt)
884890
}
891+
} else {
892+
this.handlePasteText(editor, pastedTxt)
885893
}
886-
} else if (attachmentManagement.isAttachmentLink(pastedTxt)) {
887-
attachmentManagement
888-
.handleAttachmentLinkPaste(storageKey, noteKey, pastedTxt)
889-
.then(modifiedText => {
890-
this.editor.replaceSelection(modifiedText)
891-
})
892-
} else {
893-
this.handlePasteText(editor, pastedTxt)
894894
}
895895
}
896896

browser/main/modals/PreferencesModal/HotkeyTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class HotkeyTab extends React.Component {
151151
</div>
152152
</div>
153153
<div styleName='group-section'>
154-
<div styleName='group-section-label'>{i18n.__('Paste Smartly')}</div>
154+
<div styleName='group-section-label'>{i18n.__('Paste HTML')}</div>
155155
<div styleName='group-section-control'>
156156
<input styleName='group-section-control-input'
157157
onChange={(e) => this.handleHotkeyChange(e)}

browser/main/modals/PreferencesModal/UiTab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ class UiTab extends React.Component {
564564
ref='enableSmartPaste'
565565
type='checkbox'
566566
/>&nbsp;
567-
{i18n.__('Enable smart paste')}
567+
{i18n.__('Enable HTML paste')}
568568
</label>
569569
</div>
570570

0 commit comments

Comments
 (0)