Behaviour SwRS-MDOKFSTUDIO-BLOCK-174
Paste inserts the clipboard as new blocks after the selection or insert point
When a writer presses the platform paste chord with blocks selected, or with an insert point focused, in edit mode and with no editor open, the extension SHALL insert the clipboard text as new blocks after the selection or the insert point, without the blank lines at both ends of the text, in the line breaks of the document, with one blank line before and after and without gluing them to their neighbours (a selection or insert point whose last line is the blank line that ends a block, a list mapped to its blank separator, inserts after that block, using the blank lines already there as separators, so no blank line is gained), and refuse with a reason, changing nothing, when the clipboard has no text or the document changed while it was read.
Step 3 of path 1 in StRS-MDOKFSTUDIO-BLOCK-016: from “The Markdown of the blocks is on the clipboard” to “The blocks are pasted as new blocks”.
Step 2 of path 2 in StRS-MDOKFSTUDIO-BLOCK-025: from “The blocks are on the clipboard and gone from the document” to “The blocks are in their new place”.
Scenarios 7
The situations the tests check; open one to read it.
nominalPaste after a selection
nominalPaste after a focused insert point
nominalPadded clipboard
boundaryLine breaks and a glued neighbour
nominalPaste after a list followed by blank lines
Pasting `X`; the page may send the first or the last blank line of a run, and both give the same text.
| Document | `afterLine` | Result |
|---|---|---|
| `Para\n\n- a\n- b\n\nNext\n` | 5 | `Para\n\n- a\n- b\n\nX\n\nNext\n` |
| `Para\n\n- a\n- b\n\n\nNext\n` | 5 | `Para\n\n- a\n- b\n\nX\n\nNext\n` |
| `Para\n\n- a\n- b\n\n\nNext\n` | 6 | `Para\n\n- a\n- b\n\nX\n\nNext\n` |
| `Para\n\n- a\n- b\n\n` | 5 | `Para\n\n- a\n- b\n\nX\n` |
refusalEmpty clipboard
| Input | Outcome |
|---|---|
| A clipboard that holds ` \n`, a paste is requested | The answer is ok false with "The clipboard has no text to paste." and the document is unchanged |
| A clipboard with a paragraph, a paste is requested | The paragraph is inserted |
refusalThe document changed while the clipboard was read
| Input | Outcome |
|---|---|
| A paste whose clipboard read is pending while the document is edited | When the read completes, the answer is ok false with "The document changed while pasting. Try again." and nothing changes |
| No change during the read | When the read completes, the paste is planned |
A paste after a line that does not exist, a blank line with no body block above it, a line holding only a no-break space, or a line that lies in the frontmatter, and a paste next to an included block, are refused as stated in SwRS-MDOKFSTUDIO-BLOCK-124 and SwRS-MDOKFSTUDIO-BLOCK-127. An open editor refuses the paste as stated in SwRS-MDOKFSTUDIO-BLOCK-041. A successful paste clears the block selection as stated in SwRS-MDOKFSTUDIO-BLOCK-169.