diff --git a/src/components/views/rooms/BasicMessageComposer.tsx b/src/components/views/rooms/BasicMessageComposer.tsx index 667d5a42a4..335f757190 100644 --- a/src/components/views/rooms/BasicMessageComposer.tsx +++ b/src/components/views/rooms/BasicMessageComposer.tsx @@ -354,7 +354,8 @@ export default class BasicMessageEditor extends React.Component this.modifiedFlag = true; const range = getRangeForSelection(this.editorRef.current, model, document.getSelection()); - if (plainText && range.length > 0 && linkify.test(plainText)) { + // If the user is pasting a link, and has a range selected which is not a link, wrap the range with the link + if (plainText && range.length > 0 && linkify.test(plainText) && !linkify.test(range.text)) { formatRangeAsLink(range, plainText); } else { replaceRangeAndMoveCaret(range, parts);