mirror of
https://github.com/penpot/penpot.git
synced 2026-07-22 00:31:32 +02:00
5103969de0
A text shape whose `:content` is `{:type "root" :vertical-align "top"
:children []}` (root with empty :children) passes the frontend editor but
fails the backend `validate-shape` schema. When `process-operations` calls
`validate-shape` on every `mod-obj`, a single broken text shape anywhere in
the file can roll back an entire `update-file` batch — including unrelated
geometry edits to other shapes on other pages.
Six changes (A–F) address the issue:
A. Frontend root cause – `update-root-attrs` now seeds new text content with
the canonical root/paragraph-set/paragraph/span tree instead of a bare
`{:type "root"}`.
B. Frontend defensive – `ensure-valid-text-content` normalizes any root with
empty/missing :children at the entry of `v2-update-text-shape-content`.
C. Frontend optimization – with a well-formed baseline, the new-shape path
no longer churns redundant `:content` set operations.
D. Common schema – `:children` is no longer optional or `[:maybe ...]`; a root
must contain at least one paragraph-set.
E. Common migration – `0025-repair-empty-text-content` repairs existing files
with broken content in pages and components.
F. Common validation – `process-operations` skips `validate-shape` for
geometry-only mod-objs, so a broken shape cannot sabotage unrelated edits.
Fixes #10725
AI-assisted-by: opencode-go/minimax-m3