medium-editor icon indicating copy to clipboard operation
medium-editor copied to clipboard

Pasting with a URL on the clipboard

Open scripting opened this issue 1 year ago • 0 comments

Description

This is a question about a feature, not a bug report.

A user has requested the following behavior.

  1. There's a URL on the clipboard.
  2. They select some text.
  3. Paste.

What they want to happen is that the text that was selected is replaced with a link.

If the text was Hollywood.

And https://hollywood.gov/ is on the clipboard.

The selected text would be replaced with:

<a href="https://hollywood.gov/">Hollywood</a>

Why?

Apparently this is standard in software like Slack, and it's a natural feature, and it sounds appealing to me.

GitHub has the feature too. ;-)

I tried to implement

Subscribed to editablePaste event, but never got the call.

Every attempt to implement resulted in the URL on the clipboard replacing the selected text.

Version 5.23 according to MediumEditor.version.

Any help much appreciated.

scripting avatar Jan 06 '25 17:01 scripting