Autosave box HTML, fix editor selection, make /shrines a canvas page
The HTML editor's selection was invisible: CodeMirror's focused-selection rule outranked ours and painted #233, and the opaque active line covered the selection layer. Match its selector and make the active line translucent. Unsaved HTML now saves on leaving a box (selecting another, clicking empty canvas, Done, closing the panel) instead of asking to discard. /shrines is no longer a hard-coded route but an ordinary canvas page, with links placed by hand as Link boxes; the backend no longer reserves the slug. The Shrine starter layout is gone, and the admin Pages tab gains a "New shrine" form that makes a blank page under shrines/. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -25,7 +25,8 @@ const maxSlugLen = 100
|
||||
// nginx or one of the SPA's own routes answers them first (see
|
||||
// nginx/nginx_routes.conf.template and vue/src/router/index.js), plus the
|
||||
// built-in canvases' page keys, whose boxes a page of the same slug would
|
||||
// share. "shrines" is deliberately absent: shrine pages live under it.
|
||||
// share. "shrines" is deliberately absent: /shrines and the shrine pages under
|
||||
// it are all canvas pages.
|
||||
var reservedFirstSegments = map[string]bool{
|
||||
"stp": true, "stp2": true, "index": true, "admin": true, "cv": true,
|
||||
"automata": true, "hotels": true, "api": true, "py": true, "radio": true,
|
||||
@@ -34,11 +35,6 @@ var reservedFirstSegments = map[string]bool{
|
||||
"sound": true, "assets": true, "internal": true,
|
||||
}
|
||||
|
||||
// reservedSlugs are individual paths the SPA routes itself.
|
||||
var reservedSlugs = map[string]bool{
|
||||
"shrines": true,
|
||||
}
|
||||
|
||||
func validPageKey(key string) bool {
|
||||
return len(key) <= maxSlugLen && pageKeyPattern.MatchString(key)
|
||||
}
|
||||
@@ -49,7 +45,7 @@ func validateSlug(slug string) error {
|
||||
return errors.New("a page address is lower-case letters, digits and hyphens, in /-separated parts, e.g. shrines/evangelion")
|
||||
}
|
||||
first, _, _ := strings.Cut(slug, "/")
|
||||
if reservedFirstSegments[first] || reservedSlugs[slug] {
|
||||
if reservedFirstSegments[first] {
|
||||
return errors.New("that address is already used by the site")
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user