Markdown OKF-Schema Studio

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
Giventwo selected blocks ending at line 10
Whenthe writer presses Ctrl+V
ThenpreviewBlocksPaste carries insertAfterLine 10 and the first line of the last block as pin
nominalPaste after a focused insert point
Givenno selection and the insert point of a block ending at line 6 focused
Whenthe writer presses Ctrl+V
ThenpreviewBlocksPaste carries insertAfterLine 6; an insert point for line 0 pastes at the start of the body
nominalPadded clipboard
Giventhe clipboard text `\n\nIntro.\n\n` pasted at the start of the body
Whenthe paste is applied
Thenthe text `Intro.` follows the frontmatter after one blank line and precedes the next block after one blank line
boundaryLine breaks and a glued neighbour
Givena CR LF document where the next block directly follows the paste line
Whenthe paste is applied
ThenCR LF is used and the new text is not glued to the following block
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
InputOutcome
A clipboard that holds ` \n`, a paste is requestedThe 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 requestedThe paragraph is inserted
refusalThe document changed while the clipboard was read
InputOutcome
A paste whose clipboard read is pending while the document is editedWhen the read completes, the answer is ok false with "The document changed while pasting. Try again." and nothing changes
No change during the readWhen 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.

Implemented in 3

Tested by 5