Show proper display names in the annotation Type dropdown
Template tests / tests (push) Successful in 1m39s
Template tests / tests (pull_request) Successful in 1m39s

The annotation editor's "Type" select used the raw lowercase type id
(e.g. "rect") as its label. Add an ANNOTATION_TYPE_LABELS map so it
shows "Rectangle", "Tooltip", "Number", etc. instead.
This commit is contained in:
2026-06-15 09:43:09 -05:00
parent a3425c36b4
commit 6408040623
+16 -1
View File
@@ -24,6 +24,21 @@ const ANNOTATION_FIELDS = {
cursor: [], cursor: [],
}; };
// Display names for annotation types in the "Type" dropdown.
const ANNOTATION_TYPE_LABELS = {
rect: 'Rectangle',
oval: 'Oval',
line: 'Line',
arrow: 'Arrow',
text: 'Text',
tooltip: 'Tooltip',
number: 'Number',
blur: 'Blur',
highlight: 'Highlight',
magnify: 'Magnify',
cursor: 'Cursor',
};
function blockText(block) { function blockText(block) {
for (const key of ['code', 'text', 'body', 'value', 'content']) { for (const key of ['code', 'text', 'body', 'value', 'content']) {
const value = block && block[key]; const value = block && block[key];
@@ -962,7 +977,7 @@ class GuideEditor {
const style = selected.style || {}; const style = selected.style || {};
const typeSelect = makeSelect(selected.type, [ const typeSelect = makeSelect(selected.type, [
'rect', 'oval', 'line', 'arrow', 'text', 'tooltip', 'number', 'blur', 'highlight', 'magnify', 'cursor', 'rect', 'oval', 'line', 'arrow', 'text', 'tooltip', 'number', 'blur', 'highlight', 'magnify', 'cursor',
].map((type) => ({ value: type, label: type }))); ].map((type) => ({ value: type, label: ANNOTATION_TYPE_LABELS[type] || type })));
const textInput = el('input', { type: 'text', value: selected.text || '', placeholder: 'Annotation text' }); const textInput = el('input', { type: 'text', value: selected.text || '', placeholder: 'Annotation text' });
const valueInput = el('input', { type: 'number', value: Number.isFinite(selected.value) ? selected.value : '', placeholder: 'Value' }); const valueInput = el('input', { type: 'number', value: Number.isFinite(selected.value) ? selected.value : '', placeholder: 'Value' });
const strokeInput = el('input', { type: 'color', value: style.stroke || '#E5484D' }); const strokeInput = el('input', { type: 'color', value: style.stroke || '#E5484D' });