Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-LIFE-170

A new page starts each view choice from the panel, stored or default value

When a page opens, the extension SHALL start each view choice from the saved panel state, else the stored workspace value, else the default of that choice, except the theme mode, which starts from the stored workspace value before the saved panel state.

Step 2 of path 2 in StRS-MDOKFSTUDIO-LIFE-014: from “The view choice is stored” to “The page opens with the view choice”.

Step 1 of path 2 in StRS-MDOKFSTUDIO-BLOCK-001: from “A document is opened in a new preview” to “The preview opens in the edit mode last chosen”.

Scenarios 7

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

nominalOrder of sources for each view choice

The panel state is the state the webview saved with the panel (restored panel or rebuilt page). The stored value is the choice kept for the workspace (see SwRS-MDOKFSTUDIO-LIFE-169). A value of the wrong type or outside the accepted set is skipped and the next source is used.

View choicePanel state (first)Stored value (second)Default (last)Accepted values and normalisation
Edit modesaved editMode true, of the same documentnone: the stored edit mode is not applied at start (see SwRS-MDOKFSTUDIO-LIFE-172)off (preview mode)a saved value that is not true, or saved by another document, gives off
Palette modesaved paletteModethe host gives the valid mode stored for the workspace, else the value of the setting markdownOkfSchemaStudio.editing.defaultPaletteModegfmonly strict, gfm, myst and full
Width modesaved viewWidthModestored widthModemarginonly margin, auto and full
Zoomsaved viewZoomstored zoom100rounded to a multiple of 10 and clamped to 70 to 200; a value that is not a finite number is ignored
Toolbar rows 2 to 4saved viewToolbarCollapsed, a booleanstored toolbarCollapsedcollapsedonly the stored value false expands, so a missing value gives collapsed
Contents columnsaved viewToc, a booleanstored toc, open only when truecloseda saved non-boolean is ignored
Comments buttonsaved viewComments, a booleanstored comments, hidden only when falseshowna saved non-boolean is ignored
Anchor modesaved anchorToEditor, a booleanno stored value: the setting markdownOkfSchemaStudio.preview.scrollPreviewWithEditorthe setting valuea saved non-boolean is ignored
Theme mode (exception)saved previewThemeMode (second)stored previewThemeMode (first)creamonly current, dark, white and cream
nominalThe saved panel state wins
InputOutcome
Saved edit mode true of the same documentedit mode is on
Saved edit mode false, or no saved stateedit mode is off
Saved paletteMode myst and host initial mode strictthe palette mode is myst
Saved width mode full and stored width mode autothe width mode is full
Saved viewZoom 120 and initial preference 150the zoom is 120
Saved toolbar state collapsed and stored choice expandedthe toolbar is collapsed
Workspace preference toc open and saved state closedthe column is closed; with no saved state it would be open
Saved viewComments falsethe gray chips are hidden and the Comments button is not pressed
Saved anchor mode off and setting onthe anchor mode is off
nominalThe stored value or the setting applies without a saved state
InputOutcome
Preview in a trusted workspace whose stored edit mode is truethe page still starts in preview mode
Stored palette mode myst and setting strictthe initial mode in the page context is myst
Initial zoom preference 150, no saved statethe zoom is 150
Stored zoom 130 accepted from a preview (validation and storage: SwRS-MDOKFSTUDIO-LIFE-169), next page of the workspace builtits initial view preferences carry the zoom 130 and, without saved state, it starts at 130
Preview at 130 %, window reloaded, or preview closed and reopenedthe zoom is still 130
Stored toolbar choice expanded, no saved statethe toolbar is expanded
No webview state and the comments preference falsethe gray chips are hidden
No saved anchor mode and setting offthe anchor mode is off; with the setting on it is on
Workspace that stored current, dark, white or cream in turnthe html attribute data-sphinx-preview-theme-mode equals the stored mode in each case, and current is kept as a choice, not replaced by Cream
Restored panel whose saved state holds white and a workspace without a stored modethe theme mode is white
Restored panel whose saved state holds white and a workspace that stored darkthe theme mode is dark: the stored workspace mode wins over the saved state
nominalA fresh workspace opens on the defaults
Givena fresh workspace that stored no choice, a page with no saved state and no setting changed
Whenthe preview page starts and nothing is clicked
Thenthe page is in reading mode, the palette mode is gfm, the width mode is margin, the zoom is 100, the toolbar is collapsed (data-sphinx-preview-toolbar-state is collapsed, the group is hidden), the contents column is closed, the comments are shown, and the theme mode is cream

The Cream start is the same on a light and on a dark host theme:

InputOutcome
Fresh workspace, light VS Code theme, 900 px pane (visual scenario theme-zoom/v12)the html attribute data-sphinx-preview-theme-mode is cream, the Theme button label is "Preview theme: Cream theme", its tooltip is "Cream theme (click for current theme)", the body background is rgb(245, 241, 232) and the text colour is rgb(43, 42, 39)
Fresh workspace, dark VS Code theme, 460 px pane (visual scenario theme-zoom/v13)the page is the same light cream paper; the host theme is not visible
refusalAn invalid value is ignored and the next source is used
InputOutcome
Stored edit mode false, absent or not a booleanthe page starts in preview mode
Preview with restricted reads whose stored edit mode is truethe page starts in preview mode
Invalid stored width mode and no saved statethe invalid value is ignored and the width mode is margin
Stored palette mode that is not a mode and setting strictthe initial mode is strict
No saved state and no host initial palette modethe palette mode is gfm
Workspace storage holding the text sepia under the theme mode keyno stored mode is returned, the boot context of the next page carries none, and the page shows Cream
Workspace storage holding whitewhite is returned as the stored theme mode
Saved zoom of the text big and initial zoom 150the saved value is ignored and the zoom is 150
Boot context whose toolbarCollapsed is missingthe toolbar is collapsed, because only the value false expands it
boundaryZoom is rounded to the grid and clamped
InputOutcome
Page: saved zoom 133, then 300, then 10the zoom is 130, 200 and 70
Host: stored zoom values 10, 69, 104, 105, 133 and 300the workspace preferences give 70, 70, 100, 110, 130 and 200
Host: stored zoom of the text big or NaN, or stored preferences that are not an objectthe zoom is 100
Neither saved state nor initial preferencethe zoom is 100
boundaryStarting on a default posts nothing, and a saved anchor mode that differs is posted once
InputOutcome
Fresh workspace, preview page starts and the runtime is installedthe page posts no previewThemeModeChanged message and no previewViewPreferenceChanged message, and the toolbar start posts no preference or theme message
The same page, Theme button clicked onceexactly one previewThemeModeChanged message is posted, carrying the new mode
Saved anchor mode off and setting onone previewAnchorModeChanged message with anchorToEditor false is posted without a press
Saved anchor mode equal to the settingnothing is posted

Implemented in 13

Tested by 14

Replaces

SwRS-MDOKFSTUDIO-LAYOUT-038The saved width mode is restored when the page starts superseded superseded by SwRS-MDOKFSTUDIO-LIFE-170 Markdown file