Skip to content

Convert selected text to MD link when pasting a URL #21634

Closed
matrix-org/matrix-react-sdk
#8242
@Johennes

Description

@Johennes

Your use case

What would you like to do?

When pasting a URL while having text selected the selection should turn into a MD link with the previously selected text being the title.

To illustrate, starting from:

Screenshot 2022-04-01 at 08 53 44

and pasting https://matrix.org should end up with:

Screenshot 2022-04-01 at 08 54 05

Why would you like to do it?

This is a common idiom supported in at least some text composition apps (for instance, logseq) and saves time in having to write the MD link manually.

How would you like to achieve it?

Check if the pasted text is a URL. If so, perform the string replacement to construct a MD link.

Have you considered any alternatives?

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions