Behaviour SwRS-MDOKFSTUDIO-TABLE-002
Table row handle reorders body rows in edit mode
When the writer drags the handle of a body row of a pipe table or a list-table in edit mode onto another row, or presses Alt+Up or Alt+Down on that handle, the extension SHALL move that row to the new position as one source edit and keep the header rows in place.
Step 1 of path 1 in StRS-MDOKFSTUDIO-TABLE-002: from “A table is shown in edit mode with a handle beside each body row” to “The row is at its new position”.
Scenarios 10
The situations the tests check; open one to read it.
nominalDragging the handle of a body row
| Input | Outcome |
|---|---|
| Edit mode on, a pipe table of a header and four body rows, the handle of the first body row dragged and dropped on the lower half of the third body row | The row sits after the third row; the document gets one text edit that only reorders the lines of the table, each line keeping its own spacing and indentation, and the document text outside the table is unchanged |
| The same drag dropped on the upper half of the third body row | The row sits before the third row |
| While the pointer is held over a row | The dragged row is dimmed and a line below or above the row under the pointer shows where the row would land, until the drop or the end of the drag |
| Dropped on the upper half of the row that follows it | The row keeps its place, nothing is requested from the host and the document is not edited |
| The pointer is held anywhere over the body rows of the table or over the strip of the handles left of the table (over another row's handle too) | The marker shows on the nearest gap: the line above the row when the pointer is on its upper half, below it on its lower half; it follows the pointer from row to row and a drop there moves the row |
| The pointer is held over a header row, or leaves the table and its handle strip | No marker 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 second body row, Alt+Down | The row swaps with the third body row as one edit, and after the render the focus is on the handle of the row at its new place |
| Alt+Up on the handle of the third body row | The row swaps with the second body row |
| Alt+Up on the handle of the first body row, 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 rows on the page are stale until the render arrives |
The chord is not also read as the move of the whole table block.
nominalMoving a row of a `{list-table}`
| Input | Outcome |
|---|---|
| A `{list-table}` with `:header-rows: 1` and three body rows, the handle of the first body row dropped after the third | The first body item (the `* -` line and all its nested `-` cell lines, continuation lines, nested lists and the blank lines inside it) now follows the third; the directive line, the title, the options, the indentation, the fence and the blank lines between items stay where they were |
| `:header-rows: 2` (or 1, or 0 or absent: no header row) | The rows under the header count have a handle and move among themselves; the header rows have none and nothing is dropped into them |
| A list-table in a container (indented, or fenced with colons or backticks) | The move keeps the indentation, the fence style and the line endings of the source |
| A list-table written with an option block that is not readable (a non-numeric `:header-rows:`), or text between the options and the first item | The move is refused and the document is not edited |
nominalA row with text after its closing pipe
| Input | Outcome |
|---|---|
| A pipe table row with a token after its closing pipe (`| alpha | 1 | ^row-a`), moved by its handle or by Alt+Up or Alt+Down | The row moves with its tail as one line; the handles of such a table work as those of any pipe table |
| A new row inserted after that row, or a row deleted | The new row has no tail; a deleted row takes its tail with it |
nominalThe handle beside its row
| Input | Outcome |
|---|---|
| Edit mode on, a pipe table or a `{list-table}` with at least two body rows | Each body row shows the handle of the frontmatter list editor (named "Move table row") just left of the table, outside it and vertically centred on its row; the header rows show no handle |
| A table with less than a handle's width of room on its left (it fills the column in a narrow pane) | The table is pushed right by a handle's width, so every handle stays in the pane and is never clipped |
| A table wider than the pane, which scrolls sideways | The handles stay left of the table, outside its scrolling box, at the height of their row |
| A row that wraps onto several lines | Its handle is centred on the whole row |
| A table that breaks out of the margin (Auto width), or that returns to the column, after the handles were placed or after a row move rendered the page again | The handles are placed again on the table's real left edge, at the height of their row as laid out now, never at the place of the narrower table |
| The page is resized or the zoom changes | The handles follow their rows |
| Edit mode switched off | The handles are gone and a pushed table returns to its place |
| A click on a handle | No cell editor opens |
refusalTables and states without a row move
| Input | Outcome |
|---|---|
| A table inside a figure that is not a `{list-table}` (a `{table}` with a caption), an HTML table, a table of an included file, and the properties table | No handle is shown |
| A pipe table with one body row | No handle is shown (nothing to reorder) |
| A drag or an Alt+Up or Alt+Down while a block editor, a frontmatter editor or a cell editor of another table is open, while the source of an open cell editor has not arrived, or while a move waits for its render | The drag is cancelled or the key is ignored and nothing is requested |
| Edit mode off | No handle exists, so neither a drag nor a key moves a row |
| A drop on the header row, or a drag that ends outside the body rows | Nothing is requested from the host and the document is not edited |
nominalA cell editor of the table is open
| Input | Outcome |
|---|---|
| A cell editor of the pipe table is open (its source has arrived) and the handle of a body row is dragged, or Alt+Up or Alt+Down is pressed on it | The text of the open cell is part of the table that moves; the row is moved in the editor's table model and the editor is saved and closed as one edit, with no request for the table source |
| The same drag on the handle of a row of a table the open editor does not belong to | The drag is cancelled |
refusalThe source of the table is refused or is not a pipe table or list-table
| Input | Outcome |
|---|---|
| The host answers the request for the table source with an error (a stale preview, another block being edited) | No edit is saved and the page tells the host the move is closed |
| The source the host returns is neither a pipe table nor a `{list-table}` that can be read as rows, or the move is refused by the table model (header row, index outside the body rows, same place) | No edit is saved and the page tells the host the move is closed |
boundaryOne edit, one undo
Givena body row moved by drag or by key
Whenthe move is saved
Thenthe page posts one `previewEditSave` of the whole table text (final) after one `previewEditOpen`, opens no cell editor, and the editor's undo restores the previous order in one step
boundaryA table inside a quote or an admonition
| Input | Outcome |
|---|---|
| The handle of a body row of a pipe table inside a blockquote, a GFM alert or a MyST admonition, dragged or moved with Alt+Up or Alt+Down | The row moves as for a top-level table and every line of the table keeps its container prefix; a source holding no pipe table or more than one is refused and nothing is saved (see SwRS-MDOKFSTUDIO-TABLE-121) |
Implemented in 3
Tested by 7
Known limits (2)
- A row handle only appears for a pipe table or a `{list-table}` written directly in the document. Rows of a captioned `{table}` and of an HTML table cannot be reordered with a handle.
- A table that is pushed right in a narrow pane is a handle's width narrower in edit mode, so it may wrap its text earlier than in reading mode. The handles are placed for a left-to-right page.