From 41146ef71d425c9ce260d8fe2c0e0e6c97e5f22e Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 8 Jul 2025 14:24:47 +0200 Subject: [PATCH] :bug: Fix text overrides when there are structure changes --- common/src/app/common/logic/libraries.cljc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index b7264b7639..6c44899bcb 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -1666,19 +1666,26 @@ (defn- text-partial-change-value - [touched-shape untouched-shape touched] + [touched-content untouched-content touched] (cond (touched :text-content-structure-same-attrs) - ;; Keep the touched-shape structure and texts, update its attrs to make them like the untouched-shape - (cttx/copy-attrs-keys touched-shape (cttx/get-first-paragraph-text-attrs untouched-shape)) + (if (touched :text-content-attribute) + ;; Both structure and attrs has been touched, keep the + ;; touched-content + touched-content + ;; Keep the touched-content structure and texts, update + ;; its attrs to make them like the untouched-content + (cttx/copy-attrs-keys touched-content (cttx/get-first-paragraph-text-attrs untouched-content))) (touched :text-content-text) - ;; Keep the texts touched in touched-shape copy the texts from dest over the attrs of untouched-shape - (cttx/copy-text-keys touched-shape untouched-shape) + ;; Keep the texts touched in touched-content, so copy the + ;; texts from touched-content into untouched-content + (cttx/copy-text-keys touched-content untouched-content) (touched :text-content-attribute) - ;; Keep the attrs touched in touched-shape copy the texts from untouched-shape over the attrs of touched-shape - (cttx/copy-text-keys untouched-shape touched-shape))) + ;; Keep the attrs touched in touched-content, so copy the + ;; texts from untouched-content into touched-content + (cttx/copy-text-keys untouched-content touched-content))) (defn- add-update-attr-operations [attr dest-shape roperations uoperations attr-val]