oficina / mapa Public

Columns (WIP): Insert's column entries follow Divider, so dates and images stay last

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 9fe7514e4eff3b0c49e2117ffdfb9570329c2859 parent bedb7ca
1 file changed, +7 −1
  • internal/mapa/menus.go +7 −1
diff --git a/internal/mapa/menus.go b/internal/mapa/menus.go
index 0a1591e..e964fee 100644
--- a/internal/mapa/menus.go
+++ b/internal/mapa/menus.go
@@ -2,6 +2,7 @@ package mapa
import (
"html/template"
+ "slices"
"amadan.net/oficina/mapa/internal/mapa/icons"
)
@@ -155,7 +156,12 @@ func insertMenu(picker bool) []menuEntry {
if picker {
items = append(items, command("Date…", "insert-date-pick", ""),
command("Image…", "insert-image", ""))
- items = append(items, columnEntries()...)
+ // The layouts go after Divider, the blocks' group; dates and
+ // images stay last.
+ at := slices.IndexFunc(items, func(entry menuEntry) bool {
+ return entry.Label == "Link to a page"
+ })
+ items = slices.Insert(items, at-1, columnEntries()...)
}
return items
}