Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-033

The status line shows the lines and keys, with Done and Cancel beside it

When a writer opens a block editor, the page SHALL insert the editor frame in place of the block at once, expose it as a region named "Raw Markdown editor" around a text box named "Raw Markdown block" that switches off spell check and auto-correction, grows with its text and is drawn in monospace inside a one pixel border in the focus colour, hide the rendered block it replaces, and, when the host sends the block's source, fill the frame with the text box, a status line that shows the line range and the keys of the editor, and a primary Done button beside a Cancel button.

Step 2 of path 1 in StRS-MDOKFSTUDIO-BLOCK-003: from “The framed editor is open in place of the block” to “The writer edits the raw Markdown of the block with Done and Cancel at hand”.

Scenarios 12

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

nominalFrame at once, filled when the source arrives
Givena block editor just opened and previewEditSource not yet received
the source message of the open editor
Whenthe frame is inspected
it is received
Thenthe frame is in the page after the hidden block and holds no text box
the frame holds the text box, the status line and the buttons
nominalLine range in the status line
InputOutcome
Editor on lines 5 to 7, source arrivedThe status line starts with "Lines 5–7"
Editor on a one-line block at line 5The status line starts with "Line 5"
Editor opened from an insert pointThe status line starts with "New block"

The text before the first separator dot is exactly one of the three forms.

nominalKeys of the editor in the status line
PlatformThe status line ends with
macOS"Esc: cancel · ⌘↩: done"
Windows or Linux"Esc: cancel · Ctrl+Enter: done"

The keys before the done key read "Enter: new line · Tab: indent · Esc: cancel". In an editor opened on a one-line card part (a card title, `:header:` or `:footer:` line, SwRS-MDOKFSTUDIO-BLOCK-258), where Enter is done, they read "Enter: done · Esc: cancel": the whole hint is "Line 18 · Enter: done · Esc: cancel · ⌘↩: done" on macOS and ends with "Ctrl+Enter: done" on Windows or Linux.

nominalDone and Cancel buttons
Givenan open block editor
the same frame
Whenthe frame is inspected
the buttons are listed
Thenit holds Done first, labelled "Done editing", and Cancel second, labelled "Cancel editing and restore the original text" with the tooltip "Cancel (Esc)"; Done is styled as the primary button
no button named Save Markdown block or Cancel Markdown edit exists
boundaryPressing Done or Cancel keeps the focus in the text box
InputOutcome
Mouse button pressed on Done, with typed text in the editorThe mousedown default is prevented, the text box keeps the focus and no blur save is posted before the click
Mouse button pressed on Cancel, same editorThe same applies
boundaryA click inside the frame stays inside it
InputOutcome
Click in the text box, the status line or between the buttonsThe document click listeners do not run, so no other editor opens and the block selection is not touched
Click on another block while the editor is openThe document listeners run as usual
nominalBlock editor names
Givenedit mode on
Whena block editor opens on a paragraph
Thenthe frame has role region and the aria-label Raw Markdown editor, and the text box has the aria-label Raw Markdown block
boundaryCell that cannot be parsed
Giventhe editor of a table cell whose source cannot be parsed as a pipe table
Whenit opens
Thenthe frame falls back to the raw names above, as specified by SwRS-MDOKFSTUDIO-TABLE-001; an ordinary cell editor is named "Markdown table cell editor" by the table editing behaviour
nominalText box attributes
Text box ofAttributes set
a block editor receiving its sourcespellcheck is false and autocorrect, autocapitalize and autocomplete are off
an insertion editorthe same four attributes
nominalThe rendered block is hidden while its editor is open
EditorRendered block
a paragraph in edit mode, its editor opensthe paragraph carries data-sphinx-preview-editing true and is not displayed, with the frame right after it
the open editor closesthe attribute is removed and the paragraph is displayed again; a diagram block follows the same rule, see SwRS-MDOKFSTUDIO-DIAG-001
nominalThe frame is a one pixel accent frame with monospace text
PaneMeasured frame
a paragraph editor open in the dark theme at 900 pxthe border is 1 px, the font is monospace one pixel smaller than the editor font size and the tab size is 4
the same editor at 460 pxthe same border, font and tab size apply and the frame stays inside the column
nominalThe text box grows with its text
Givenan open editor, one row high at creation
Whenthe writer types more lines, or the preview layout changes, for example a width change
Thenthe height follows scrollHeight after every input and the height is computed again after a layout change, with no inner scrollbar

Implemented in 3

Tested by 5

Replaces

SwRS-MDOKFSTUDIO-BLOCK-029The block editor is a labelled one-pixel frame that hides its rendered block superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-033 Markdown file