Behaviour SwRS-MDOKFSTUDIO-PALETTE-001
The palette mode decides the button sets, in registry order
When the extension builds the edition palette of a block editor, the extension SHALL start it with a select named Palette buttons that offers Strict Markdown, GitHub (GFM), MyST and Full and shows the current mode, and list below it the buttons of that mode in the order of the registry, marking the start of each group.
Step 2 of path 1 in StRS-MDOKFSTUDIO-PALETTE-002: from “The focus is in the mode select” to “The palette shows the buttons of the chosen mode”.
Scenarios 10
The situations the tests check; open one to read it.
nominalSelect in the palette
Givenan open block editor in the GFM mode
Whenthe palette is inspected
Thenits first control is a select with the accessible name Palette buttons and four options with the values strict, gfm, myst and full labelled Strict Markdown, GitHub (GFM), MyST and Full, and the option gfm is selected
nominalEach mode adds its buttons to those of the mode before
Givenan open paragraph editor in the strict, gfm, myst or full mode
Whenthe palette is inspected
Thenthe buttons are those of the row of the mode, in registry order, the select reads the mode and the palette carries data-palette-mode with the mode name
| Mode | Buttons shown | Not in the palette |
|---|---|---|
| strict | Heading, Bold, Italic, Strikethrough, Colour, Colour code, Link, Image, Code block, Blockquote, Horizontal rule, Table, Emoji, TODO and Thread; Colour code is hidden until the caret is in a colour code; the two list actions of the slash menu have no button | no GitHub or MyST button: Alert, Checkbox, HTML table, Admonition and Figure |
| gfm | the strict buttons, followed by the eight GitHub buttons Alert, Checkbox, HTML table, Collapsible, Footnote, Mermaid, Column alignment and Key | Admonition, Math and Figure |
| myst | the GitHub buttons, followed by the MyST buttons Admonition, Definition list, Math, Subscript, Superscript, Label, Reference, Document link, Citation, Dropdown, Table with caption, List table, Pipe table, Figure and Key (MyST); List table and Pipe table are hidden unless the caret is in a table of the matching form | none; both Key (the HTML kbd element) and Key (MyST) (the kbd role) are present, because the modes add up |
| full | the MyST buttons, followed by the Full buttons Vega-Lite chart and Vega chart (see SwRS-MDOKFSTUDIO-PALETTE-278) | nothing of the other modes is missing |
nominalOrder and groups
Giventhe MyST mode
Whenthe buttons are listed
Thenthey follow the registry order from Heading to Key (MyST), and the first button of each group other than the first carries data-edit-group-start (the groups are inline, block, insert, annotation, github, myst and full)
nominalThe editor opened from an insert point
Giventhe GFM mode and an editor opened from an insert point
Whenthe palette is inspected
Thenits buttons equal those of a paragraph editor in the GFM mode and it carries data-palette-mode gfm, and in the strict and the MyST modes the two palettes list the same buttons as well
nominalChoosing another mode
Givenan editor in the strict mode with some text typed
Whenthe writer chooses MyST in the select
Thenthe buttons are rebuilt at once, the MyST buttons are shown, the select reads MyST, the text and the focus stay in the text box and no save is posted (the choice is stored for the workspace, see SwRS-MDOKFSTUDIO-LIFE-169)
refusalSame mode again or a value outside the four modes
Givena palette in the GFM mode
Whenthe select fires a change
Thenthe outcome is the one of the table
| Select change | Outcome |
|---|---|
| to gfm again | nothing is rebuilt and no change is reported |
| to an unknown value | the select shows gfm again and no mode change is reported |
| to strict | the change is applied and reported once |
boundaryThe setting defaultPaletteMode
Giventhe setting markdownOkfSchemaStudio.editing.defaultPaletteMode
Whenthe editing configuration is read
ThendefaultPaletteMode is the value of the table (the start of a page follows SwRS-MDOKFSTUDIO-LIFE-170)
| Setting | defaultPaletteMode |
|---|---|
| strict, gfm, myst or full (myst for example) | the value |
| not set | gfm |
| the text html or a number | gfm |
nominalThe cell formatting group follows the mode
Givenan open table cell editor (the group is specified in SwRS-MDOKFSTUDIO-TABLE-085)
Whenthe cell formatting group is inspected
Thenthe group holds no mode select, and its buttons are those of the table
| Mode | Cell formatting group |
|---|---|
| gfm | Bold, Italic, Strikethrough, Colour, Colour code, Link, Emoji and Key, and no Subscript or Superscript |
| myst | also Subscript, Superscript and Key (MyST) |
refusalA mode that does not list an insertion command offers none
Giventhe palette or the slash menu in a mode below the one that lists a command
Whenthe palette is shown or the slash is typed
Thenthe command is not offered, as the table says; the constructs of the document are rendered all the same (the insertion itself is SwRS-MDOKFSTUDIO-PALETTE-278)
| Command | Listed in | Not offered in |
|---|---|---|
| Vega-Lite chart and Vega chart (/chart, /vega) | full | strict, gfm, myst |
| PlantUML diagram (/plantuml, /uml) | full | strict, gfm, myst |
| Content tabs (/tab-set, /tabs) | myst and full | strict, gfm |
nominalThe mode setting and the stored choice
Giventhe select of the palette, the setting defaultPaletteMode or a stored choice
Whenthe mode is chosen
Thenthe table says what follows
| Input | Outcome |
|---|---|
| the select of the palette | offers Strict Markdown, GitHub (GFM), MyST and Full |
| the setting defaultPaletteMode or a stored choice full | the page starts in the Full mode |
| a message previewPaletteModeChanged with mode full | accepted and stored for the workspace |
Implemented in 5
Tested by 8
- test/core/configuration/editingConfiguration.test.tsunit
- test/core/palette/paletteActions.test.tsunit
- test/page/modules/editActions.test.tsunit
- test/page/modules/editPalette.test.tsunit
- test/page/modules/paletteReq.requirements.test.tsunit
- test/page/modules/slashSyntaxCoverage.test.tsunit
- test/page/runtimeEditPalette.test.tsunit
- test/page/runtimePaletteActions.test.tsunit
Replaces
SwRS-MDOKFSTUDIO-PALETTE-265The Full palette mode adds Vega-Lite and Vega chart commands superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-001, SwRS-MDOKFSTUDIO-PALETTE-278 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-273The MyST palette mode adds a Content tabs command superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-001, SwRS-MDOKFSTUDIO-PALETTE-278 Markdown file
SwRS-MDOKFSTUDIO-PALETTE-274The Full palette mode adds a PlantUML diagram command superseded superseded by SwRS-MDOKFSTUDIO-PALETTE-001, SwRS-MDOKFSTUDIO-PALETTE-278 Markdown file