Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-PALETTE-039

A palette action edits in one undo step or leaves the text unchanged and says why

When a palette button, a slash command or a shortcut runs an action, the extension SHALL apply the edit that the action returns to the text box as one native editing step that autosaves the editor and leaves the selection that the action returned, and, when the action returns no edit, leave the text unchanged, put the focus back in the text box and show the reason in the status line when the action has one.

Part of StRS-MDOKFSTUDIO-PALETTE-015, outside the paths drawn on its map.

Step 3 of path 1 in StRS-MDOKFSTUDIO-PALETTE-019: from “The selection is wrapped in markers” to “The text is as it was before the button”.

Scenarios 6

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

nominalBold and undo
Givena text box with a selected word
Whenthe writer presses Bold and then the undo key combination
Thenthe word is wrapped in one step, the editor stays open and one undo restores the text
boundaryNo native editing command
Givena page where the native editing command is not available
Whenthe writer presses Bold
Thenthe text is spliced by hand, the editor reacts as to an input event and the returned selection is set
refusalAn action that makes no edit
Givena text box and an action that refuses the selection (the Colour action on a selection that straddles a span boundary)
Whenthe writer presses the button
Thenthe text is unchanged and the text box has the focus, and the same action on a valid selection applies the edit
refusalA refusal that has a reason
Givenan open editor and a command that makes no edit
Whenthe writer runs it as in the table
Thenthe text is unchanged (apart from the removed query) and the status line is as in the table
Started fromCaseOutcome
the button List table in a MyST editora table conversion that would lose contentthe text is unchanged and the status line gives the reason
the slash menuthe same refusal, or a conversion that would lose content chosen from the menuthe typed slash query is removed, the text is otherwise unchanged and the status line gives the reason
the slash menua command that refuses without a reasonthe query is removed and the status line is unchanged
boundaryInvalid selection
Givena text of 5 characters
Whena line or block action is applied with the selection of the table
Thenthe outcome is the one of the table
SelectionOutcome
ending at 9 (beyond the text)no edit
negativeno edit
start after its endno edit
inside the textthe edit is produced
nominalA matched shortcut is consumed
Giventhe block text box
Whenthe writer presses a palette shortcut that matches, such as Ctrl+B
Thenthe default is prevented and the event is stopped, whether or not the action returns an edit
SelectionOutcome
a selected wordthe word is wrapped and the event is stopped
a selection the action refusesthe text is unchanged and the event is still stopped, so the side bar does not toggle

Implemented in 3

Tested by 4