From b901a10aaaf0710de4f6066533483c0d5be7e361 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 6 Jul 2022 08:13:29 +0200 Subject: [PATCH 1/5] :bug: Fix typographies grouping --- CHANGES.md | 1 + .../app/main/data/workspace/libraries.cljs | 14 +++++---- .../app/main/ui/workspace/sidebar/assets.cljs | 3 +- .../sidebar/options/menus/typography.cljs | 30 ++++++++----------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8208c96e2..79a414a06 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ - Fix colors from unlinked libs in color selected widget [Taiga #3712](https://tree.taiga.io/project/penpot/issue/3712) - Fix fill information not complete when paste plain text [Taiga #3680](https://tree.taiga.io/project/penpot/issue/3680) - Fix problem when resizing groups [Taiga #3702](https://tree.taiga.io/project/penpot/issue/3702) +- Fix issues on typographies assets grouping [#2073](https://github.com/penpot/penpot/issues/2073) ## 1.14.1-beta diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 90a0c7a84..cc63069ce 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -233,10 +233,12 @@ (defn- do-update-tipography [it state typography file-id] - (let [data (get state :workspace-data) - changes (-> (pcb/empty-changes it) - (pcb/with-library-data data) - (pcb/update-typography typography))] + (let [data (get state :workspace-data) + [path name] (cph/parse-path-name (:name typography)) + typography (assoc typography :path path :name name) + changes (-> (pcb/empty-changes it) + (pcb/with-library-data data) + (pcb/update-typography typography))] (rx/of (dwu/start-undo-transaction) (dch/commit-changes changes) (sync-file (:current-file-id state) file-id) @@ -259,9 +261,9 @@ (ptk/reify ::rename-typography ptk/WatchEvent (watch [it state _] - (let [data (get state :workspace-data) + (let [data (get state :workspace-data) [path name] (cph/parse-path-name new-name) - object (get-in data [:typographies id]) + object (get-in data [:typographies id]) new-object (assoc object :path path :name name)] (do-update-tipography it state new-object file-id))))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 71c5fb260..1987dca1a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -1562,7 +1562,6 @@ (fn [event] (on-drop-asset-group event dragging? prefix selected-typographies-paths selected-typographies-full move-typography)))] - [:div {:on-drag-enter on-drag-enter :on-drag-leave on-drag-leave :on-drag-over on-drag-over @@ -1588,6 +1587,7 @@ [:div.drop-space]) (for [typography typographies] [:& typography-item {:typography typography + :key (dm/str (:id typography)) :file file :local? local? :handle-change handle-change @@ -1605,6 +1605,7 @@ (when-not (empty? path-item) [:& typographies-group {:file-id file-id :prefix (cph/merge-path-item prefix path-item) + :key (dm/str path-item) :groups content :open-groups open-groups :file file diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs index ee70c8d50..c8e6da475 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs @@ -468,27 +468,21 @@ (fn [event] (let [name (dom/get-target-val event)] (when-not (str/blank? name) - (on-change {:name name })))))] + (on-change {:name name})))))] - (mf/use-effect - (mf/deps editing?) - (fn [] - (when editing? - (reset! open? editing?)))) + (mf/with-effect [editing?] + (when editing? + (reset! open? editing?))) - (mf/use-effect - (mf/deps focus-name?) - (fn [] - (when focus-name? - (tm/schedule - #(when-let [node (mf/ref-val name-input-ref)] - (dom/focus! node) - (dom/select-text! node)))))) + (mf/with-effect [focus-name?] + (when focus-name? + (tm/schedule + #(when-let [node (mf/ref-val name-input-ref)] + (dom/focus! node) + (dom/select-text! node))))) - (mf/use-effect - (mf/deps on-change) - (fn [] - (mf/set-ref-val! on-change-ref {:on-change on-change}))) + (mf/with-effect [on-change] + (mf/set-ref-val! on-change-ref {:on-change on-change})) [:* [:div.element-set-options-group.typography-entry From 46c9fc1c5f641479b37de4315f8879b6ce9e9baf Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 27 Jun 2022 14:21:45 +0200 Subject: [PATCH 2/5] :bug: Normalize return value from parse-client-ip function --- backend/src/app/loggers/audit.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/app/loggers/audit.clj b/backend/src/app/loggers/audit.clj index 26e86a0aa..bb8b784ec 100644 --- a/backend/src/app/loggers/audit.clj +++ b/backend/src/app/loggers/audit.clj @@ -32,7 +32,7 @@ [request] (or (some-> (yrq/get-header request "x-forwarded-for") (str/split ",") first) (yrq/get-header request "x-real-ip") - (yrq/remote-addr request))) + (some-> (yrq/remote-addr request) str))) (defn extract-utm-params "Extracts additional data from params and namespace them under From 06905d5fa6d30c892e8adf3222e3ac92de0ea5d9 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jul 2022 11:02:33 +0200 Subject: [PATCH 3/5] :bug: Fix SVG texts positioning inconsistencies --- CHANGES.md | 1 + frontend/src/app/main/ui/shapes/text/svg_text.cljs | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 79a414a06..15390b086 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ - Fix fill information not complete when paste plain text [Taiga #3680](https://tree.taiga.io/project/penpot/issue/3680) - Fix problem when resizing groups [Taiga #3702](https://tree.taiga.io/project/penpot/issue/3702) - Fix issues on typographies assets grouping [#2073](https://github.com/penpot/penpot/issues/2073) +- Fix text positioning inconsistencies between browsers ## 1.14.1-beta diff --git a/frontend/src/app/main/ui/shapes/text/svg_text.cljs b/frontend/src/app/main/ui/shapes/text/svg_text.cljs index 4c8054c24..5ee933815 100644 --- a/frontend/src/app/main/ui/shapes/text/svg_text.cljs +++ b/frontend/src/app/main/ui/shapes/text/svg_text.cljs @@ -11,7 +11,6 @@ [app.common.geom.matrix :as gmt] [app.common.geom.point :as gpt] [app.common.geom.shapes :as gsh] - [app.config :as cfg] [app.main.ui.context :as muc] [app.main.ui.shapes.attrs :as attrs] [app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]] @@ -87,18 +86,13 @@ [:> :g group-props (for [[index data] (d/enumerate position-data)] - (let [y (if (cfg/check-browser? :safari) - (- (:y data) (:height data)) - (:y data)) - - alignment-bl (when (cfg/check-browser? :safari) "text-before-edge") - dominant-bl (when-not (cfg/check-browser? :safari) "ideographic") + (let [y (- (:y data) (:height data)) + dominant-bl "text-before-edge" rtl? (= "rtl" (:direction data)) props (-> #js {:key (dm/str "text-" (:id shape) "-" index) :x (if rtl? (+ (:x data) (:width data)) (:x data)) :y y :transform (position-data-transform shape data) - :alignmentBaseline alignment-bl :dominantBaseline dominant-bl :style (-> #js {:fontFamily (:font-family data) :fontSize (:font-size data) From 1c09328d0e26adb73b32147345c99351b65fc951 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 13 Jul 2022 11:20:32 +0200 Subject: [PATCH 4/5] :paperclip: Update version.txt file --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 398dc6c5e..a7525c96c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.14.1-beta +1.14.2-beta From 4bac2f15a2fc3d339392911ca37ca4c1dec71903 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 13 Jul 2022 11:29:22 +0200 Subject: [PATCH 5/5] :arrow_up: Use correct version of im4java (fixes tests) --- backend/deps.edn | 3 ++- backend/test/app/services_media_test.clj | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/deps.edn b/backend/deps.edn index 34e62ccb9..70e6717f0 100644 --- a/backend/deps.edn +++ b/backend/deps.edn @@ -34,7 +34,8 @@ buddy/buddy-sign {:mvn/version "3.4.333"} org.jsoup/jsoup {:mvn/version "1.14.3"} - org.im4java/im4java {:mvn/version "1.4.0"} + org.im4java/im4java {:git/tag "1.4.0-penpot-2" :git/sha "e2b3e16" + :git/url "https://github.com/penpot/im4java"} org.lz4/lz4-java {:mvn/version "1.8.0"} org.clojars.pntblnk/clj-ldap {:mvn/version "0.0.17"} diff --git a/backend/test/app/services_media_test.clj b/backend/test/app/services_media_test.clj index d0ce566b0..51e8e7d68 100644 --- a/backend/test/app/services_media_test.clj +++ b/backend/test/app/services_media_test.clj @@ -46,7 +46,8 @@ (t/is (sto/storage-object? mobj1)) (t/is (sto/storage-object? mobj2)) (t/is (= 122785 (:size mobj1))) - (t/is (= 3303 (:size mobj2))))) + (t/is (or (= 3302 (:size mobj2)) + (= 3303 (:size mobj2)))))) )) (t/deftest media-object-upload