Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-LIFE-108

Scrolling or clicking the preview reveals the source line

When the reader scrolls the preview to another source line or activates a rendered block outside edit mode, the extension SHALL reveal that source line in the visible text editor that shows the preview's file, as the settings allow, and leave every editor unmoved when no visible text editor shows that file or the report names another file.

Step 2 of path 1 in StRS-MDOKFSTUDIO-LIFE-010: from “The preview shows the line of the editor” to “Both panes show the same source line”.

Scenarios 10

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

nominalScrolling posts the new top line
Givenanchor mode and scrollEditorWithPreview on and the reader scrolling from line 10 to line 14.6
a scroll that leaves the rounded line at 14
Whenthe scroll frame runs
the next frame runs
Thenthe page posts previewScroll with line 14
no second previewScroll is posted; with the anchor mode off the page posts only previewState
nominalThe host reveals the line at the top of the editor
Givena preview and a text editor of the same file, scrollPreviewWithEditor and scrollEditorWithPreview on
scrollEditorWithPreview off
Whenthe host receives previewScroll with line 14
the message arrives
Thenthe editor shows line 14 at its top and its caret does not move
the editor is not moved
nominalClicking a block reveals its source line
InputOutcome
a click on a paragraph that starts at source line 2, in reading mode, scrollEditorWithPreview on, the text editor scrolled elsewherethe page posts previewReveal with activation click and the block's source line (line 50 in the unit test); the editor reveals line 2, centred when it was outside the viewport
a click on a link, a checkbox, a comment chip or an insertion controlno source line is revealed
a click while scrollEditorWithPreview is offno source line is revealed
nominalEnter or Space on a focused block
InputOutcome
Enter on a focused paragraph in reading modethe page posts previewReveal with activation keyboard and the host reveals the line
Space on a focused rendered block outside edit modethe page posts previewReveal with activation keyboard for that block's source line
Enter with the focus in a button, an input, a link or the Description toggleno reveal is posted
boundaryA text diff shows the file
InputOutcome
a diff whose original side is a git or virtual document at the path of the file and whose modified side is the filethe line is revealed in the modified side only
a diff with no side of the file schemeno editor moves
refusalNo text editor shows the file
Givena preview with no visible text editor of its file
a text editor of another file
Whenthe reader scrolls or clicks in the preview
the reader scrolls the preview
Thenno editor is created and the document is unchanged
that editor does not move
refusalA report that names another source file
InputOutcome
previewReveal whose sourceFile is another paththe editor is not moved
previewScroll that carries a line and no source filethe line is revealed in the editor of the preview's file
previewScroll or previewReveal naming a stale or foreign renderrefused before this rule runs, see SwRS-MDOKFSTUDIO-TRUST-065
boundaryThe revealed line stays inside the document
InputOutcome
a document of 50 lines and a reveal of line 400line 50 is revealed
a reveal request below line 1line 1 is revealed
boundaryAccepted shape of previewScroll and previewReveal
InputOutcome
line, endLine, sourceLine or selectionLine a safe integer of at least 1accepted
anchorLine a finite number of at least 1 and scrollTop a finite number of at least 0accepted
activation click or keyboard, and a sourceFile stringaccepted; the validator does not check them, the host compares the sourceFile path with the active document
line 0, line 1.5, anchorLine below 1 or a negative scrollTopmalformed: dropped by the envelope check without a visible change, the editor is not moved (see SwRS-MDOKFSTUDIO-TRUST-052)
a well-formed previewScroll while scrollPreviewWithEditor is offthe reading state is recorded, the editor is not moved
boundaryDefaults, the setting off and the double click
InputOutcome
No stored value for markdownOkfSchemaStudio.preview.scrollEditorWithPreview, preview settings readThe setting is true (on by default)
scrollEditorWithPreview set to false and the reader scrolls or clicks in the previewThe editor does not move
The reader double-clicks rendered content outside edit modeThe page posts nothing beyond the reveals of its two clicks; there is no double-click setting (a doubleClickToSwitchToEditor value left in the user settings is not a setting of the extension and has no effect)

Implemented in 3

Tested by 7

Replaces

SwRS-MDOKFSTUDIO-LIFE-097Two settings decide how the panes follow each other superseded superseded by SwRS-MDOKFSTUDIO-LIFE-100, SwRS-MDOKFSTUDIO-LIFE-108 Markdown file