From 7bde3d0ec135b390c73d5798735576e394179531 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 19 Jun 2025 08:51:29 +0200 Subject: [PATCH 1/9] :bug: Fix comment icon fill --- CHANGES.md | 2 +- frontend/src/app/main/ui/comments.scss | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4e21551b84..ebad087b7c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -52,7 +52,7 @@ on-premises instances** that want to keep up to date. - Fix issue with importing files where flex/grid is used [Taiga #11334](https://tree.taiga.io/project/penpot/issue/11334) - Fix wrong color in the export progress bar [Taiga #11299](https://tree.taiga.io/project/penpot/issue/11299) - Fix right sidebar width overflow on long layer names [Taiga #11212](https://tree.taiga.io/project/penpot/issue/11212) - +- Fix comment icon fill [Taiga #11388](https://tree.taiga.io/project/penpot/issue/11388) ## 2.7.2 ### :bug: Bugs fixed diff --git a/frontend/src/app/main/ui/comments.scss b/frontend/src/app/main/ui/comments.scss index 8ca32f61b7..62cd9977ff 100644 --- a/frontend/src/app/main/ui/comments.scss +++ b/frontend/src/app/main/ui/comments.scss @@ -301,11 +301,10 @@ } .open-mentions-button { - stroke: none; - fill: var(--color-foreground-secondary); + color: var(--color-foreground-secondary); &.is-toggled { - fill: var(--color-accent-primary); + color: var(--color-accent-primary); } } From b91d703060bb478a04c5fd9f7467d820fdcc6089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Thu, 19 Jun 2025 09:32:01 +0200 Subject: [PATCH 2/9] :bug: Fix a typo --- docker/images/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/images/docker-compose.yaml b/docker/images/docker-compose.yaml index 42cb16ce10..59601af625 100644 --- a/docker/images/docker-compose.yaml +++ b/docker/images/docker-compose.yaml @@ -206,7 +206,7 @@ services: # communicate with the frontend. PENPOT_PUBLIC_URI: http://penpot-frontend:8080 - ## Valkey (or previowsly Redis) is used for the websockets notifications. + ## Valkey (or previously Redis) is used for the websockets notifications. PENPOT_REDIS_URI: redis://penpot-valkey/0 penpot-postgres: From cb46d643ac81b232b8cd156fe90ffd4e55cfcd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Valderrama?= Date: Thu, 22 May 2025 12:30:54 +0200 Subject: [PATCH 3/9] :sparkles: Add missing user experience events --- frontend/src/app/main/data/event.cljs | 37 +++++++++++++++++++ frontend/src/app/main/data/viewer.cljs | 5 ++- .../app/main/data/workspace/clipboard.cljs | 28 ++++++++++---- .../app/main/data/workspace/interactions.cljs | 7 +++- .../app/main/data/workspace/selection.cljs | 23 +++++++++--- .../app/main/data/workspace/shape_layout.cljs | 8 +++- .../src/app/main/data/workspace/shapes.cljs | 20 +++++++++- .../app/main/data/workspace/transforms.cljs | 19 ++++++++-- .../app/main/ui/inspect/right_sidebar.cljs | 3 +- 9 files changed, 126 insertions(+), 24 deletions(-) diff --git a/frontend/src/app/main/data/event.cljs b/frontend/src/app/main/data/event.cljs index 51d59b6f97..045312b2ac 100644 --- a/frontend/src/app/main/data/event.cljs +++ b/frontend/src/app/main/data/event.cljs @@ -8,6 +8,7 @@ (:require ["ua-parser-js" :as ua] [app.common.data :as d] + [app.common.files.helpers :as cfh] [app.common.json :as json] [app.common.logging :as l] [app.config :as cf] @@ -242,3 +243,39 @@ (l/error :hint "error on event batching stream" :cause cause)) (fn [] (l/debug :hitn "events batching stream terminated"))))))))) + +;; ---- HELPERS + +(defn get-shape-type + "Returns the type of the shape, or Empty if it's Root Frame" + [objects id] + (let [shape (get objects id)] + (if (cfh/root? shape) + "Empty" + (:type shape)))) + +(defn frame-has-layout + "Returns true if the provided frame has a layout." + [objects id] + (let [frame (get objects id)] + (boolean (and frame (:layout frame))))) + +(defn get-shape-event-name + "Returns the event name corresponding to a shape type, or nil if no match." + [shape] + (cond + (cfh/frame-shape? shape) "create-board" + (cfh/image-shape? shape) "create-image" + (cfh/path-shape? shape) "create-path" + (cfh/circle-shape? shape) "create-circle" + (cfh/rect-shape? shape) "create-rectangle" + (cfh/text-shape? shape) "create-text" + :else nil)) + +(defn get-selected-type + "Returns the type of the shape if only one, or multiple if more than one" + [objects selected] + (if (= 1 (count selected)) + (let [shape (get objects (first selected))] + (:type shape)) + "multiple")) diff --git a/frontend/src/app/main/data/viewer.cljs b/frontend/src/app/main/data/viewer.cljs index c18444623a..fc03e684b8 100644 --- a/frontend/src/app/main/data/viewer.cljs +++ b/frontend/src/app/main/data/viewer.cljs @@ -80,8 +80,9 @@ (rx/of (fetch-bundle (d/without-nils params)) ;; Only fetch threads for logged-in users (when (some? (:profile state)) - (fetch-comment-threads params)))) - + (fetch-comment-threads params)) + (when (:share-id params) + (rx/of (ptk/event ::ev/event {::ev/name "shared-prototipe-visited"}))))) ptk/EffectEvent (effect [_ _ _] ;; Set the window name, the window name is used on inter-tab diff --git a/frontend/src/app/main/data/workspace/clipboard.cljs b/frontend/src/app/main/data/workspace/clipboard.cljs index 1e22e48199..84b602a515 100644 --- a/frontend/src/app/main/data/workspace/clipboard.cljs +++ b/frontend/src/app/main/data/workspace/clipboard.cljs @@ -902,13 +902,27 @@ undo-id (js/Symbol)] (rx/concat - (->> (filter ctc/instance-head? orig-shapes) - (map (fn [{:keys [component-file]}] - (ptk/event ::ev/event - {::ev/name "use-library-component" - ::ev/origin "paste" - :external-library (not= file-id component-file)}))) - (rx/from)) + (->> orig-shapes + (keep (fn [shape] + + (if (ctc/instance-head? shape) + (ptk/event ::ev/event + {::ev/name "use-library-component" + ::ev/origin "paste" + :external-library (not= file-id (:component-file shape)) + :parent-type (ev/get-shape-type all-objects (:parent-id shape))}) + (when (ev/get-shape-event-name shape) + (if (ev/frame-has-layout all-objects (:parent-id shape)) + (ptk/event ::ev/event + {::ev/name "layout-add-element" + :element-type (:type shape) + :source "paste" + :parent-type (ev/get-shape-type all-objects (:parent-id shape))}) + (ptk/event ::ev/event + {::ev/name (ev/get-shape-event-name shape) + :parent-type (ev/get-shape-type all-objects (:parent-id shape)) + :source "paste"}))))))) + (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) (dws/select-shapes selected) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index 99ceee9475..647e794192 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -62,6 +62,8 @@ (defn add-flow-selected-frame [] (ptk/reify ::add-flow-selected-frame + ev/Event + (-data [_] {::ev/name "add-prototype-interaction"}) ptk/WatchEvent (watch [_ state _] (let [selected (dsh/lookup-selected state)] @@ -187,9 +189,10 @@ (when (and (not (connected-frame? objects (:id frame))) (nil? flow)) (rx/of (add-flow (:id frame)))) - (when first? + (if first? ;; When the first interaction of the page is created we emit the event "create-prototype" - (rx/of (ptk/event ::ev/event {::ev/name "create-prototype"}))))))))) + (rx/of (ptk/event ::ev/event {::ev/name "create-prototype"})) + (rx/of (ptk/event ::ev/event {::ev/name "add-prototype-interaction"}))))))))) (defn remove-interaction ([shape index] diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index e69f10bc62..8b006311e1 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -480,12 +480,23 @@ undo-id (js/Symbol)] (rx/concat (->> (map (d/getf objects) ids) - (filter ctk/instance-head?) - (map (fn [{:keys [component-file]}] - (ptk/event ::ev/event - {::ev/name "use-library-component" - ::ev/origin "duplicate" - :external-library (not= file-id component-file)}))) + (keep (fn [shape] + (if (ctk/instance-head? shape) + (ptk/event ::ev/event + {::ev/name "use-library-component" + ::ev/origin "duplicate" + :parent-type (ev/get-shape-type objects (:parent-id shape)) + :external-library (not= file-id (:component-file shape))}) + (when-let [event-name (ev/get-shape-event-name shape)] + (if (ev/frame-has-layout objects (:parent-id shape)) + (ptk/event ::ev/event + {::ev/name "layout-add-element" + :element-type (:type shape) + :source "duplicate"}) + (ptk/event ::ev/event + {::ev/name event-name + :parent-type (ev/get-shape-type objects (:parent-id shape)) + :source "duplicate"})))))) (rx/from)) ;; Warning: This order is important for the focus mode. (->> (rx/of diff --git a/frontend/src/app/main/data/workspace/shape_layout.cljs b/frontend/src/app/main/data/workspace/shape_layout.cljs index 529561c513..a58c81c332 100644 --- a/frontend/src/app/main/data/workspace/shape_layout.cljs +++ b/frontend/src/app/main/data/workspace/shape_layout.cljs @@ -294,7 +294,13 @@ (seq padding-attrs) (assoc :changed-sub-attr padding-attrs))) (ptk/data-event :layout/update {:ids ids}) - (dwu/commit-undo-transaction undo-id))))))) + (dwu/commit-undo-transaction undo-id) + (when (or (:layout-align-content changes) (:layout-justify-content changes)) + (ptk/event ::ev/event + {::ev/name "layout-change-alignment"})) + (when (or (:layout-padding changes) (:layout-gap changes)) + (ptk/event ::ev/event + {::ev/name "layout-change-margin"})))))))) (defn add-layout-track ([ids type value] diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 27cb972a64..19a049e066 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -142,8 +142,20 @@ (when (cfh/text-shape? shape) (->> (rx/of (dwe/start-edition-mode (:id shape))) (rx/observe-on :async))) - (when (cfh/frame-shape? shape) - (rx/of (ptk/event ::ev/event {::ev/name "add-frame"}))))))))) + + (when-let [event-name (ev/get-shape-event-name shape)] + (if (ev/frame-has-layout objects (:parent-id shape)) + (rx/of + (ptk/event ::ev/event + {::ev/name "layout-add-element" + :element-type (:type shape) + :source "new"})) + + (rx/of + (ptk/event ::ev/event + {::ev/name event-name + :parent-type (ev/get-shape-type objects (:parent-id shape)) + :source "new"})))))))))) (defn move-shapes-into-frame [frame-id shapes] @@ -284,6 +296,10 @@ (dch/commit-changes changes) (dws/select-shapes (d/ordered-set (:id frame-shape))) (ptk/data-event :layout/update {:ids [(:id frame-shape)]}) + (ptk/event ::ev/event + {::ev/name "create-board" + :converted-from (ev/get-selected-type objects selected) + :parent-type (ev/get-shape-type objects (:parent-id frame-shape))}) (dwu/commit-undo-transaction undo-id)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index a68e484c99..69b0bce285 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -28,6 +28,7 @@ [app.common.types.shape.layout :as ctl] [app.common.uuid :as uuid] [app.main.data.changes :as dch] + [app.main.data.event :as ev] [app.main.data.helpers :as dsh] [app.main.data.workspace.collapse :as dwc] [app.main.data.workspace.modifiers :as dwm] @@ -1083,9 +1084,21 @@ ids :cell cell))] - (when (and (some? frame-id) (d/not-empty? changes)) - (rx/of (dch/commit-changes changes) - (dwc/expand-collapse frame-id))))))) + (rx/concat + (let [shapes (mapv #(get objects %) ids) + moved-count (count (filter #(not= (:parent-id %) frame-id) shapes)) + emit-layout-event? (and (ev/frame-has-layout objects frame-id) + (pos? moved-count))] + (when emit-layout-event? + (rx/of (ptk/event ::ev/event + {::ev/name "layout-add-element" + :source "move-shapes-to-frame" + :element-type (ev/get-selected-type objects ids) + :moved moved-count})))) + + (when (and (some? frame-id) (d/not-empty? changes)) + (rx/of (dch/commit-changes changes) + (dwc/expand-collapse frame-id)))))))) (defn- get-displacement "Retrieve the correct displacement delta point for the diff --git a/frontend/src/app/main/ui/inspect/right_sidebar.cljs b/frontend/src/app/main/ui/inspect/right_sidebar.cljs index 5530464505..8ef94c8e0d 100644 --- a/frontend/src/app/main/ui/inspect/right_sidebar.cljs +++ b/frontend/src/app/main/ui/inspect/right_sidebar.cljs @@ -110,7 +110,8 @@ (mf/use-effect (mf/deps shapes handle-change-tab) (fn [] - (when-not (seq shapes) + (if (seq shapes) + (st/emit! (ptk/event ::ev/event {::ev/name "inspect-mode-click-element"})) (handle-change-tab :info)))) [:aside {:class (stl/css-case :settings-bar-right true From b595d5abf896743e86558e170384d51501b543d9 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 19 Jun 2025 11:23:32 +0200 Subject: [PATCH 4/9] :bug: Fix radio buttons gap --- CHANGES.md | 2 ++ frontend/src/app/main/ui/components/radio_buttons.scss | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index ebad087b7c..8edc5ceecb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -53,6 +53,8 @@ on-premises instances** that want to keep up to date. - Fix wrong color in the export progress bar [Taiga #11299](https://tree.taiga.io/project/penpot/issue/11299) - Fix right sidebar width overflow on long layer names [Taiga #11212](https://tree.taiga.io/project/penpot/issue/11212) - Fix comment icon fill [Taiga #11388](https://tree.taiga.io/project/penpot/issue/11388) +- Fix gap on radio-buttons component [Taiga #11360](https://tree.taiga.io/project/penpot/issue/11360) + ## 2.7.2 ### :bug: Bugs fixed diff --git a/frontend/src/app/main/ui/components/radio_buttons.scss b/frontend/src/app/main/ui/components/radio_buttons.scss index 2000065688..88c0913387 100644 --- a/frontend/src/app/main/ui/components/radio_buttons.scss +++ b/frontend/src/app/main/ui/components/radio_buttons.scss @@ -11,6 +11,7 @@ border-radius: $br-8; height: $s-32; background-color: var(--input-background-color); + gap: $s-4; } .radio-icon { From 892c9ab12c2294e816a999ab787f24794b7366c6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 18 Jun 2025 12:30:28 +0200 Subject: [PATCH 5/9] :sparkles: Add minor code consistency fixes --- common/src/app/common/files/helpers.cljc | 24 +++++++++ frontend/src/app/main/data/event.cljs | 37 -------------- .../app/main/data/workspace/clipboard.cljs | 44 ++++++++++------- .../app/main/data/workspace/selection.cljs | 49 +++++++++++-------- .../src/app/main/data/workspace/shapes.cljs | 27 +++++----- .../app/main/data/workspace/transforms.cljs | 12 ++--- 6 files changed, 97 insertions(+), 96 deletions(-) diff --git a/common/src/app/common/files/helpers.cljc b/common/src/app/common/files/helpers.cljc index 5ac14ac501..360d8428d3 100644 --- a/common/src/app/common/files/helpers.cljc +++ b/common/src/app/common/files/helpers.cljc @@ -117,6 +117,12 @@ ([shape] (d/not-empty? (:shapes shape)))) +(defn has-layout? + "Returns true if the provided shape has a layout assigned" + [objects id] + (let [shape (get objects id)] + (boolean (and shape (:layout shape))))) + (defn group-like-shape? ([objects id] (group-like-shape? (get objects id))) @@ -127,6 +133,24 @@ ;; ---- ACCESSORS +(defn get-selected-type + "Returns the type of the shape if only one, or :multiple if more + than one" + [objects selected] + (if (= 1 (count selected)) + (let [shape (get objects (first selected))] + (:type shape)) + :multiple)) + +(defn get-shape-type + "Returns the type of the shape, or 'root' if it's Root Frame, always + as string" + [objects id] + (let [shape (get objects id)] + (if (root? shape) + :root + (dm/get-prop shape :type)))) + (defn get-children-ids [objects id] (letfn [(get-children-ids-rec [id processed] diff --git a/frontend/src/app/main/data/event.cljs b/frontend/src/app/main/data/event.cljs index 045312b2ac..51d59b6f97 100644 --- a/frontend/src/app/main/data/event.cljs +++ b/frontend/src/app/main/data/event.cljs @@ -8,7 +8,6 @@ (:require ["ua-parser-js" :as ua] [app.common.data :as d] - [app.common.files.helpers :as cfh] [app.common.json :as json] [app.common.logging :as l] [app.config :as cf] @@ -243,39 +242,3 @@ (l/error :hint "error on event batching stream" :cause cause)) (fn [] (l/debug :hitn "events batching stream terminated"))))))))) - -;; ---- HELPERS - -(defn get-shape-type - "Returns the type of the shape, or Empty if it's Root Frame" - [objects id] - (let [shape (get objects id)] - (if (cfh/root? shape) - "Empty" - (:type shape)))) - -(defn frame-has-layout - "Returns true if the provided frame has a layout." - [objects id] - (let [frame (get objects id)] - (boolean (and frame (:layout frame))))) - -(defn get-shape-event-name - "Returns the event name corresponding to a shape type, or nil if no match." - [shape] - (cond - (cfh/frame-shape? shape) "create-board" - (cfh/image-shape? shape) "create-image" - (cfh/path-shape? shape) "create-path" - (cfh/circle-shape? shape) "create-circle" - (cfh/rect-shape? shape) "create-rectangle" - (cfh/text-shape? shape) "create-text" - :else nil)) - -(defn get-selected-type - "Returns the type of the shape if only one, or multiple if more than one" - [objects selected] - (if (= 1 (count selected)) - (let [shape (get objects (first selected))] - (:type shape)) - "multiple")) diff --git a/frontend/src/app/main/data/workspace/clipboard.cljs b/frontend/src/app/main/data/workspace/clipboard.cljs index 84b602a515..a66bca8188 100644 --- a/frontend/src/app/main/data/workspace/clipboard.cljs +++ b/frontend/src/app/main/data/workspace/clipboard.cljs @@ -902,26 +902,32 @@ undo-id (js/Symbol)] (rx/concat - (->> orig-shapes - (keep (fn [shape] + (->> (rx/from orig-shapes) + (rx/map (fn [shape] + (let [parent-type (cfh/get-shape-type all-objects (:parent-id shape)) + external-lib? (not= file-id (:component-file shape)) + origin "workspace:paste"] - (if (ctc/instance-head? shape) - (ptk/event ::ev/event - {::ev/name "use-library-component" - ::ev/origin "paste" - :external-library (not= file-id (:component-file shape)) - :parent-type (ev/get-shape-type all-objects (:parent-id shape))}) - (when (ev/get-shape-event-name shape) - (if (ev/frame-has-layout all-objects (:parent-id shape)) - (ptk/event ::ev/event - {::ev/name "layout-add-element" - :element-type (:type shape) - :source "paste" - :parent-type (ev/get-shape-type all-objects (:parent-id shape))}) - (ptk/event ::ev/event - {::ev/name (ev/get-shape-event-name shape) - :parent-type (ev/get-shape-type all-objects (:parent-id shape)) - :source "paste"}))))))) + ;; NOTE: we don't emit the create-shape event all the time for + ;; avoid send a lot of events (that are not necessary); this + ;; decision is made explicitly by the responsible team. + (if (ctc/instance-head? shape) + (ptk/data-event ::ev/event + {::ev/name "use-library-component" + ::ev/origin origin + :is-external-library external-lib? + :parent-shape-type parent-type}) + (if (cfh/has-layout? objects (:parent-id shape)) + (ptk/data-event ::ev/event + {::ev/name "layout-add-element" + ::ev/origin origin + :element-type (get shape :type) + :parent-type parent-type}) + (ptk/data-event ::ev/event + {::ev/name "create-shape" + ::ev/origin origin + :shape-type (get shape :type) + :parent-shape-type parent-type}))))))) (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 8b006311e1..17c29a9d44 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -479,26 +479,35 @@ ids) undo-id (js/Symbol)] (rx/concat - (->> (map (d/getf objects) ids) - (keep (fn [shape] - (if (ctk/instance-head? shape) - (ptk/event ::ev/event - {::ev/name "use-library-component" - ::ev/origin "duplicate" - :parent-type (ev/get-shape-type objects (:parent-id shape)) - :external-library (not= file-id (:component-file shape))}) - (when-let [event-name (ev/get-shape-event-name shape)] - (if (ev/frame-has-layout objects (:parent-id shape)) - (ptk/event ::ev/event - {::ev/name "layout-add-element" - :element-type (:type shape) - :source "duplicate"}) - (ptk/event ::ev/event - {::ev/name event-name - :parent-type (ev/get-shape-type objects (:parent-id shape)) - :source "duplicate"})))))) - (rx/from)) - ;; Warning: This order is important for the focus mode. + (->> (rx/from ids) + (rx/map (fn [shape-id] + (let [shape (get objects shape-id) + parent-type (cfh/get-shape-type objects (:parent-id shape)) + external-lib? (not= file-id (:component-file shape)) + origin "workspace:duplicate-shapes"] + + ;; NOTE: we don't emit the create-shape event all the time for + ;; avoid send a lot of events (that are not necessary); this + ;; decision is made explicitly by the responsible team. + (if (ctk/instance-head? shape) + (ptk/data-event ::ev/event + {::ev/name "use-library-component" + ::ev/origin origin + :is-external-library external-lib? + :parent-shape-type parent-type}) + (if (cfh/has-layout? objects (:parent-id shape)) + (ptk/data-event ::ev/event + {::ev/name "layout-add-element" + ::ev/origin origin + :element-type (get shape :type) + :parent-type parent-type}) + (ptk/data-event ::ev/event + {::ev/name "create-shape" + ::ev/origin origin + :shape-type (get shape :type) + :parent-shape-type parent-type}))))))) + + ;; Warning: This order is important for the focus mode. (->> (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 19a049e066..87e4aba23c 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -143,19 +143,18 @@ (->> (rx/of (dwe/start-edition-mode (:id shape))) (rx/observe-on :async))) - (when-let [event-name (ev/get-shape-event-name shape)] - (if (ev/frame-has-layout objects (:parent-id shape)) - (rx/of - (ptk/event ::ev/event - {::ev/name "layout-add-element" - :element-type (:type shape) - :source "new"})) + (rx/of (ptk/data-event ::ev/event + {::ev/name "create-shape" + ::ev/origin "workspace:add-shape" + :type (get shape :type) + :parent-type (cfh/get-shape-type objects (:parent-id shape))})) + + (when (cfh/has-layout? objects (:parent-id shape)) + (rx/of (ptk/data-event ::ev/event + {::ev/name "layout-add-element" + ::ev/origin "workspace:add-shape" + :element-type (get shape :type)}))))))))) - (rx/of - (ptk/event ::ev/event - {::ev/name event-name - :parent-type (ev/get-shape-type objects (:parent-id shape)) - :source "new"})))))))))) (defn move-shapes-into-frame [frame-id shapes] @@ -298,8 +297,8 @@ (ptk/data-event :layout/update {:ids [(:id frame-shape)]}) (ptk/event ::ev/event {::ev/name "create-board" - :converted-from (ev/get-selected-type objects selected) - :parent-type (ev/get-shape-type objects (:parent-id frame-shape))}) + :converted-from (cfh/get-selected-type objects selected) + :parent-type (cfh/get-shape-type objects (:parent-id frame-shape))}) (dwu/commit-undo-transaction undo-id)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index 69b0bce285..f924f62758 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -1087,14 +1087,14 @@ (rx/concat (let [shapes (mapv #(get objects %) ids) moved-count (count (filter #(not= (:parent-id %) frame-id) shapes)) - emit-layout-event? (and (ev/frame-has-layout objects frame-id) + emit-layout-event? (and (cfh/has-layout? objects frame-id) (pos? moved-count))] (when emit-layout-event? - (rx/of (ptk/event ::ev/event - {::ev/name "layout-add-element" - :source "move-shapes-to-frame" - :element-type (ev/get-selected-type objects ids) - :moved moved-count})))) + (rx/of (ptk/data-event ::ev/event + {::ev/name "layout-add-element" + :source "move-shapes-to-frame" + :element-type (cfh/get-selected-type objects ids) + :moved moved-count})))) (when (and (some? frame-id) (d/not-empty? changes)) (rx/of (dch/commit-changes changes) From b747ccc3822e39e8f295342498169c5efd576832 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 19 Jun 2025 11:31:18 +0200 Subject: [PATCH 6/9] :tada: Add shortcut helper for creating events --- frontend/src/app/main/data/event.cljs | 4 +++ .../app/main/data/workspace/clipboard.cljs | 27 +++++++-------- .../app/main/data/workspace/interactions.cljs | 4 +-- .../app/main/data/workspace/selection.cljs | 33 +++++++++---------- .../src/app/main/data/workspace/shapes.cljs | 24 ++++++-------- .../app/main/data/workspace/transforms.cljs | 9 +++-- 6 files changed, 47 insertions(+), 54 deletions(-) diff --git a/frontend/src/app/main/data/event.cljs b/frontend/src/app/main/data/event.cljs index 51d59b6f97..888bd6e1d0 100644 --- a/frontend/src/app/main/data/event.cljs +++ b/frontend/src/app/main/data/event.cljs @@ -242,3 +242,7 @@ (l/error :hint "error on event batching stream" :cause cause)) (fn [] (l/debug :hitn "events batching stream terminated"))))))))) + +(defn event + [props] + (ptk/data-event ::events props)) diff --git a/frontend/src/app/main/data/workspace/clipboard.cljs b/frontend/src/app/main/data/workspace/clipboard.cljs index a66bca8188..1808e8a97e 100644 --- a/frontend/src/app/main/data/workspace/clipboard.cljs +++ b/frontend/src/app/main/data/workspace/clipboard.cljs @@ -912,22 +912,19 @@ ;; avoid send a lot of events (that are not necessary); this ;; decision is made explicitly by the responsible team. (if (ctc/instance-head? shape) - (ptk/data-event ::ev/event - {::ev/name "use-library-component" - ::ev/origin origin - :is-external-library external-lib? - :parent-shape-type parent-type}) + (ev/event {::ev/name "use-library-component" + ::ev/origin origin + :is-external-library external-lib? + :parent-shape-type parent-type}) (if (cfh/has-layout? objects (:parent-id shape)) - (ptk/data-event ::ev/event - {::ev/name "layout-add-element" - ::ev/origin origin - :element-type (get shape :type) - :parent-type parent-type}) - (ptk/data-event ::ev/event - {::ev/name "create-shape" - ::ev/origin origin - :shape-type (get shape :type) - :parent-shape-type parent-type}))))))) + (ev/event {::ev/name "layout-add-element" + ::ev/origin origin + :element-type (get shape :type) + :parent-type parent-type}) + (ev/event {::ev/name "create-shape" + ::ev/origin origin + :shape-type (get shape :type) + :parent-shape-type parent-type}))))))) (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index 647e794192..3919c5564d 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -191,8 +191,8 @@ (rx/of (add-flow (:id frame)))) (if first? ;; When the first interaction of the page is created we emit the event "create-prototype" - (rx/of (ptk/event ::ev/event {::ev/name "create-prototype"})) - (rx/of (ptk/event ::ev/event {::ev/name "add-prototype-interaction"}))))))))) + (rx/of (ev/event {::ev/name "create-prototype"})) + (rx/of (ev/event {::ev/name "add-prototype-interaction"}))))))))) (defn remove-interaction ([shape index] diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 17c29a9d44..884f2e85d3 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -486,26 +486,23 @@ external-lib? (not= file-id (:component-file shape)) origin "workspace:duplicate-shapes"] - ;; NOTE: we don't emit the create-shape event all the time for - ;; avoid send a lot of events (that are not necessary); this - ;; decision is made explicitly by the responsible team. + ;; NOTE: we don't emit the create-shape event all the time for + ;; avoid send a lot of events (that are not necessary); this + ;; decision is made explicitly by the responsible team. (if (ctk/instance-head? shape) - (ptk/data-event ::ev/event - {::ev/name "use-library-component" - ::ev/origin origin - :is-external-library external-lib? - :parent-shape-type parent-type}) + (ev/event {::ev/name "use-library-component" + ::ev/origin origin + :is-external-library external-lib? + :parent-shape-type parent-type}) (if (cfh/has-layout? objects (:parent-id shape)) - (ptk/data-event ::ev/event - {::ev/name "layout-add-element" - ::ev/origin origin - :element-type (get shape :type) - :parent-type parent-type}) - (ptk/data-event ::ev/event - {::ev/name "create-shape" - ::ev/origin origin - :shape-type (get shape :type) - :parent-shape-type parent-type}))))))) + (ev/event {::ev/name "layout-add-element" + ::ev/origin origin + :element-type (get shape :type) + :parent-type parent-type}) + (ev/event {::ev/name "create-shape" + ::ev/origin origin + :shape-type (get shape :type) + :parent-shape-type parent-type}))))))) ;; Warning: This order is important for the focus mode. (->> (rx/of diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 87e4aba23c..f755a3eb22 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -143,18 +143,15 @@ (->> (rx/of (dwe/start-edition-mode (:id shape))) (rx/observe-on :async))) - (rx/of (ptk/data-event ::ev/event - {::ev/name "create-shape" - ::ev/origin "workspace:add-shape" - :type (get shape :type) - :parent-type (cfh/get-shape-type objects (:parent-id shape))})) + (rx/of (ev/event {::ev/name "create-shape" + ::ev/origin "workspace:add-shape" + :type (get shape :type) + :parent-type (cfh/get-shape-type objects (:parent-id shape))})) (when (cfh/has-layout? objects (:parent-id shape)) - (rx/of (ptk/data-event ::ev/event - {::ev/name "layout-add-element" - ::ev/origin "workspace:add-shape" - :element-type (get shape :type)}))))))))) - + (rx/of (ev/event {::ev/name "layout-add-element" + ::ev/origin "workspace:add-shape" + :element-type (get shape :type)}))))))))) (defn move-shapes-into-frame [frame-id shapes] @@ -295,10 +292,9 @@ (dch/commit-changes changes) (dws/select-shapes (d/ordered-set (:id frame-shape))) (ptk/data-event :layout/update {:ids [(:id frame-shape)]}) - (ptk/event ::ev/event - {::ev/name "create-board" - :converted-from (cfh/get-selected-type objects selected) - :parent-type (cfh/get-shape-type objects (:parent-id frame-shape))}) + (ev/event {::ev/name "create-board" + :converted-from (cfh/get-selected-type objects selected) + :parent-type (cfh/get-shape-type objects (:parent-id frame-shape))}) (dwu/commit-undo-transaction undo-id)))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index f924f62758..d526bfb8b4 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -1090,11 +1090,10 @@ emit-layout-event? (and (cfh/has-layout? objects frame-id) (pos? moved-count))] (when emit-layout-event? - (rx/of (ptk/data-event ::ev/event - {::ev/name "layout-add-element" - :source "move-shapes-to-frame" - :element-type (cfh/get-selected-type objects ids) - :moved moved-count})))) + (rx/of (ev/event {::ev/name "layout-add-element" + ::ev/origin "workspace:move-shapes-to-frame" + :element-type (cfh/get-selected-type objects ids) + :moved moved-count})))) (when (and (some? frame-id) (d/not-empty? changes)) (rx/of (dch/commit-changes changes) From fbdabcd913757763643c7854a36c559b3e7a40cb Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 19 Jun 2025 12:51:53 +0200 Subject: [PATCH 7/9] :bug: Fix button width --- CHANGES.md | 1 + frontend/src/app/main/ui/inspect/exports.scss | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 8edc5ceecb..9809aa9b94 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -54,6 +54,7 @@ on-premises instances** that want to keep up to date. - Fix right sidebar width overflow on long layer names [Taiga #11212](https://tree.taiga.io/project/penpot/issue/11212) - Fix comment icon fill [Taiga #11388](https://tree.taiga.io/project/penpot/issue/11388) - Fix gap on radio-buttons component [Taiga #11360](https://tree.taiga.io/project/penpot/issue/11360) +- Fix button width [Taiga #11394](https://tree.taiga.io/project/penpot/issue/11394) ## 2.7.2 diff --git a/frontend/src/app/main/ui/inspect/exports.scss b/frontend/src/app/main/ui/inspect/exports.scss index f7365067c8..9b4e842405 100644 --- a/frontend/src/app/main/ui/inspect/exports.scss +++ b/frontend/src/app/main/ui/inspect/exports.scss @@ -39,6 +39,7 @@ .multiple-exports { @include flexRow; + grid-column: 1 / 9; } .label { From 86e36061fbca7bd76858ed0e19d715dfae1e8eb3 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 19 Jun 2025 13:23:43 +0200 Subject: [PATCH 8/9] :bug: Fix multiple values on text --- CHANGES.md | 1 + .../workspace/sidebar/options/menus/typography.cljs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9809aa9b94..4c2bdcfbeb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -55,6 +55,7 @@ on-premises instances** that want to keep up to date. - Fix comment icon fill [Taiga #11388](https://tree.taiga.io/project/penpot/issue/11388) - Fix gap on radio-buttons component [Taiga #11360](https://tree.taiga.io/project/penpot/issue/11360) - Fix button width [Taiga #11394](https://tree.taiga.io/project/penpot/issue/11394) +- Fix mixed letter spacing and line height [Taiga #11178](https://tree.taiga.io/project/penpot/issue/11178) ## 2.7.2 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 083a7a6f26..f462aa9092 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 @@ -360,11 +360,8 @@ [{:keys [values on-change on-blur]}] (let [{:keys [line-height letter-spacing]} values - line-height (or line-height "1.2") letter-spacing (or letter-spacing "0") - line-height-nillable (if (= (str line-height) "1.2") false true) - handle-change (fn [value attr] (on-change {attr (str value)}))] @@ -379,11 +376,11 @@ {:min -200 :max 200 :step 0.1 - :default "1.2" + :default-value "1.2" :class (stl/css :line-height-input) :value (attr->string line-height) - :placeholder (tr "settings.multiple") - :nillable line-height-nillable + :placeholder (if (= :multiple line-height) (tr "settings.multiple") "--") + :nillable (= :multiple line-height) :on-change #(handle-change % :line-height) :on-blur on-blur}]] @@ -397,10 +394,12 @@ {:min -200 :max 200 :step 0.1 + :default-value "0" :class (stl/css :letter-spacing-input) :value (attr->string letter-spacing) - :placeholder (tr "settings.multiple") + :placeholder (if (= :multiple letter-spacing) (tr "settings.multiple") "--") :on-change #(handle-change % :letter-spacing) + :nillable (= :multiple letter-spacing) :on-blur on-blur}]]])) (mf/defc text-transform-options From 909838c8c443b59787559d18286869d5cf083399 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 19 Jun 2025 14:01:15 +0200 Subject: [PATCH 9/9] :bug: Fix snap nodes shortcut --- CHANGES.md | 1 + frontend/src/app/main/data/workspace/path/shortcuts.cljs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4c2bdcfbeb..1361ff568b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -56,6 +56,7 @@ on-premises instances** that want to keep up to date. - Fix gap on radio-buttons component [Taiga #11360](https://tree.taiga.io/project/penpot/issue/11360) - Fix button width [Taiga #11394](https://tree.taiga.io/project/penpot/issue/11394) - Fix mixed letter spacing and line height [Taiga #11178](https://tree.taiga.io/project/penpot/issue/11178) +- Fix snap nodes shortcut [Taiga #11054](https://tree.taiga.io/project/penpot/issue/11054) ## 2.7.2 diff --git a/frontend/src/app/main/data/workspace/path/shortcuts.cljs b/frontend/src/app/main/data/workspace/path/shortcuts.cljs index 07fb3b1fa3..38c3195260 100644 --- a/frontend/src/app/main/data/workspace/path/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/path/shortcuts.cljs @@ -73,7 +73,8 @@ :fn #(st/emit! (drp/make-curve))} :snap-nodes {:tooltip (ds/meta "'") - :command (ds/c-mod "'") + ;;https://github.com/ccampbell/mousetrap/issues/85 + :command [(ds/c-mod "'") (ds/c-mod "219")] :subsections [:path-editor] :fn #(st/emit! (drp/toggle-snap))}