Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-268

Typing or pasting in a blank-line block writes the text in place of that blank line

When the writer types a block in a blank-line block, or pastes in it, the extension SHALL write the text in place of that one blank line and keep the other blank lines, adding a blank line before or after the text only where the neighbouring line exists and is not blank, in one text edit, write nothing for an empty Done, restore the line on Cancel, keep the editor open across an autosave re-render and close it on the render that follows its final save, and refuse a stale line. A text written in place of a blank line inside a list takes the content indent of the item (CommonMark's content column), or the item's own indent when the line is between two items and the first line of the text starts with a list marker; the host checks the item line and refuses it as stale when it is not a list item line. A text written in place of a blank line inside a quote keeps the quote markers of the line, and one inside a directive, a panel, a definition or a footnote takes the indent of that container; the host checks the container line and refuses it as stale when it is not a line of that shape.

Step 2 of path 3 in StRS-MDOKFSTUDIO-BLOCK-011: from “A blank-line block is shown” to “The typed text is in the document where the blank line was”.

Part of StRS-MDOKFSTUDIO-BLOCK-025, outside the paths drawn on its map.

Scenarios 6

The situations the tests check; open one to read it.

nominalTyping writes the text in place of that blank line
Giventhree blank lines between two blocks, whose second and third are blank-line blocks, and the editor of the second open
Whenthe writer types a block, then keeps typing across an autosave
Thenthe host replaces that one line with the text in one text edit and keeps the other blank lines, and later saves replace that same text
nominalA separator only where needed
Givena blank-line block whose line is next to a block, at the end of the body, or at line 1 of a file without frontmatter
Whenthe writer types in it
Thena blank line is added before or after the text only on the side where a neighbouring line exists and is not blank
nominalEmpty Done, Cancel and a paste
Giventhe same editor, or a paste on the blank-line block
WhenDone is pressed with no text, Cancel is pressed after an autosave, or a block is pasted
Thenan empty Done changes nothing, Cancel puts the line back, and the paste replaces that one line, with a blank line added only where the neighbour is not blank
nominalDone closes the editor
Givena blank-line block's editor with typed text
Whenthe writer presses Done and the host writes the text and renders it
Thenthe editor closes, "Saving Markdown…" is gone and the text shows in place of that blank line
nominalA block typed inside a list item stays in the item
Givena blank line between two list items, or inside a list item, and its editor open
Whenthe writer types "More" or "- c" and the host saves or pastes it
Then"More" is indented to the item and stays in it, "- c" between two items is an item at the item level, "- c" inside an item is a nested list of that item, and the blank lines around the text get no indent
nominalA stale run
Givena line that changed or never was a blank line, or an item line that is not a list item line
Whenthe editor is opened or saved
Thenthe host refuses it with an error and the document does not change

Implemented in 12

Tested by 17