Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TABLE-055

Row and column buttons add and remove rows and columns

When the writer presses a row or column button of the table bar, the extension SHALL insert an empty row or column before (Row above, Col left) or after (Row below, Col right) the selected one, or delete the selected body row or column, store the text typed in the current cell, keep the text of every other cell and the style of every line, select the new or nearest remaining row or column, save the table and reopen the editor at the new position once the page rendered it again, with Row above disabled in the header row and Row − and Col − disabled where the table model refuses the deletion, offer the same buttons on a plain list-table (one header row, one-line cells, no title, label or option other than header-rows) and write its changed grid back as a list-table, change only the lines the operation concerns (a column operation keeps the padding, the indentation and the outer pipes of every line), and close the popover, link panel and slash menu of the cell it leaves.

Step 3 of path 1 in StRS-MDOKFSTUDIO-TABLE-008: from “The table bar is shown above the table” to “An empty row is next to the selected one”.

Scenarios 14

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

nominalRow below inserts an empty row
InputOutcome
Editor in the first body row of a table with two body rows, Row belowAn empty body row sits between the first and the second body row, the editor is in the same column of that new row and the status reads "Row 2 of 3" followed by the column
Editor in the header row, Row belowThe new row is the first body row and is selected
nominalRow − deletes the selected row
InputOutcome
Three body rows, editor in the second, Row −Two body rows remain and the editor is on the row that took the deleted row's place
Editor in the last of two body rows, Row −The previous body row is selected
nominalCol right and Col − insert and delete a column
InputOutcome
Three-column table, editor in the first column, Col rightA column of empty cells sits between the first and second columns, its delimiter cell is "---" and the editor is in the new column of the same row
Editor in the last column, Col rightThe new column is the last one and is selected
Three-column table, editor in the second column, Col −Every row loses its second cell and the editor is in the column that took its place
Editor in the last column, Col −The previous column is selected
refusalDisabled buttons and model refusals
InputOutcome
Editor in the header row, the bar inspectedRow − is disabled
Table with one body row and the editor in it, the bar inspectedRow − is disabled, and deleteRow on the model returns no row and removes nothing
Table of one column and the editor in it, the bar inspectedCol − is disabled (read from tableCellEditor.ts, untested)
deleteColumn called on the one-column modelIt returns no column and removes nothing
nominalTyped text kept
Given"new" typed in the selected cell and Row below pressed
Whenthe table is saved
Thenthe saved text carries "new" in the original cell, and the editor reopens in the new row
nominalSaved by the button itself
Givena row added with no further typing
WhenRow below is pressed
Thena final previewEditSave is posted at once, the page renders the new table and reopens the editor in the new row (no editor stays in a cell of the rendered table that shows another cell's text)
boundaryA column button keeps the style of every line
InputOutcome
An indented table with padded columns and alignment colons, Col right pressed, the table savedEvery line keeps its indentation, its padding and its outer pipes; the new cell is as wide as the cell on its left, its delimiter cell is dashes of that width, and the other cells are kept verbatim
A compact table "|A|B|", Col − pressed on the first columnEvery line loses its first cell and keeps its outer pipes and its absence of spaces
A table without outer pipes, Col − pressed on the last columnThe pipe before the removed cell goes with it; the lines stay parseable
A row that cannot be edited in place (the result would not split into the expected cells)That line alone is written in the canonical form "| a | b |", keeping its indentation
Col right then Col − on the same positionThe table is back to its original text
The same table with only Row below pressed, the table savedThe other lines are kept verbatim
boundaryThe open panels belong to the cell they were opened in
InputOutcome
Emoji picker open from the cell bar, Col right pressedThe picker is closed
Link panel open from the cell bar, Tab pressedThe panel is closed and the editor is in the next cell
The cell editor is rendered for another cell after a row or column button or a moveThe open popover or panel of the cell formatting group and the slash menu are closed, because they act on the text selected in the cell that was left
nominalRow above on a body row
InputOutcome
Editor in the second body row, "qq" typed in the cell, Row aboveA final previewEditSave carries an empty body row above that row and "qq" in the original cell; the page reopens the editor in the new row, in the same column
refusalHeader row
InputOutcome
Editor in the header row, the bar inspectedRow above is disabled and nothing is saved
nominalCol left on a column
InputOutcome
Editor in the header cell "B" of a two-column table, Col leftA final previewEditSave carries a table whose header reads "A", an empty cell, "B", whose delimiter row has a third "---" cell and whose body rows gain an empty cell at the same place; the title "B" is kept; the page reopens the editor in the new column of the same row
boundaryStyle kept
InputOutcome
An indented, padded table, Col left on its first columnEvery line keeps its indentation, padding and outer pipes, as for Col right (see SwRS-MDOKFSTUDIO-TABLE-055)
nominalButtons on a list-table
InputOutcome
A cell of ```{list-table} with ":header-rows: 1", Col leftThe cell editor opens, and the saved text is the list-table with an empty first cell added to every row (`* -` followed by the other cells)
The same list-table, a cell edited and committed with no buttonOnly the cell changes in the saved list-table
The same list-table, nothing changedThe text is saved as it was, character for character
refusalNot a plain list-table
InputOutcome
A list-table with a title, a label, ":widths:", no ":header-rows: 1", several-line cells or indentationThe whole block opens in the raw Markdown editor, as before
A plain list-table open in the cell editorList table (the conversion button) is disabled

Implemented in 3

Tested by 3

Replaces

SwRS-MDOKFSTUDIO-TABLE-003Row above inserts an empty row above the selected body row superseded superseded by SwRS-MDOKFSTUDIO-TABLE-055 Markdown file
SwRS-MDOKFSTUDIO-TABLE-004Col left inserts an empty column to the left of the selected column superseded superseded by SwRS-MDOKFSTUDIO-TABLE-055 Markdown file
SwRS-MDOKFSTUDIO-TABLE-005The row and column buttons also edit a plain list-table superseded superseded by SwRS-MDOKFSTUDIO-TABLE-055 Markdown file