From 5e6af5aea9f16a8b703f8ade5a378ef3bf20553b Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 17 Oct 2025 14:13:21 +0200 Subject: [PATCH] :bug: Fix text override is lost after switch --- CHANGES.md | 1 + common/src/app/common/types/text.cljc | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8a6109586d..92365f5678 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -62,6 +62,7 @@ - Fix drag & drop functionality is swapping instead or reordering [Taiga #12254](https://tree.taiga.io/project/penpot/issue/12254) - Fix variants not syncronizing tokens on switch [Taiga #12290](https://tree.taiga.io/project/penpot/issue/12290) - Fix incorrect behavior of Alt + Drag for variants [Taiga #12309](https://tree.taiga.io/project/penpot/issue/12309) +- Fix text override is lost after switch [Taiga #12269](https://tree.taiga.io/project/penpot/issue/12269) ## 2.10.1 diff --git a/common/src/app/common/types/text.cljc b/common/src/app/common/types/text.cljc index 651aee21fc..8f62324959 100644 --- a/common/src/app/common/types/text.cljc +++ b/common/src/app/common/types/text.cljc @@ -249,12 +249,16 @@ (defn equal-attrs? "Given a text structure, and a map of attrs, check that all the internal attrs in paragraphs and sentences have the same attrs" - [item attrs] - (let [item-attrs (dissoc item :text :type :key :children)] - (and - (or (empty? item-attrs) - (= attrs (dissoc item :text :type :key :children))) - (every? #(equal-attrs? % attrs) (:children item))))) + ([item attrs] + ;; Ignore the root attrs of the content. We only want to check paragraphs and sentences + (equal-attrs? item attrs true)) + ([item attrs ignore?] + (let [item-attrs (dissoc item :text :type :key :children)] + (and + (or ignore? + (empty? item-attrs) + (= attrs (dissoc item :text :type :key :children))) + (every? #(equal-attrs? % attrs false) (:children item)))))) (defn get-first-paragraph-text-attrs "Given a content text structure, extract it's first paragraph