From 74dd4f1ff851cca633f6d22e95983171a0b8e2bd Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 3 Jul 2023 09:19:36 +0200 Subject: [PATCH] :bug: Fix text content validation --- common/src/app/common/pages/changes.cljc | 5 ++--- common/src/app/common/types/shape.cljc | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/common/src/app/common/pages/changes.cljc b/common/src/app/common/pages/changes.cljc index 78bb492b80..97be5e91b1 100644 --- a/common/src/app/common/pages/changes.cljc +++ b/common/src/app/common/pages/changes.cljc @@ -246,9 +246,8 @@ (let [shape-old (dm/get-in data-old [:pages-index page-id :objects id]) shape-new (dm/get-in data-new [:pages-index page-id :objects id])] - ;; If object has changed verify is correct - (when (and (some? shape-old) - (some? shape-new) + ;; If object has changed or is new verify is correct + (when (and (some? shape-new) (not= shape-old shape-new)) (dm/verify! (cts/shape? shape-new)))))] diff --git a/common/src/app/common/types/shape.cljc b/common/src/app/common/types/shape.cljc index 89c229959d..4b5703acd2 100644 --- a/common/src/app/common/types/shape.cljc +++ b/common/src/app/common/types/shape.cljc @@ -225,7 +225,7 @@ [:map {:title "TextAttrs"} [:id ::sm/uuid] [:type [:= :text]] - [:content ::ctsx/content]]) + [:content {:optional true} [:maybe ::ctsx/content]]]) (sm/def! ::shape [:multi {:dispatch :type :title "Shape"}