Behaviour SwRS-MDOKFSTUDIO-PALETTE-004
Files dropped from the Explorer become links or images at the drop point
When the writer drops one or more local files from the VS Code Explorer onto the preview in edit mode with no block editor open, the extension SHALL mark the insertion point nearest to the pointer while they are over the page and, on the drop, write there a new block with one relative Markdown reference per file,  for a png, jpg, jpeg, gif, svg or webp image and [title](path) for any other file, with the first heading of a Markdown file as its title (not read in a preview with restricted reads), 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.
nominalA Markdown file becomes a link titled by its first heading
Giventhe preview in edit mode with no editor open and a Markdown file whose first heading is "Getting started" in the folder of the document
Whenthe writer drags the file over the lower half of a paragraph and drops it
Thenthe insertion bar after that paragraph shows the drop marker while the file is over the page, and on the drop a new block `[Getting started](The%20Guide.md)` is written after the paragraph in one undo step
nominalAn image becomes an image reference
Giventhe same preview and a png file in a sibling folder, dropped together with a Markdown file that has no heading
Whenthe writer drops them after the last paragraph
Thenone new block ` [plain](plain.md)` is written after it: the image takes its file name without extension as alt text, and the file without heading takes its name
boundaryWhat is refused or left alone
| Case | Outcome |
|---|---|
| a drag that carries no file addresses, a block editor or property editor open, or edit mode off | no marker, no message; the page does nothing |
| a file outside every workspace folder (a standalone document takes any file), or an address that is not `file:` | not written; when none is left the host answers with a notice and the source is unchanged |
| a preview with restricted reads and a Markdown file | the file is not read: its link text is its name without extension |
| a file that VS Code holds read-only | refused with "This file is read-only in VS Code.", nothing written |
| a document that is not a saved file, a stale version | refused with a notice, nothing written |
| the insertion point is next to a block that comes from an included file | refused with the notice of the paste of blocks |
| more than 50 files in one drop | the page sends the first 50 |
| a file on another drive than the document, or a name with angle brackets or a line break | no reference for that file |
boundaryThe written reference
| Part | Outcome |
|---|---|
| destination | relative to the folder of the document (also for a file outside it, when the document is standalone), `/` separators, spaces and parentheses percent-encoded |
| link text | first heading of a Markdown file (md, markdown, mdx; first 64 KiB, outside front matter and code, emphasis marks removed); else the name without extension; `[`, `]` and `\` escaped |
| several files | their references on one line separated by a space, in drag order |