0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Drop all trailing punctuations from URLs in a pasted text

This matches the common behaviour of various places, e.g. GitHub and
Slack.
This commit is contained in:
Sage Abdullah 2024-10-21 16:32:47 +01:00
parent 6b04961654
commit 0b45e6112c
No known key found for this signature in database
GPG Key ID: EB1A33CC51CC0217

View File

@ -148,7 +148,7 @@ const insertContentWithLinks = (editorState, htmlOrText) => {
// For example "Go to https://example.com."
// Terminal Punctuation class: see https://www.unicode.org/review/pr-23.html.
const cleanURLPattern = match[1].replace(
/\p{Terminal_Punctuation}$/u,
/\p{Terminal_Punctuation}+$/u,
'',
);
const url = getValidLinkURL(cleanURLPattern);