Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-041

One edit at a time: an open editor blocks other edits, opens and refreshes

While a block editor or a field editor is open, the extension SHALL refuse every action that would compete with it (a second editor, a block move, a block selection, a copy, a cut or a paste, a label rename, a thread change, a checkbox toggle and a refresh) with the reason of its row in the table below and change nothing.

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

Scenarios 8

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

nominalEvery blocked action, with its exact reason

The page refuses with the open editor's status line unless the row says otherwise. The host holds an open block edit and answers the request with `ok false` and the reason (or the error of the answer).

Blocked actionOpen editorWhere it is refusedOutcome and exact reason
Open a second block editor (click, insert point or key)block editorpageThe request is ignored and the first editor stays open; no message
Open a second block editorblock edit held by the hosthost (`previewEditOpen`)`previewEditSource` carries the error "Another Markdown block is already being edited."
Click on a block or a plus insert pointfield editorpageThe field editor's plain save is posted first and the block editor waits for its answer. Saved: the block editor opens. Refused (invalid YAML, a value the schema refuses): the field editor is cancelled, the field shows its saved value again, the refused text is discarded and the block editor opens
Open a field editor, a key editor or a second value editorfield editor or block editorpageNo second field editor opens and the first stays open; no message. Exception: a field editor whose save was refused and that still holds the refused text is closed without a save (the field shows its saved value, the refused text is discarded) and the clicked field's editor opens in the same click
Edit figure buttonfield editorpageNo figure editor opens; no message
Enter shortcut of the empty-document Start writing insert pointfield editorpageNo block editor opens; no message
Extend a block selection (Shift+click, Shift+Arrow)field editorpageNo block is selected; the keys are also ignored inside a text box, a field and the property table
Block move shortcutfield editorpageNothing is moved
Block move (`previewBlockMove`)block edit held by the hosthostAnswer `ok false`, reason "Save or cancel the open Markdown edit before moving a block."; nothing changes
Copy, cut or paste of blocks (`previewBlocksCopy` and its cut and paste kin)block edit held by the hosthostAnswer `ok false`, reason "Save or cancel the open Markdown edit first."; nothing changes
Rename a label (anchor icon)block editor or field (properties) editorpageThe rename field opens disabled with "Save or cancel the open edit before renaming a label." and nothing is posted
Rename a label (`previewLabelRename`)block edit held by the hosthostNothing changes; the answer carries the reason "Save or cancel the open Markdown edit before renaming a label."
Reply or Delete thread of an inline threadblock editor or field (frontmatter) editorpageNothing is sent; the message "Save or cancel the open edit before changing a thread." is shown and the typed reply text is kept
Reply or delete of an inline threadblock edit held by the hosthostThe answer is "Save or cancel the open Markdown edit before changing a thread." and the document is unchanged; the host answers before it reads the document
Task-list checkbox clickblock editor or field (frontmatter) editorpageThe toggle is cancelled, no `previewCheckboxToggle` is posted and the editor status shows "Save or cancel this edit before toggling a checkbox."
Radio option press and click (SwRS-MDOKFSTUDIO-GFM-041)block editor or field (frontmatter) editorpageThe guard runs on the press (mousedown, capture phase), before the editor's blur: the press is prevented, so the focus and the caret stay in the editor and nothing is committed; the click sends no `previewCheckboxToggle`, the editor stays open and its status shows "Save or cancel this edit before choosing an option."
Task-list checkbox toggle (`previewCheckboxToggle`)block edit held by the hosthostThe checkbox answer carries the error "Save or cancel the open Markdown edit before toggling a checkbox." (untested)
Refresh requested from the page (`refreshPreview`)block editor or field editorpageNo `previewRefresh` is posted; the editor status shows "Save or cancel this edit before refreshing."
Refresh button of the toolbarblock editor or field editorpageThe button is disabled while the editor is open and enabled again when it closes
nominalThe same requests with no editor open
Givenno open block editor, no open field editor and no block edit held by the host
Whena click, an insert point or a key requests an editor, or `previewEditOpen` arrives, or `previewBlockMove` or `previewBlocksCopy` arrives, or a rename, a thread change or a checkbox click is requested, or a refresh is requested
Thenthe editor opens (the source of the block is sent), the move or the copy is planned, the request is sent (rename, thread change, `previewCheckboxToggle`, `previewRefresh`), the Refresh button is enabled and a delete of an inline thread is applied
boundaryA click on a block while a field editor holds a value
Givena field editor that holds a changed value and the writer clicks a block or a plus insert point
Whenthe host saves the value
the host refuses the value instead
Thenthe field is saved and the block editor opens once the answer arrives
the field editor closes without a second save, the field shows its saved value and the block editor opens
boundaryRefresh Preview command over an open editor
Givenan open editor and the Refresh Preview command of the writer
Whenthe render finishes
Thenthe host delivers it to the page even though the editor is open, it replaces the page, the open editor closes without a cancel and `forceNextResult` is reset when the render is delivered
boundaryA further edit after the refresh
Givena further edit after the Refresh Preview command
Whenits render finishes
Thenit waits for the editor again
boundaryA click on another block while changed text is held
Givena block editor that holds changed text
Whenthe writer clicks another block
Thenthe first editor is saved through its blur and stays open until the render of its save arrives, and the second block opens once, when that render arrives, without a second click; the save in flight is not posted again; an editor with unchanged text closes at the blur and the same click opens the second editor
boundaryNo edit gesture runs while an edit is in flight
Givenan open editor, or a detached save (a final save whose editor the writer closed and the host has not answered)
Whenthe writer clicks a block, a field, an insert point, a move handle, a list item or a file drop
Thennothing opens or moves: the open editor keeps its reasons, and the gesture of a detached save waits, as a pending navigation, until the save ends and is dropped if it fails
boundaryA field clicked while a cancelled block save is in flight opens when it ends, and is dropped if it fails
Givena detached save and a click on a frontmatter field
Whenthe save succeeds the field opens; when it fails the click is dropped and the reopened editor shows the text
Then

Implemented in 16

Tested by 16

Replaces

SwRS-MDOKFSTUDIO-FMEDIT-002A field editor does not open while another editor is open superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-058Refresh is blocked while a field editor is open superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-059A checkbox toggle is refused while a field editor is open superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-072Block selection and block moves ignore input while a field editor is open superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-073The figure editor and the Start writing Enter shortcut ignore input while a field editor is open superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-GFM-025Checkbox clicks are refused during an open edit superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-MYST-043The host refuses a rename while an edit is open superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file
SwRS-MDOKFSTUDIO-MYST-050Rename is blocked while an editor is open in the page superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-041 Markdown file