Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-PALETTE-109

The Image button inserts or replaces an image reference

When the writer presses Image, the extension SHALL ask the host for a native image file dialog, keep the editor open while the dialog is shown, and insert or replace an image reference only when a valid path comes back.

Step 1 of path 1 in StRS-MDOKFSTUDIO-PALETTE-007: from “The palette is shown above the text box” to “The image dialog is open”.

Scenarios 5

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

nominalPicked file
Givenan open block editor and the path pics/cat.png
Whenthe writer presses Image and the host answers the path
Thenthe text is ![cat](pics/cat.png) with cat selected, and the editor stayed open while the dialog had the focus
nominalImage under the caret
InputOutcome
The caret in ![old](a.png "T") and b.png is pickedThe text is ![old](b.png "T") with old selected; the whole image reference is replaced
The caret in ![](a.png) and b.png is pickedThe alternative text is the new file name
boundaryName and path forms
InputOutcome
The path pics/cat.pngThe path is written without angle brackets
The path my pics/a (1).pngThe alternative text is a (1) and the path my pics/a (1).png is wrapped in angle brackets
A path with a blank, an opening parenthesis or a closing parenthesisThe path is written inside angle brackets
A path whose stem is empty after removing bracketsThe alternative text is image
refusalDialog without a path
Giventhe dialog is cancelled, fails, or the answer is stale
Whenthe host answers
Thennothing is inserted and a refusal reason is shown in the status line; a cancel focuses the text box
refusalPath refused
InputOutcome
The Image action without a path, or an empty pathNo edit is produced
A path with a line breakNo edit is produced
A path with a > character, or an angle bracketNo edit is produced; the Figure action shares the check

Implemented in 2

Tested by 3