From 5d17663040bf8ad36206db54ba9f63a92b3163d4 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:11:17 -0700 Subject: [PATCH] Don't unnecessarily markdown-ify links pasted into markdown editor (#3958) --- packages/ui/src/components/base/MarkdownEditor.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/components/base/MarkdownEditor.vue b/packages/ui/src/components/base/MarkdownEditor.vue index 932f5870..842d186d 100644 --- a/packages/ui/src/components/base/MarkdownEditor.vue +++ b/packages/ui/src/components/base/MarkdownEditor.vue @@ -397,9 +397,10 @@ onMounted(() => { const selection = view.state.selection.main const selectionText = view.state.doc.sliceString(selection.from, selection.to) - const linkText = selectionText ? selectionText : url - const linkMarkdown = `[${linkText}](${url})` - return markdownCommands.replaceSelection(view, linkMarkdown) + if (selectionText) { + const linkMarkdown = `[${selectionText}](${url})` + return markdownCommands.replaceSelection(view, linkMarkdown) + } } // Check if the length of the document is greater than the max length. If it is, prevent the paste.