mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
📎 Keep a switched copy text's override of a typography it lacks
When a switch carries a copy text's typography override, the model dropped it unless every other typographic style carried with it, since a typography reference cannot describe styles split between the copy and its main. That holds for a typography the copy applied. A copy text that lacks its main's typography and overrides only its size has no reference to split: production keeps the typography override, the same state a sync leaves, and the model now keeps it too. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
a64c20465f
commit
56830abbd9
@ -663,9 +663,12 @@
|
||||
(not (contains? text-differences unit)))
|
||||
unit)))
|
||||
text-groups)
|
||||
mixed-typography? (some #(not= (contains? carried-text-units :typography)
|
||||
(contains? carried-text-units %))
|
||||
[:family :weight :size :line-height :spacing :case])]
|
||||
;; a typography the copy applied carries only with all its styles
|
||||
mixed-typography? (and (some #(or (:typography-ref-id %) (:typography-ref-file %))
|
||||
(tree-seq map? :children (:content old)))
|
||||
(some #(not= (contains? carried-text-units :typography)
|
||||
(contains? carried-text-units %))
|
||||
[:family :weight :size :line-height :spacing :case]))]
|
||||
(reduce-kv
|
||||
(fn [result group _]
|
||||
(if-let [unit (get text-groups group)]
|
||||
|
||||
@ -1700,6 +1700,14 @@
|
||||
:ops [[:add-variant 0] [:switch 0] [:add-variant 0 0 0 0] [:delete 2 0 0 0]
|
||||
[:add-variant 0 0 0 0]]}))))
|
||||
|
||||
(t/deftest switching-a-copy-text-without-the-mains-typography-keeps-that-override
|
||||
(t/is (map? (cg/run {:world [3 2 {:variants true :text-styles true :layout nil :variant-diff false
|
||||
:layout-item-margins false :grid-square false :rich-variants true
|
||||
:layout-children false :grid-empty false :layout-copies true :text true}]
|
||||
:ops [[:add-variant 0] [:switch 5] [:delete 25 0 0 0] [:text-style 12 8 1]
|
||||
[:text 26 3 0 0] [:add-variant 2] [:switch 0] [:variant-property 0 0 0 0]
|
||||
[:switch 20]]}))))
|
||||
|
||||
(t/deftest random-variant-compositions
|
||||
(let [coverage (atom {})
|
||||
failure (atom nil)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user