feat(engine): 'insertable: false' element sidecar flag; apply to the html element #103
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/90"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A new optional boolean element sidecar flag, default true.
insertable: falseremoves an element from the web insert picker and makes the server refuse inserts of it (defense in depth), while already-placed instances remain fully visible, editable, movable, and rendering in preview/publish — unlikehidden: true, which also suppresses tree rows and blocks duplicates.Changes
internal/element):Schema.Insertable *bool(insertable,omitemptyon the wire; nil = absent = insertable, so the default-true flag stays distinguishable from an explicitfalse). Strict sidecar parse rejects non-boolean values withinsertable must be a boolean. Godoc updated.internal/server): the insert handler refusesinsertable: falseelements with 422 —element %q is not insertable: its sidecar sets insertable: false; already-placed instances remain editable. Duplicate and move are deliberately unaffected; tests pin that duplicating a placed instance still succeeds and that an absent flag still inserts.web/src):allowedElementsandemptyPickerReasonfilterinsertable !== false(the slot-cell picker goes throughallowedElementstoo, so both picker paths are covered). Tree rendering (isHiddenNode/flattenChildren) is untouched, pinned by inverse tests.editor/elements/html.yamlsetsinsertable: falseand drops its stale "picker-hiding flag will follow" comment;scaffold/site/AGENTS.mddocuments the flag next to the sidecar schema (per the CLAUDE.md same-change rule).Verification
go test ./...,go vet ./..., gofmt clean; web: vitest 795/795 across 40 files,npm run buildgreen.harness serve:/api/elementscarries"insertable":falseonly forhtml; POST insert ofhtml→ 422 with the message above; insert oftext→ 200; duplicate of a hand-placedhtmlinstance → 200 with a fresh uid; the Hugo preview renders the placed raw HTML verbatim; and in a real Chromium the Insert-element dialog omits Raw HTML while the placed instance stays a visible, editable tree row.Closes #90
Validation verdict: PASS.
Verification signal relied on: the green Forgejo Actions run
ci / build-and-test(success, 7m6s) — fullgo vet/go test ./.../go buildand the web vitest suite (incl. the picker-filter and server-refusal tests). Not re-run.Checked:
main(base includes the just-landed #102; no conflict).feat(engine): …); body carriesCloses #90onafk/90.Schema.Insertable *boolwithinsertable,omitemptydistinguishes absent / true / false on the wire;normalizeOptionalBoolrejects non-boolean values withinsertable must be a boolean.insertable: falseelement (defense in depth); duplicate and move handlers deliberately untouched, so placed instances stay editable and movable.allowedElementsandemptyPickerReasonboth filterinsertable !== false(the slot-cell picker routes throughallowedElements); tree rendering untouched, so placed instances stay visible.html.yamlsetsinsertable: falseand drops the stale "picker-hiding flag will follow" comment.scaffold/site/AGENTS.mddocuments the flag in the sidecar-schema section, godoc (doc.go) updated.No blockers. Awaiting a free-text merge go-ahead before merging.