Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-263

A block editor left without a change, or whose final save writes nothing, always closes

When a writer leaves a block editor by Done, Cmd/Ctrl+Enter, a click on another block or an arrow past the edge of the text box, the page SHALL compare and post the text of the text box with the line endings of the source block, so that text that differs from the source only by the LF the text box returns is the source again and posts no save, and the host SHALL answer every final save that ends with nothing to render by a previewEditSource message with done set, to which the page answers by closing the editor.

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

Scenarios 3

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

nominalA text equal to the source but for its line endings is the source
InputOutcome
A block of a CR LF file (a hard-wrapped paragraph, a list item with nested items, the last item of a list), left by Done, Cmd/Ctrl+Enter, a click on another block or an arrow past the edge with no changeNo previewEditSave is posted, the editor closes, "Saving Markdown…" is never shown
A letter typed then deleted in the same editorNo autosave and no final save: the text is the source again
The move chord (Cmd/Ctrl+Alt+Up or Down) on the same unchanged editorThe editor closes and the move is requested at once, with no save
A real change in the same editorThe text posted by the autosave and by the final save has the line endings of the source block
The same blocks in an LF fileUnchanged: LF
nominalThe host answers every final save
InputOutcome
A final save whose text, once given the line endings of the block, equals the text last written (nothing to write)The document is not written and the host posts previewEditSource with done true for that edit id
A final save the host writes and rendersThe previewContentPatch is the answer; no done message
The page receives previewEditSource with done true for its open editor, which waits for a saveThe editor closes and a pending move to another block goes on, as after a patch
The same message for another edit id, or for an editor that is not savingIgnored
A cancelNo answer: the page closed the editor when it posted it
boundaryMixed line endings
InputOutcome
A block with mixed line endings, left unchangedSame as above: nothing is posted, nothing is written
The same block with one line changedThe lines left alone keep their line endings, the changed line takes the ending of the line it replaces

Implemented in 4

Tested by 5