Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-262

List item handle reorders an item among its siblings in edit mode

When the writer drags the handle of a list item in edit mode onto another item of the same list, or presses Alt+Up or Alt+Down on that handle, the extension SHALL move that item, with its sub-items and blocks, to the new position among its sibling items as one source edit and keep the numbers of an ordered list in order.

Step 1 of path 3 in StRS-MDOKFSTUDIO-BLOCK-014: from “Edit mode is on and a list has two items or more” to “The list's lines are saved with the item at its new place”.

Scenarios 7

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

nominalDragging the handle of an item
InputOutcome
Edit mode on, a bullet list of three items, the handle of the first item dragged and dropped on the lower half of the third itemThe item sits after the third; the document gets one text edit of the list's lines only, and the text outside the list is unchanged
The same drag dropped on the upper half of the third itemThe item sits before the third
While the pointer is held over an itemThe dragged item is dimmed and a line above or below the item under the pointer shows where the item would land, until the drop or the end of the drag
The pointer is held over the strip of the handles left of the listThe line shows on the nearest gap, as over the item at that height, and a drop there moves the item
Dropped on the lower half of the item before it, or on the upper half of the item after itThe item keeps its place: no line shows, nothing is requested from the host and the document is not edited
The pointer is held over another list, or outside the list and its handle stripNo line shows; a drop there requests nothing and the document is not edited
nominalKeyboard move with Alt+Up and Alt+Down
InputOutcome
Focus on the handle of the first item, Alt+DownThe item swaps with the second as one edit, and after the render the focus is on the handle of the item at its new place
Alt+Up on the handle of the first item, or Alt+Down on that of the lastNothing happens
Alt+Down repeated before the render of the previous move arrivedThe repeat is ignored

The chord on a handle is not also read as the move of the whole list block. In an open list item editor, the Cmd/Ctrl+Alt chord still moves the whole list (SwRS-MDOKFSTUDIO-BLOCK-130).

nominalThe handle beside its item
InputOutcome
Edit mode on, a list of two items or moreEach item shows the handle of the frontmatter list editor (named "Move list item") just left of its list, outside it, centred on the item's first line, with no hover needed
An item with sub-items, a nested listThe handle of the item stays on its first line; each item of the nested list has its own handle, left of the nested list
A list with less than a handle's width of room on its left (it fills the column in a narrow pane), or the alert or admonition that holds itThat block is pushed right by a handle's width, so every handle stays in the pane
The page is resized, or rendered againThe handles are placed again on their items as laid out now, in the next frame, reading each box once per pass
Edit mode switched offThe handles are gone and a pushed block returns to its place
A click on a handleNo editor opens; the pointer over a handle outlines the item it moves
nominalNesting, numbering and markers
InputOutcome
An item with a nested list, a fenced code block or a blank line insideThe item moves whole, with its sub-items and blocks, and only among its sibling items; it is never dropped into another list nor changes its level
A tight list, or a loose listA tight list stays tight; the blank lines between the items of a loose list stay in place
An ordered list starting at 3, or written with `)`The numbers stay in order from the first number, and each item keeps its delimiter; a list whose items all carry the same number keeps it
A marker that grows from `9.` to `10.`The continuation lines of the moved item are indented by one, so its nesting stays
Bullet items with `-`, `*` or `+`, and task itemsEach item keeps its marker and its checkbox text
CRLF line endings, or no final line breakThe line endings and the end of the source are kept
boundaryLists in a quote, an alert or an admonition
InputOutcome
A list in a quote, a GitHub alert, a MyST admonition or two nested admonitionsThe handles sit left of the outermost box; a move saves only the list's lines, each with its quote prefix kept, blank quote lines included
A click on an item of a list in an alert or an admonitionThe whole container opens in its editor, as before (SwRS-MDOKFSTUDIO-BLOCK-014)
boundaryOne edit, one undo
Givenan item moved by drag or by key
Whenthe move is saved
Thenthe page posts one `previewEditOpen`, then one final `previewEditSave` of the list's lines, opens no editor, and the editor's undo restores the previous order in one step
refusalLists and states without a move
InputOutcome
A list of one item, a list of an included file, a list in the properties tableNo handle is shown
A drag or Alt+Up or Alt+Down while a block editor or the frontmatter editor is open, or while a move waits for its renderThe drag is cancelled or the key is ignored and nothing is requested
The host answers the request for the list source with an error, or no answer arrives within 5 secondsNo edit is saved and the page tells the host the move is closed
The source does not read as the rendered items (another count, text before the first item, a line with less indentation, mixed quote prefixes)No edit is saved and the page tells the host the move is closed

Implemented in 6

Tested by 7