Behaviour SwRS-MDOKFSTUDIO-BLOCK-264
An emptied top-level block or list item is deleted with its separator when the writer commits it
When the writer erases the whole text of the editor of a top-level body block or of a list item and commits it (Done, Ctrl or Cmd+Enter, or a blur that commits), the host SHALL delete that block with its trailing blank lines and one separator in one edit, instead of writing a placeholder line, and keep the document's line endings and its final line break.
Part of StRS-MDOKFSTUDIO-BLOCK-011, outside the paths drawn on its map.
Part of StRS-MDOKFSTUDIO-BLOCK-025, outside the paths drawn on its map.
Scenarios 4
The situations the tests check; open one to read it.
nominalA paragraph in the middle
Giventhe document `# Title`, `First.` and `Second paragraph.` separated by blank lines, and the editor of "First." erased
Whenthe writer commits it, before or after the autosave of the empty text reached the document
Thenthe document is `# Title`, a blank line, `Second paragraph.` and the final line break
nominalEdges of the deletion
Givenan emptied first block, last block, tight list item, loose list item, or a block whose range ends on blank lines, in a document with CR LF or a lone CR
Whenthe writer commits it
Thenno blank line is left at the start, the block above keeps the final line break, a tight list stays tight, a loose list keeps one blank line between its items, the trailing blank lines go with the block, and the document's line ending is kept
nominalOne edit before an autosave, two after
Givenan erased editor
Whenthe writer commits it before any autosave reached the document, or after one wrote the placeholder line
Thenone edit deletes the block (one undo brings it back), or the autosave and the deletion are two edits (two undos)
nominalCases that keep the placeholder line
Givena block inside a list item, an alert, a quote, an admonition or another container, an item left as `- `, an autosave of an empty text, Escape or Cancel, or held lines that no longer match the block
Whenthe writer commits it
Thenno deletion happens: the placeholder line is written, or the original text is written back