If pasting a url atop another url, don't wrap one in the other (#8642)
This commit is contained in:
parent
f427f09b8b
commit
65e27cd6be
1 changed files with 2 additions and 1 deletions
|
@ -354,7 +354,8 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
||||||
this.modifiedFlag = true;
|
this.modifiedFlag = true;
|
||||||
const range = getRangeForSelection(this.editorRef.current, model, document.getSelection());
|
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);
|
formatRangeAsLink(range, plainText);
|
||||||
} else {
|
} else {
|
||||||
replaceRangeAndMoveCaret(range, parts);
|
replaceRangeAndMoveCaret(range, parts);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue