oficina / slides Public

Editor: corner radius in Style, so a shape has no Image group (R16)

Ruling R16 departs from the spec table and the brief: corner radius
(rst-block-radius, still data-types="image shape") is a Style field for
images and shapes alike. A selected shape now shows no Image group, and
an image's Image group holds its file and fit.

TestEditorTidyNothingIsLost expects radius under Style.
TestTidyCardFollowsSelection checks both kinds' groups in the browser.
TestTidyMarksInCard now covers the link's pressed state in a box, and
the link in the notes, by the card's button and by Mod+K.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3554d05ee2441e21472a4d4823c75694fec988b0 parent 039cf83
3 files changed, +77 −5
  • internal/slides/templates/editor.html +4 −4
  • internal/slidestest/browser_editor_tidy_test.go +71 −0
  • internal/slidestest/editor_tidy_test.go +2 −1
diff --git a/internal/slides/templates/editor.html b/internal/slides/templates/editor.html
index 9c21b58..e09b6e7 100644
--- a/internal/slides/templates/editor.html
+++ b/internal/slides/templates/editor.html
@@ -661,6 +661,10 @@
<label rst-field-label for="rst-block-cite">{{.L "block.cite"}}</label>
<input rst-input id="rst-block-cite" name="rst-block-cite" type="text" data-prop="cite">
</div>
+ <div rst-field data-types="image shape">
+ <label rst-field-label for="rst-block-radius">{{.L "block.radius"}}</label>
+ <input rst-input="short" id="rst-block-radius" name="rst-block-radius" type="number" min="0" max="50" step="1" data-prop="radius" data-kind="int">
+ </div>
</div>
{{/* The text marks the schema has (§2.6: b, i, c, h, href), as a
segmented row of toggles: each runs the same ProseMirror command
@@ -713,10 +717,6 @@
<label estilo-seg-item><input type="radio" name="rst-block-fit" value="contain" data-prop="fit">{{.L "fit.contain"}}</label>
</div>
</fieldset>
- <div rst-field data-types="image shape">
- <label rst-field-label for="rst-block-radius">{{.L "block.radius"}}</label>
- <input rst-input="short" id="rst-block-radius" name="rst-block-radius" type="number" min="0" max="50" step="1" data-prop="radius" data-kind="int">
- </div>
</div>
<div estilo-inspector-group role="group" aria-labelledby="slides-g-description" data-group="description">
<span estilo-inspector-label id="slides-g-description">{{.L "group.description"}}</span>
diff --git a/internal/slidestest/browser_editor_tidy_test.go b/internal/slidestest/browser_editor_tidy_test.go
index ee9c428..dc9fbc7 100644
--- a/internal/slidestest/browser_editor_tidy_test.go
+++ b/internal/slidestest/browser_editor_tidy_test.go
@@ -1289,6 +1289,39 @@ func TestTidyCardFollowsSelection(t *testing.T) {
}
}
+ // Corner radius is Style's, for an image and a shape alike (ruling
+ // R16): a shape shows no Image group; an image's Image group holds
+ // its file and fit.
+ groupsJS := `(() => {
+ const out = {}
+ for (const g of document.querySelectorAll('[slides-inspector] form[data-section="block"] [data-group]')) {
+ if (!g.checkVisibility()) continue
+ out[g.querySelector('[estilo-inspector-label]').textContent] = [...g.querySelectorAll('[name]')].filter(el => el.checkVisibility()).map(el => el.name)
+ }
+ return out
+ })()`
+ for _, c := range []struct {
+ kind string
+ image []string // nil: no Image group drawn
+ }{
+ {"shape", nil},
+ {"image", []string{"rst-block-image", "rst-block-fit", "rst-block-fit"}},
+ } {
+ te.selectBox(c.kind)
+ var groups map[string][]string
+ te.rig.Run(chromedp.Evaluate(groupsJS, &groups))
+ image, shown := groups["Image"]
+ if c.image == nil && shown {
+ t.Errorf("%s selected: an Image group is drawn, holding %v; want none", c.kind, image)
+ }
+ if c.image != nil && strings.Join(image, " ") != strings.Join(c.image, " ") {
+ t.Errorf("%s selected: the Image group holds %v, want %v", c.kind, image, c.image)
+ }
+ if !slicesHas(groups["Style"], "rst-block-radius") {
+ t.Errorf("%s selected: Corner radius is not drawn in Style; the groups are %v", c.kind, groups)
+ }
+ }
+
// Back to the same box from the notes: its options again, though
// the selection itself never changed.
te.selectBox("shape")
@@ -1631,6 +1664,7 @@ func TestTidyMarksInCard(t *testing.T) {
chromedp.KeyEvent(kb.Enter),
waitFor(`!document.querySelector('[slides-link-dialog]').open`),
waitFor(headingEl+`.querySelector('a[href="https://example.test/"]')`),
+ waitFor(pressed("href")),
)
// The shortcuts take each off again.
te.rig.Run(chromedp.Focus(`[slides-stage] [data-block="heading"] [contenteditable="true"], [slides-stage] [data-block="heading"][contenteditable="true"]`, chromedp.ByQuery), waitFor(inHeading), modKey("a", input.ModifierCtrl))
@@ -1646,6 +1680,7 @@ func TestTidyMarksInCard(t *testing.T) {
waitFor(`document.querySelector('[slides-link-dialog]').open`),
chromedp.Click(`[slides-link-dialog] button[value="remove"]`, chromedp.ByQuery),
waitFor(`!`+headingEl+`.querySelector('a')`),
+ waitFor(`!(`+pressed("href")+`)`),
)
// The code block: the marks act there as the pill's did.
@@ -1695,6 +1730,42 @@ func TestTidyMarksInCard(t *testing.T) {
waitFor(`!document.querySelector('[slides-notes]').querySelector('`+tags[m]+`')`),
)
}
+ // The link in the notes: put on with the card's button and taken off
+ // with Mod+K, then put on with Mod+K and taken off with the button.
+ const notesLink = `document.querySelector('[slides-notes] a[href="https://example.test/notes"]')`
+ link := func(open chromedp.Action, how string) {
+ t.Helper()
+ te.rig.Run(
+ open,
+ waitFor(`document.querySelector('[slides-link-dialog]').open`),
+ chromedp.SendKeys(`#slides-link-url`, "https://example.test/notes", chromedp.ByQuery),
+ chromedp.KeyEvent(kb.Enter),
+ waitFor(`!document.querySelector('[slides-link-dialog]').open`),
+ waitFor(notesLink),
+ waitFor(pressed("href")),
+ )
+ var in bool
+ te.rig.Run(chromedp.Evaluate(`!!`+inNotes, &in))
+ if !in {
+ t.Errorf("a link put on the notes with %s left the caret out of the notes", how)
+ }
+ }
+ unlink := func(open chromedp.Action) {
+ t.Helper()
+ te.rig.Run(
+ open,
+ waitFor(`document.querySelector('[slides-link-dialog]').open`),
+ chromedp.Click(`[slides-link-dialog] button[value="remove"]`, chromedp.ByQuery),
+ waitFor(`!document.querySelector('[slides-notes] a')`),
+ waitFor(`!(`+pressed("href")+`)`),
+ )
+ }
+ button := chromedp.Click(`[slides-inspector] [data-mark="href"]`, chromedp.ByQuery)
+ modK := modKey("k", input.ModifierCtrl)
+ link(button, "the card's button")
+ unlink(modK)
+ link(modK, "Mod+K")
+ unlink(button)
if s := te.marks(); s.Inspect != "notes" {
t.Errorf("after the marks in the notes the card is on %q, want notes", s.Inspect)
}
diff --git a/internal/slidestest/editor_tidy_test.go b/internal/slidestest/editor_tidy_test.go
index 39d40d1..dbce2d1 100644
--- a/internal/slidestest/editor_tidy_test.go
+++ b/internal/slidestest/editor_tidy_test.go
@@ -515,7 +515,8 @@ func TestEditorTidyNothingIsLost(t *testing.T) {
{"language", "style"}, {"kind", "style"}, {"fill", "style"}, {"stroke", "style"}, {"strokeWidth", "style"},
{"label", "style"}, {"rows", "style"}, {"cols", "style"}, {"header", "style"}, {"spacer-size", "style"},
{"align", "alignment"},
- {"image", "image"}, {"fit", "image"}, {"radius", "image"},
+ {"radius", "style"}, // R16: Style for images and shapes alike, not the spec table's Image
+ {"image", "image"}, {"fit", "image"},
{"alt", "description"}, {"decorative", "description"},
{"region", "place"}, {"x", "place"}, {"y", "place"}, {"w", "place"}, {"h", "place"},
{"phone-hidden", "phone"}, {"phone-order", "phone"}, {"phone-size", "phone"},