Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-014

A click or Enter on a mapped block opens its editor

When a writer clicks a rendered block in edit mode, or presses Enter or Space on a focused mapped block, the page SHALL open the editor of the mapped block under the click with previewEditOpen for its source lines instead of revealing its source, show in the editor the source text or the error that the host returns in previewEditSource, and give every rendered horizontal rule a box 25 px tall (the 1 px line plus 12 px of transparent padding above and below, with the page spacing unchanged) so that a click within 12 px of the line opens the rule's block editor.

Step 1 of path 1 in StRS-MDOKFSTUDIO-BLOCK-003: from “Edit mode is on” to “The framed editor is open in place of the block”.

Scenarios 11

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

nominalParagraph, image or admonition
Givenedit mode on, a paragraph mapped to lines 5 to 6, a plain image paragraph, an admonition directive (a `{note}` in a backtick or colon fence) and a GitHub alert (`> [!NOTE]`)
Whenthe writer clicks the paragraph, the image, the title or the body of the admonition, or the title or the body of the alert
Thenthe page posts previewEditOpen with the lines of the mapped block (5 and 6 for the paragraph, the complete directive from opening to closing fence for the admonition, whether the click lands on its title or in its body, the whole alert from its marker line to its last quoted line for the alert), hides the block and shows an editor frame after it
nominalEnter or Space on a focused block
Givenedit mode on and a focused paragraph
Whenthe writer presses Enter
Thenthe default action is prevented and the editor of the paragraph opens with the caret at the end, like a click
nominalLine range and placement per kind of block
Clicked block in edit modeEditor
an item of a list mapped to lines 5 to 8 with items at lines 5, 6 and 7 (also in a 460 px wide pane with long wrapped items), click on the item at line 6previewEditOpen carries the lines of that item only: the range the renderer gives the item, from its first line to the line before the next item (a blank line between two items belongs to the first, as it belongs to the list), whatever the item holds (paragraphs, an inline code span or a comment over several lines, an HTML block, a code block); the editor holds the item and its continuation lines, appears after the hidden item, and the wrapped source is not clipped; in an ordered list the next items keep their numbers while the item is edited
an item of a list nested in another list, or the rest of the outer itemthe editor holds the nested item only (the nearest item wins); a click elsewhere in the outer item opens the outer item, its nested list included
the list itself, outside its itemsthe editor holds the whole list; from the keyboard, the selected list opens the whole list too (SwRS-MDOKFSTUDIO-BLOCK-254)
a wrapped item of a tight list (no blank line between items)the editor holds every wrapped line of the item
another block, while an item editor holds changes, then a click on the first item of a listonce the save is rendered, the first item opens, not the list that starts on the same line
a paragraph or a list item in the body of a MyST admonition (`{note}` in a backtick or colon fence)previewEditOpen carries the lines of the directive, opening fence to closing fence, and the editor holds them; the nearest admonition or alert around the click wins over the list around it or inside it
a paragraph or a list item in the body of a GitHub alert, also an alert indented in a list itempreviewEditOpen carries the lines of the alert, marker line to last quoted line, and the editor holds them with their indentation; the alert wins over the list around it or inside it (SwRS-MDOKFSTUDIO-GFM-009)
a fenced code blockthe frame is a sibling after the pre, the pre carries data-sphinx-preview-editing true, and the text box holds the fence lines exactly as in the file; after the writer adds a line and presses Done, the final save still starts and ends with the fence lines
a block that comes from an {include}previewEditOpen names the lines of the {include} directive in the edited document and the editor holds the directive text; the included block carries data-sphinx-preview-included true
the words Diagram source of the collapsed disclosure of a Mermaid or PlantUML figurethe default toggle is prevented, the disclosure stays closed and the editor of the figure opens on the lines of the diagram block
boundaryA link inside a mapped block

A link here is any link inside a mapped block: a link inside a paragraph, a paragraph made only of a link (the closing "Next: Related" line of a chapter), the title, header, body or footer of a `:link:` card (SwRS-MDOKFSTUDIO-BLOCK-258), a linked image, a same-page anchor, a footnote reference or an external URL.

Input, edit mode onOutcome
click on a link, no modifierthe default action is prevented, the link is not followed (no previewLink) and the editor of the block that holds the link opens, as a click on the text around it does
Enter or Space on a focused linkthe same as a click: the default action is prevented and the block's editor opens
click on a mapped block that is itself inside a linkthe editor of that block opens and the link is not followed
click on a link with Cmd or Ctrl held, or Cmd/Ctrl+Enter on a focused linkthe link navigation runs (SwRS-MDOKFSTUDIO-TOOLBAR-077) and no editor opens
middle click on a linkthe link navigation runs and no editor opens
click on a link while the editor of another block is openas a click on any other block (SwRS-MDOKFSTUDIO-BLOCK-041): the open editor is saved first, no other file opens, so the keys typed next never reach the link target
the pointer over a linkthe block that holds it gets the edit-hover outline (SwRS-MDOKFSTUDIO-BLOCK-017) and the text cursor, like the text around the link; on a `:link:` card only the part under the pointer is outlined; a link whose click keeps its own behaviour (properties table, comment thread, open editor, outside a mapped block) keeps the pointer cursor and gets no outline
Input, edit mode off (reading)Outcome
click, Enter or Space on a linkunchanged: the link is followed and no editor opens
nominalThe tooltip says how to follow a link in edit mode
GivenWhenThen
a link inside a mapped block whose tooltip is its target path, its blocked reason or its `link-alt` textedit mode is turned onthe tooltip keeps that text on its first line and gets the second line "Cmd+click to follow" on macOS, "Ctrl+click to follow" elsewhere; a link without a tooltip shows only that line
the same link in edit modethe host answers a target discovery for it, or the content is rendered againthe new target is the first line and the second line stays
the same linkedit mode is turned offthe second line is removed and the tooltip is the text it had without it
a link value of the properties tableedit mode is turned onits tooltip is unchanged
refusalTargets that open no block editor
Input in edit modeOutcome
Enter or Space with focus on a text box, a button, a link value of the properties table, a comment chip, an insert point or the Description toggleno block editor opens
click on a comment chip in a paragraphthe chip expands and no editor opens
click on the body of an open comment threadno editor opens
click, Enter or Space on a link value of the properties table, in a comment thread or on the anchor icon of a labelthe link keeps its own behaviour (field editor, thread, label rename) and no block editor opens
click on a cell of the properties tableno block editor opens; the field editor of the cell is specified by SwRS-MDOKFSTUDIO-FMEDIT-001
click on a paragraph below the properties tableits block editor opens as usual
refusalReading mode
Input in reading modeOutcome
click on a paragraphno previewEditOpen is posted and no editor frame appears
click on the words Diagram source of a Mermaid figurethe disclosure opens or closes as usual, no editor opens, and the click reveals the source line
nominalThe host answers with previewEditSource
Giventhe page posted previewEditOpen with an edit id and a line range, and no other block is being edited
Whenthe host answers with previewEditSource for the same render and the same edit id
Thenthe answer carries line, endLine and originalText, the exact source text of those lines (originalText is "" and insertAfterLine is set for an insertion editor), and the editor of that edit id fills its text box with originalText and remembers its line ending (CRLF, LF, CR or none)
refusalAn error or a malformed previewEditSource
InputOutcome
previewEditSource with an error string for the active edit idthe editor stays, its status line shows the error text, pending navigation and selection are cleared and the editor accepts input again
previewEditOpen for lines that no longer exist in the documentthe host answers with previewEditSource carrying the error "The preview is stale. Refresh it before editing this block."
previewEditOpen while another block is being editedthe host answers with previewEditSource carrying the error "Another Markdown block is already being edited." (see SwRS-MDOKFSTUDIO-BLOCK-041)
previewEditSource with an edit id other than the active editor's, or with no active editorignored
previewEditSource with neither an error string nor a string originalTextignored
previewEditSource that arrives when the text box already existsignored
nominalClick above the line
Givena rendered page with a horizontal rule and edit mode on
Whenthe writer clicks 10 px above or below the line of the rule
Thenthe click lands on the rule and opens its block editor
boundarySpacing unchanged
Giventhe same page
Whenthe rule is laid out
Thenits 12 px of padding on each side is taken from its margin, so the distance between the surrounding blocks is the same as with a bare 1 px rule

Implemented in 9

Tested by 16

Replaces

SwRS-MDOKFSTUDIO-BLOCK-002A horizontal rule has a tall invisible hit area superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-014 Markdown file