oficina / docs Public

Docs toolbar: the paragraph style list previews each style

Paul, after Google Docs. Each style option carries data-rst-class
(docs-style-<value>), which ui/select.js puts on its row; the rows take
the document's heading ratios (1.6, 1.3, 1.1 on a 14px body) and bold,
in the chrome's always-loaded face so opening the list cannot flash a
fallback. Scoped to the open list: the closed field also wears the
class and stays at the bar's size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev f97f7c8b13a33828496455419f6d725c9c87e5b6 parent 130eeeb
1 file changed, +13 −1
  • internal/docs/views/show.html +13 −1

CI passed — run details

diff --git a/internal/docs/views/show.html b/internal/docs/views/show.html
index 15d8773..6954207 100644
--- a/internal/docs/views/show.html
+++ b/internal/docs/views/show.html
@@ -1198,6 +1198,18 @@
}
}
}
+ /* The paragraph styles' list shows each style as it looks (Paul, after
+ Google Docs): ui/select.js copies an option's data-rst-class onto
+ its row, so Heading 1 is drawn large and bold, down to Body text.
+ In the chrome's face, which is always loaded, rather than the
+ document's, so opening the list can never flash a fallback; the
+ sizes keep the document's own ratios (show.html's h1 1.6em, h2
+ 1.3em, h3 1.1em) on a 14px body. */
+ [docs-toolbar] [rst-combo-list] .docs-style-paragraph { font-size: 14px; }
+ [docs-toolbar] [rst-combo-list] .docs-style-heading-1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
+ [docs-toolbar] [rst-combo-list] .docs-style-heading-2 { font-size: 18px; font-weight: 700; }
+ [docs-toolbar] [rst-combo-list] .docs-style-heading-3 { font-size: 15.5px; font-weight: 700; }
+ [docs-toolbar] [rst-combo-list] [class*="docs-style-heading"] { line-height: 1.25; padding-block: 6px; }
/* Disabled is mirrored onto the input by fixtures/toolbar.mjs —
select.js does not do it — and has to LOOK disabled too, or the
control reads as usable while refusing to be used. Same token the
@@ -1485,7 +1497,7 @@
<div docs-toolbar-group>
<select docs-tool-select rst-input id="docs-select-block" tabindex="-1" disabled data-docs-select="block" aria-label="{{.Toolbar.BlockLabel}}"
data-rst-select data-rst-select-filter="{{.Toolbar.SelectFilter}}" data-rst-select-results="{{.Toolbar.SelectResults}}" data-rst-select-result-one="{{.Toolbar.SelectResultOne}}">
- {{range .Toolbar.Blocks}}<option value="{{.Value}}">{{.Label}}</option>{{end}}
+ {{range .Toolbar.Blocks}}<option value="{{.Value}}" data-rst-class="docs-style-{{.Value}}">{{.Label}}</option>{{end}}
</select>
<select docs-tool-select rst-input id="docs-select-font" tabindex="-1" disabled data-docs-select="font" aria-label="{{.Toolbar.FontLabel}}"
data-rst-select data-rst-select-filter="{{.Toolbar.SelectFilter}}" data-rst-select-results="{{.Toolbar.SelectResults}}" data-rst-select-result-one="{{.Toolbar.SelectResultOne}}">