Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-MYST-038

The anchor icon opens a rename field that sends valid names

When a reader clicks the anchor icon of a label in edit mode, the extension SHALL open a Rename label popover with a prefilled, selected, focused Label name field before block click handling, send a rename only for a changed valid name and show the answer of the host in the field, placed so that it does not cover the block its label introduces.

Step 1 of path 2 in StRS-MDOKFSTUDIO-MYST-009: from “The label shows an anchor icon” to “The Rename label popover is open”.

Scenarios 10

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

nominalThe click opens the rename field
Givenedit mode on and the label `(draft_1)=` before a paragraph, which shows an anchor icon with a pointer cursor
Whenthe anchor icon is clicked
Thena dialog Rename label opens under it with the Label name field prefilled with `draft_1`, selected and focused, and no block editor opens
boundaryA label above a table opens the field above its icon
InputOutcome
Anchor icon of a label held by no paragraph or heading (`(table-label)=` right before a table, also a code block, a figure or a directive) clicked in edit mode, with room above the iconThe field opens above the icon: its bottom edge is 6 px above the icon's top edge, its left edge as for any label; it covers no cell of the table
The same click with too little room above (less than the field's height between the icon and the top obstruction: the bottom of the preview toolbar when it overlaps the field's horizontal span, else 8 px from the top of the pane) and a page that can scroll up by the missing heightThe page scrolls up by the missing height, then the field opens above the icon
The same click at the very top of the document, where the page cannot scroll up by the missing heightThe field opens under the icon, as for a label before a paragraph, and covers the first rows of the table until Escape or a press elsewhere
Renaming..., Renamed. or a refusal shown in the fieldThe field grows upwards, away from the table

The field is anchored by its bottom edge when it opens above. A label held by a paragraph or a heading keeps the placement under its icon. The field never exceeds the width of the pane (its padding and border included).

refusalClicks that open no field
InputOutcome
Anchor icon clicked with edit mode offNothing opens and the icon stays a link target
nominalEnter sends the rename or closes
Input (Enter pressed in the field)Outcome
A changed valid nameOne rename with the label line is posted
The name left unchangedThe field closes and nothing is posted
refusalInvalid names are not sent
Input (Enter pressed in the field)Outcome
`bad name` (a space)The message is shown and nothing is posted
An empty nameThe same message is shown and nothing is posted
A 101-character nameThe same message is shown and nothing is posted
A name with characters other than letters, digits and `_ . : -`The same message is shown and nothing is posted

The message reads: Use letters, digits and _ . : - only (100 characters at most). The host and the message validator repeat the check.

nominalLabels starting with a symbol
InputOutcome
Anchor icon of the label `(_draft)=`, `(.hidden)=` or `(-dash)=` clicked in edit modeThe rename field opens prefilled and selected, like for any other label, and no block editor opens
`-new` typed for `_draft` and Enter pressedOne rename is posted

The anchor icon, the field and the host share one name pattern: letters, digits and `_ . : -`, 100 characters at most. Every label that shows an icon can be renamed.

refusalA rename from a stale render
InputOutcome
A rename sent from an older renderThe host answers ok false with The label is no longer on that line. Refresh the preview.; the field shows it and is editable again
boundaryEscape or an outside press closes the field
Input (field open)Outcome
EscapeThe field closes and nothing is sent
Pointer press outside the popover and the iconThe field closes and nothing is sent
Pointer press on a table cell while the field is openThe field closes, nothing is sent and the cell editor opens in the same click
nominalA successful rename reports the remaining uses
Input (rename succeeds)Outcome
Two `{ref}` uses of the old nameThe field shows Renamed. 2 uses of "old" remain in this document.
No `{ref}` use, or `{doc}` and `{numref}` uses onlyThe field shows Renamed. No use of the old name remains.

Only `{ref}` forms are counted. The field closes itself 5 s after the success message; a new rename or Escape within the 5 s makes the field follow the new action and no stale close occurs.

boundaryProgress, refusal and silence of the host
InputOutcome
A posted rename the host has not answeredThe field is disabled and reads Renaming...
An answer with another edit idThe answer is ignored
A refusal with a reasonThe reason is shown and the field is editable again
No host answer within 6 sThe field is editable again with The editor did not answer. Try again.
An answer arriving before 6 sThe answer is matched by edit id, the timer is cleared and no timeout message is shown

Implemented in 2

Tested by 9

Replaces

SwRS-MDOKFSTUDIO-MYST-039Enter sends the label rename and an unchanged name sends nothing superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-040Escape or an outside press closes the rename field superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-041Invalid label names are not sent superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-047A successful rename reports the remaining uses superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-048The rename field shows progress and refusals superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-049The rename field times out after 6 seconds superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-090The rename field closes itself after 5 seconds superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file
SwRS-MDOKFSTUDIO-MYST-094A label starting with underscore, dot or hyphen cannot be renamed superseded superseded by SwRS-MDOKFSTUDIO-MYST-038 Markdown file