diff --git a/CHANGES.md b/CHANGES.md index 4f9037d491..6eef7d5bf7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -94,6 +94,10 @@ - Fix exports menu on viewer mode [Taiga #5568](https://tree.taiga.io/project/penpot/issue/5568) - Fix create empty comments [Taiga #5536](https://tree.taiga.io/project/penpot/issue/5536) - Fix text changes not propagated to copy [Taiga #5364](https://tree.taiga.io/project/penpot/issue/5364) +- Fix position of text cursor is a bit too high in Invitations section [Taiga #5511](https://tree.taiga.io/project/penpot/issue/5511) +- Fix undo when updating several texts [Taiga #5197](https://tree.taiga.io/project/penpot/issue/5197) +- Fix assets right click button for multiple selection [Taiga #5545](https://tree.taiga.io/project/penpot/issue/5545) +- Fix problem with precision in resizes [Taiga #5623](https://tree.taiga.io/project/penpot/issue/5623) ### :arrow_up: Deps updates diff --git a/common/src/app/common/geom/shapes.cljc b/common/src/app/common/geom/shapes.cljc index af4f491940..9ba5de3477 100644 --- a/common/src/app/common/geom/shapes.cljc +++ b/common/src/app/common/geom/shapes.cljc @@ -155,6 +155,7 @@ (dm/export gco/shapes->rect) (dm/export gco/points->center) (dm/export gco/transform-points) +(dm/export gco/shape->points) (dm/export gtr/move) (dm/export gtr/absolute-move) diff --git a/common/src/app/common/geom/shapes/common.cljc b/common/src/app/common/geom/shapes/common.cljc index 35b5000364..746de65b28 100644 --- a/common/src/app/common/geom/shapes/common.cljc +++ b/common/src/app/common/geom/shapes/common.cljc @@ -87,3 +87,15 @@ (or ^boolean (mth/nan? (:x p)) ^boolean (mth/nan? (:y p)))) points))) + +(defn shape->points + [{:keys [transform points]}] + (if (gmt/unit? transform) + ;; Fix problem with precision could skew the shape + ;; when there are no transforms the points are the selrect shape + (let [p0 (nth points 0) ;; left top + p2 (nth points 2) ;; right bottom + p1 (gpt/point (:x p2) (:y p0)) + p3 (gpt/point (:x p0) (:y p2))] + [p0 p1 p2 p3]) + points)) diff --git a/common/src/app/common/geom/shapes/modifiers.cljc b/common/src/app/common/geom/shapes/modifiers.cljc index 315df975e6..b87f93593c 100644 --- a/common/src/app/common/geom/shapes/modifiers.cljc +++ b/common/src/app/common/geom/shapes/modifiers.cljc @@ -473,7 +473,7 @@ (cond-> modif-tree snap-pixel? (gpp/adjust-pixel-precision objects snap-precision snap-ignore-axis)) - bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points])) + bounds (d/lazy-map (keys objects) #(gco/shape->points (get objects %))) bounds (cond-> bounds (some? old-modif-tree) (transform-bounds objects old-modif-tree)) diff --git a/common/src/app/common/geom/shapes/pixel_precision.cljc b/common/src/app/common/geom/shapes/pixel_precision.cljc index 3702ddec69..5e37eb3ee5 100644 --- a/common/src/app/common/geom/shapes/pixel_precision.cljc +++ b/common/src/app/common/geom/shapes/pixel_precision.cljc @@ -63,7 +63,7 @@ (defn set-pixel-precision "Adjust modifiers so they adjust to the pixel grid" [modifiers shape precision ignore-axis] - (let [points (-> shape :points (gco/transform-points (ctm/modifiers->transform modifiers))) + (let [points (-> shape gco/shape->points (gco/transform-points (ctm/modifiers->transform modifiers))) has-resize? (not (ctm/only-move? modifiers)) [modifiers points] diff --git a/common/src/app/common/geom/shapes/transforms.cljc b/common/src/app/common/geom/shapes/transforms.cljc index 98b78be5aa..587843edab 100644 --- a/common/src/app/common/geom/shapes/transforms.cljc +++ b/common/src/app/common/geom/shapes/transforms.cljc @@ -337,13 +337,11 @@ ;; NOTE: ensure we have a fresh shallow copy of shape shape (cr/clone shape) shape (adjust-shape-flips! shape points) - + center (gco/points->center points) selrect (calculate-selrect points center) transform (calculate-transform points center selrect) - inverse (when (some? transform) (gmt/inverse transform)) - - ] + inverse (when (some? transform) (gmt/inverse transform))] (if-not (and (some? inverse) (some? transform)) shape diff --git a/frontend/resources/styles/main/partials/dashboard-team.scss b/frontend/resources/styles/main/partials/dashboard-team.scss index 45ee9d6ecb..5bdfcebda5 100644 --- a/frontend/resources/styles/main/partials/dashboard-team.scss +++ b/frontend/resources/styles/main/partials/dashboard-team.scss @@ -35,6 +35,7 @@ input { &.no-padding { padding-top: 12px; + height: 50px; } min-height: 40px; } diff --git a/frontend/resources/styles/main/partials/sidebar.scss b/frontend/resources/styles/main/partials/sidebar.scss index d8498fa7b3..b1890d5ec9 100644 --- a/frontend/resources/styles/main/partials/sidebar.scss +++ b/frontend/resources/styles/main/partials/sidebar.scss @@ -85,6 +85,15 @@ } } + span.library-title { + color: $color-gray-10; + font-size: $fs14; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .tool-window-bar-icon { height: 21px; display: flex; diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 8a09b22699..0f93bf5ac5 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -407,9 +407,9 @@ (defn- prepare-duplicate-shape-change ([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id] - (prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj))) + (prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj) false)) - ([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id] + ([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id duplicating-component?] (cond (nil? obj) changes @@ -423,8 +423,9 @@ parent-id (or parent-id frame-id) name (:name obj) - is-component-root? (:saved-component-root obj) - is-component-main? (:main-instance obj) + is-component-root? (or (:saved-component-root? obj) (ctk/instance-root? obj)) + duplicating-component? (or duplicating-component? is-component-root?) + is-component-main? (ctk/main-instance? obj) regenerate-component (fn [changes shape] (let [components-v2 (dm/get-in library-data [:options :components-v2]) @@ -437,20 +438,20 @@ :parent-id parent-id :frame-id frame-id) (dissoc :shapes - :main-instance - :shape-ref - :use-for-thumbnail) + :main-instance? + :use-for-thumbnail?) (gsh/move delta) (d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)) (cond-> (ctl/grid-layout? obj) (remap-grid-cells ids-map))) - changes (-> (pcb/add-object changes new-obj) - (pcb/amend-last-change #(assoc % :old-id (:id obj))) - (cond-> (ctl/grid-layout? objects (:parent-id obj)) - (-> (pcb/update-shapes [(:parent-id obj)] ctl/assign-cells) - (pcb/reorder-grid-children [(:parent-id obj)])))) + new-obj (cond-> new-obj + (not duplicating-component?) + (dissoc :shape-ref)) + + changes (-> (pcb/add-object changes new-obj {:ignore-touched duplicating-component?}) + (pcb/amend-last-change #(assoc % :old-id (:id obj)))) changes (cond-> changes (and is-component-root? is-component-main?) @@ -470,7 +471,8 @@ it file-id (if frame? new-id frame-id) - new-id)) + new-id + duplicating-component?)) changes (map (d/getf objects) (:shapes obj))))))) diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index eea3ec6c81..2f002f7c94 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -627,6 +627,18 @@ (rx/of (update-text-attrs {:id id :attrs attrs})) (rx/empty))))))) +(defn update-all-attrs + [ids attrs] + (ptk/reify ::update-all-attrs + ptk/WatchEvent + (watch [_ _ _] + (let [undo-id (js/Symbol)] + (rx/concat + (rx/of (dwu/start-undo-transaction undo-id)) + (->> (rx/from ids) + (rx/map #(update-attrs % attrs))) + (rx/of (dwu/commit-undo-transaction undo-id))))))) + (defn apply-typography "A higher level event that has the resposability of to apply the diff --git a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs index df8174edcc..c229993fda 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs @@ -130,11 +130,13 @@ (mf/use-callback (mf/deps shape state) (fn [event] - (dom/stop-propagation event) - (dom/prevent-default event) - (st/emit! ::dwt/finalize-editor-state) - (st/emit! (dwt/initialize-editor-state shape default-decorator)) - (reset! blurred true))) + (let [is-empty? (ted/is-current-empty state)] + (dom/stop-propagation event) + (dom/prevent-default event) + (when (not is-empty?) + (st/emit! ::dwt/finalize-editor-state) + (st/emit! (dwt/initialize-editor-state shape default-decorator))) + (reset! blurred true)))) on-focus (mf/use-callback diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs index 0a1c8121ef..b47e9247eb 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets/file_library.cljs @@ -78,11 +78,11 @@ (if local? [:* - [:span file-name " (" (tr "workspace.assets.local-library") ")"] + [:span.library-title file-name " (" (tr "workspace.assets.local-library") ")"] (when shared? [:span.tool-badge (tr "workspace.assets.shared")])] [:* - [:span file-name] + [:span.library-title file-name] [:span.tool-link.tooltip.tooltip-left {:alt "Open library file"} [:a {:href (str "#" url) :target "_blank" diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs index e373bb79af..a7f85fe0ff 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs @@ -172,16 +172,16 @@ emit-update! (mf/use-callback (mf/deps values) - (fn [id attrs] - (st/emit! (dwt/save-font (-> (merge txt/default-text-attrs values attrs) - (select-keys dwt/text-attrs))) - (dwt/update-attrs id attrs)))) + (fn [ids attrs] + (st/emit! (dwt/save-font (-> (merge txt/default-text-attrs values attrs) + (select-keys dwt/text-attrs))) + (dwt/update-all-attrs ids attrs)))) on-change (mf/use-callback (mf/deps ids emit-update!) (fn [attrs] - (run! #(emit-update! % attrs) ids))) + (emit-update! ids attrs))) typography (mf/use-memo @@ -211,8 +211,9 @@ typography (dwt/generate-typography-name typography) id (uuid/next)] (st/emit! (dwl/add-typography (assoc typography :id id) false)) - (run! #(emit-update! % {:typography-ref-id id - :typography-ref-file file-id}) ids))) + (emit-update! ids + {:typography-ref-id id + :typography-ref-file file-id}))) handle-detach-typography (mf/use-callback diff --git a/frontend/src/app/util/text_editor.cljs b/frontend/src/app/util/text_editor.cljs index 42708f63f4..a6cedcce8a 100644 --- a/frontend/src/app/util/text_editor.cljs +++ b/frontend/src/app/util/text_editor.cljs @@ -73,6 +73,10 @@ (let [block (impl/getCurrentBlock state)] (get-editor-block-data block))) +(defn is-current-empty + [state] + (impl/isCurrentEmpty state)) + (defn get-editor-current-inline-styles [state] (if (impl/isCurrentEmpty state)