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  with cat selected, and the editor stayed open while the dialog had the focus
nominalImage under the caret
| Input | Outcome |
|---|---|
| The caret in  and b.png is picked | The text is  with old selected; the whole image reference is replaced |
| The caret in  and b.png is picked | The alternative text is the new file name |
boundaryName and path forms
| Input | Outcome |
|---|---|
| The path pics/cat.png | The path is written without angle brackets |
| The path my pics/a (1).png | The 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 parenthesis | The path is written inside angle brackets |
| A path whose stem is empty after removing brackets | The 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
| Input | Outcome |
|---|---|
| The Image action without a path, or an empty path | No edit is produced |
| A path with a line break | No edit is produced |
| A path with a > character, or an angle bracket | No edit is produced; the Figure action shares the check |