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
| Input | Outcome |
|---|---|
| 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 item | The 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 item | The item sits before the third |
| While the pointer is held over an item | The 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 list | The 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 it | The 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 strip | No line shows; a drop there requests nothing and the document is not edited |
nominalKeyboard move with Alt+Up and Alt+Down
| Input | Outcome |
|---|---|
| Focus on the handle of the first item, Alt+Down | The 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 last | Nothing happens |
| Alt+Down repeated before the render of the previous move arrived | The 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
| Input | Outcome |
|---|---|
| Edit mode on, a list of two items or more | Each 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 list | The 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 it | That block is pushed right by a handle's width, so every handle stays in the pane |
| The page is resized, or rendered again | The handles are placed again on their items as laid out now, in the next frame, reading each box once per pass |
| Edit mode switched off | The handles are gone and a pushed block returns to its place |
| A click on a handle | No editor opens; the pointer over a handle outlines the item it moves |
nominalNesting, numbering and markers
| Input | Outcome |
|---|---|
| An item with a nested list, a fenced code block or a blank line inside | The 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 list | A 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 items | Each item keeps its marker and its checkbox text |
| CRLF line endings, or no final line break | The line endings and the end of the source are kept |
boundaryLists in a quote, an alert or an admonition
| Input | Outcome |
|---|---|
| A list in a quote, a GitHub alert, a MyST admonition or two nested admonitions | The 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 admonition | The whole container opens in its editor, as before (SwRS-MDOKFSTUDIO-BLOCK-014) |
boundaryOne edit, one undo
refusalLists and states without a move
| Input | Outcome |
|---|---|
| A list of one item, a list of an included file, a list in the properties table | No 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 render | The 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 seconds | No 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
- test/core/preview/listItemHandleStyles.test.tsunit
- test/integration/listItemMoves.tsintegration
- test/page/modules/listItemMove.test.tsunit
- test/page/runtimeListItemMove.test.tsunit
- test/session/listItemRange.test.tsunit
- test/visual/capture_list_item_handles.pyvisual
- test/visual/listItemHandleScenarios.tsvisual