Behaviour SwRS-MDOKFSTUDIO-PALETTE-264
A pasted URL becomes a link, an autolink or an image in the block text box
When the writer pastes into the block text box a clipboard whose plain text is a single http, https or mailto address and that holds no text/html, and the paste is not a paste as plain text, the extension SHALL replace the selection of the paste with [selected text](url) when text is selected, with <url> when nothing is selected, and with  for an http or https address whose path ends in .png, .jpg, .jpeg, .gif, .svg or .webp, in one undo step, leaving the rest of the source unchanged.
Part of StRS-MDOKFSTUDIO-PALETTE-018, outside the paths drawn on its map.
Scenarios 4
The situations the tests check; open one to read it.
nominalThe URL over selected text makes a link
Givena block editor with the text "see the docs" selected and a clipboard whose plain text is "https://example.com/docs" with no text/html
Whenthe writer pastes
Thenthe default paste is prevented and the selection becomes "[see the docs](https://example.com/docs)" in one native edit with the caret after it, autosaved; one undo restores the text
nominalThe URL alone makes an autolink or an image
Givena block editor with a collapsed caret and a clipboard whose plain text is "https://example.com/docs"
the same editor and a clipboard whose plain text is "https://example.com/logo.png"
the same editor and a clipboard whose plain text is "https://example.com/logo.png"
Whenthe writer pastes
the writer pastes
the writer pastes
Thenthe URL wrapped in angle brackets (an autolink) is inserted at the caret
"" is inserted with the caret in the empty alt text; with text selected the selection becomes the alt text, ""
"" is inserted with the caret in the empty alt text; with text selected the selection becomes the alt text, ""
boundaryThe paste stays with the browser
| Case | Outcome |
|---|---|
| Cmd+Shift+V or Ctrl+Shift+V pressed just before the paste (paste as plain text) | the raw text is pasted; the mark is cleared by the next key that is not a modifier |
| clipboard that also holds text/html | rich text paste of SwRS-MDOKFSTUDIO-PALETTE-213 |
| scheme other than http, https or mailto (javascript:, data:, file:, ftp:) | native paste |
| text that is more than one address, holds a space or a line break, or is longer than 2048 characters | native paste |
| caret in a fenced code block, an inline code span or the target of a link, or a selection that holds a line break, [ or ] | native paste |
| text box of a table cell editor | native paste (it installs no paste hook) |
boundaryThe image extension
| Address | Outcome |
|---|---|
| http or https, path ends in .png, .jpg, .jpeg, .gif, .svg or .webp (case-insensitive, query and hash ignored) | image `` |
| mailto address, or any other path | link or autolink |
| destination with ( or ) | written in angle brackets, `[text](<url>)` |