From 65b7e5c3a5c4571b80d7050e1e4b751ecce9603d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 27 Nov 2024 10:42:56 +0100 Subject: [PATCH 1/3] :bug: Fix incorrect thumbnail rendering on dashboard --- backend/src/app/rpc/commands/files.clj | 6 +----- frontend/src/app/main/render.cljs | 2 +- frontend/src/app/main/ui/shapes/frame.cljs | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/backend/src/app/rpc/commands/files.clj b/backend/src/app/rpc/commands/files.clj index 3b746f8abc..19b7637e0e 100644 --- a/backend/src/app/rpc/commands/files.clj +++ b/backend/src/app/rpc/commands/files.clj @@ -698,11 +698,7 @@ (defn get-team-recent-files [conn team-id] - (->> (db/exec! conn [sql:team-recent-files team-id]) - (mapv (fn [row] - (if-let [media-id (:thumbnail-id row)] - (assoc row :thumbnail-uri (resolve-public-uri media-id)) - (dissoc row :media-id)))))) + (db/exec! conn [sql:team-recent-files team-id])) (def ^:private schema:get-team-recent-files [:map {:title "get-team-recent-files"} diff --git a/frontend/src/app/main/render.cljs b/frontend/src/app/main/render.cljs index 6ee64dc010..f0a9d14a08 100644 --- a/frontend/src/app/main/render.cljs +++ b/frontend/src/app/main/render.cljs @@ -99,7 +99,7 @@ [{:keys [shape]}] (let [thumbnails? (mf/use-ctx muc/render-thumbnails) childs (mapv (d/getf objects) (:shapes shape))] - (if (and thumbnails? (some? (:thumbnail shape))) + (if (and thumbnails? (some? (:thumbnail-id shape))) [:& frame/frame-thumbnail {:shape shape :bounds (:children-bounds shape)}] [:& frame-shape {:shape shape :childs childs}]))))) diff --git a/frontend/src/app/main/ui/shapes/frame.cljs b/frontend/src/app/main/ui/shapes/frame.cljs index b644b8deff..090091d675 100644 --- a/frontend/src/app/main/ui/shapes/frame.cljs +++ b/frontend/src/app/main/ui/shapes/frame.cljs @@ -60,7 +60,6 @@ (mf/defc frame-container {::mf/wrap-props false} [props] - (let [shape (unchecked-get props "shape") children (unchecked-get props "children") From 75e7cfb69e7ada81a0838880e5658005bb7697db Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 27 Nov 2024 11:15:58 +0100 Subject: [PATCH 2/3] :bug: Fix regression with component thumbnails --- frontend/src/app/main/data/workspace/libraries.cljs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 5f4c56aa9a..982c56c9d8 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -881,6 +881,12 @@ (rx/of (dwu/start-undo-transaction undo-id) (update-component shape-id undo-group) + + ;; These two calls are necessary for properly sync thumbnails + ;; when a main component does not live in the same page + (update-component-thumbnail-sync state component-id file-id "frame") + (update-component-thumbnail-sync state component-id file-id "component") + (sync-file current-file-id file-id :components component-id undo-group) (when (not current-file?) (sync-file file-id file-id :components component-id undo-group)) From 37b50497f3eb321049959584f64bf79c336fa6c3 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 27 Nov 2024 11:51:13 +0100 Subject: [PATCH 3/3] :bug: Fix problem with editor line-height --- frontend/src/app/util/text/content/to_dom.cljs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/util/text/content/to_dom.cljs b/frontend/src/app/util/text/content/to_dom.cljs index fbf0890181..f1f6a994d2 100644 --- a/frontend/src/app/util/text/content/to_dom.cljs +++ b/frontend/src/app/util/text/content/to_dom.cljs @@ -73,11 +73,14 @@ ;; it affects to the height calculation the browser does font-size (if (some #(not= "" (:text %)) (:children paragraph)) "0" - (:font-size styles (:font-size txt/default-text-attrs)))] - (cond-> styles - ;; Every paragraph must have line-height to be correctly rendered - (nil? (:line-height styles)) (assoc :line-height (:line-height txt/default-text-attrs)) - true (assoc :font-size font-size)))) + (:font-size styles (:font-size txt/default-text-attrs))) + + line-height (:line-height styles) + line-height (if (and (some? line-height) (not= "" line-height)) + line-height + (:line-height txt/default-text-attrs))] + (-> styles + (assoc :font-size font-size :line-height line-height)))) (defn get-root-styles [root]