diff --git a/CHANGES.md b/CHANGES.md index c19cf16e7..e901bdacf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,20 @@ ### :heart: Community contributions by (Thank you!) +## 1.19.2 + +### :sparkles: New features + +- Navigate up in layer hierarchy with Shift+Enter shortcut [Taiga #5734](https://tree.taiga.io/project/penpot/us/5734) +- Click on the flow tags open viewer with the selected frame [Taiga #5044](https://tree.taiga.io/project/penpot/us/5044) + +### :bug: Bugs fixed + +- Fix unexpected output on get-page rpc method when invalid object-id is provided [Github #3546](https://github.com/penpot/penpot/issues/3546) +- Fix Invalid files amount after moving file from Project to Drafts [Taiga #5638](https://tree.taiga.io/project/penpot/us/5638) +- Fix deleted pages comments shown in right sidebar [Taiga #5648](https://tree.taiga.io/project/penpot/us/5648) +- Fix tooltip on toggle visibility and toggle lock buttons [Taiga #5141](https://tree.taiga.io/project/penpot/issue/5141) + ## 1.19.1 ### :bug: Bugs fixed diff --git a/backend/src/app/rpc/commands/files.clj b/backend/src/app/rpc/commands/files.clj index d91b04431..71913cb40 100644 --- a/backend/src/app/rpc/commands/files.clj +++ b/backend/src/app/rpc/commands/files.clj @@ -510,7 +510,8 @@ other not needed objects removed from the `:objects` data structure." [{:keys [objects] :as page} object-id] - (let [objects (cph/get-children-with-self objects object-id)] + (let [objects (->> (cph/get-children-with-self objects object-id) + (filter some?))] (assoc page :objects (d/index-by :id objects)))) (defn- prune-thumbnails diff --git a/frontend/resources/styles/main/partials/sidebar-interactions.scss b/frontend/resources/styles/main/partials/sidebar-interactions.scss index 8c164535c..77c39c9a9 100644 --- a/frontend/resources/styles/main/partials/sidebar-interactions.scss +++ b/frontend/resources/styles/main/partials/sidebar-interactions.scss @@ -176,6 +176,7 @@ } .flow-badge { + cursor: pointer; display: flex; & .content { @@ -199,7 +200,8 @@ } } - &.selected .content { + &.selected .content, + &:hover .content { background-color: $color-primary; & svg { diff --git a/frontend/src/app/main/data/comments.cljs b/frontend/src/app/main/data/comments.cljs index 46bf3c752..4ea5796be 100644 --- a/frontend/src/app/main/data/comments.cljs +++ b/frontend/src/app/main/data/comments.cljs @@ -279,7 +279,9 @@ (assoc-in (conj path :position) (:position comment-thread)) (assoc-in (conj path :frame-id) (:frame-id comment-thread)))))) (fetched [[users comments] state] - (let [state (-> state + (let [pages (get-in state [:workspace-data :pages-index]) + comments (filter #(some? (get pages (:page-id %))) comments) + state (-> state (assoc :comment-threads (d/index-by :id comments)) (update :current-file-comments-users merge (d/index-by :id users)))] (reduce set-comment-threds state comments)))] diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index 3c049c2f7..73a7d5fc2 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -891,13 +891,13 @@ ptk/UpdateEvent (update [_ state] (let [origin-project (get-in state [:dashboard-files (first ids) :project-id]) - update-project (fn [project delta] + update-project (fn [project delta op] (-> project - (update :count #(+ % (count ids))) + (update :count #(op % (count ids))) (assoc :modified-at (dt/plus (dt/now) {:milliseconds delta}))))] (-> state - (d/update-in-when [:dashboard-projects origin-project] update-project 0) - (d/update-in-when [:dashboard-projects project-id] update-project 10)))) + (d/update-in-when [:dashboard-projects origin-project] update-project 0 -) + (d/update-in-when [:dashboard-projects project-id] update-project 10 +)))) ptk/WatchEvent (watch [_ _ _] diff --git a/frontend/src/app/main/data/viewer.cljs b/frontend/src/app/main/data/viewer.cljs index 40df6b66c..68e958aa1 100644 --- a/frontend/src/app/main/data/viewer.cljs +++ b/frontend/src/app/main/data/viewer.cljs @@ -155,6 +155,8 @@ (rx/of (df/fonts-fetched fonts) (bundle-fetched (merge bundle params)))))))))) +(declare go-to-frame) +(declare go-to-frame-by-index) (declare go-to-frame-auto) (defn bundle-fetched @@ -182,16 +184,20 @@ ptk/WatchEvent (watch [_ state _] - (let [route (:route state) - qparams (:query-params route) - index (:index qparams)] + (let [route (:route state) + qparams (:query-params route) + index (:index qparams) + frame-id (:frame-id qparams)] (rx/merge (rx/of (case (:zoom qparams) "fit" zoom-to-fit "fill" zoom-to-fill nil)) - (when (nil? index) - (rx/of (go-to-frame-auto))))))))) + (rx/of + (cond + (some? frame-id) (go-to-frame (uuid frame-id)) + (some? index) (go-to-frame-by-index index) + :else (go-to-frame-auto))))))))) (defn fetch-comment-threads [{:keys [file-id page-id share-id] :as params}] diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 56e86578c..431c1bfd5 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1002,6 +1002,23 @@ (rx/of (dwe/start-edition-mode id) (dwdp/start-path-edit id))))))))) +(defn select-parent-layer + [] + (ptk/reify ::select-parent-layer + ptk/WatchEvent + (watch [_ state _] + (let [selected (wsh/lookup-selected state) + objects (wsh/lookup-page-objects state) + shapes-to-select + (->> selected + (reduce + (fn [result shape-id] + (let [parent-id (dm/get-in objects [shape-id :parent-id])] + (if (and (some? parent-id) (not= parent-id uuid/zero)) + (conj result parent-id) + (conj result shape-id)))) + (d/ordered-set)))] + (rx/of (dws/select-shapes shapes-to-select)))))) ;; --- Change Page Order (D&D Ordering) @@ -1114,7 +1131,7 @@ (defn toggle-proportion-lock [] - (ptk/reify ::toggle-propotion-lock + (ptk/reify ::toggle-proportion-lock ptk/WatchEvent (watch [_ state _] (let [page-id (:current-page-id state) @@ -1371,7 +1388,7 @@ (defn go-to-viewer ([] (go-to-viewer {})) - ([{:keys [file-id page-id section]}] + ([{:keys [file-id page-id section frame-id]}] (ptk/reify ::go-to-viewer ptk/WatchEvent (watch [_ state _] @@ -1379,7 +1396,9 @@ pparams {:file-id (or file-id current-file-id)} qparams (cond-> {:page-id (or page-id current-page-id)} (some? section) - (assoc :section section))] + (assoc :section section) + (some? frame-id) + (assoc :frame-id frame-id))] (rx/of ::dwp/force-persist (rt/nav-new-window* {:rname :viewer :path-params pparams diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index 6f2bb6c50..77106939e 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -284,8 +284,8 @@ :subsections [:tools] :fn #(emit-when-no-readonly (dw/toggle-lock-selected))} - :toggle-lock-size {:tooltip (ds/meta (ds/alt "L")) - :command (ds/c-mod "alt+l") + :toggle-lock-size {:tooltip (ds/shift "L") + :command "shift+l" :subsections [:tools] :fn #(emit-when-no-readonly (dw/toggle-proportion-lock))} @@ -514,6 +514,10 @@ :subsections [:navigation-workspace] :fn #(st/emit! (dw/select-next-shape))} + :select-parent-layer {:tooltip (ds/shift ds/enter) + :command "shift+enter" + :subsections [:navigation-workspace] + :fn #(emit-when-no-readonly (dw/select-parent-layer))} ;; SHAPE diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index ec5288f6f..9dca64ce6 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -109,7 +109,7 @@ :viewer (let [{:keys [query-params path-params]} route - {:keys [index share-id section page-id interactions-mode] :or {section :interactions interactions-mode :show-on-click}} query-params + {:keys [index share-id section page-id interactions-mode frame-id] :or {section :interactions interactions-mode :show-on-click}} query-params {:keys [file-id]} path-params] (if (:token query-params) [:& viewer/breaking-change-notice] @@ -122,7 +122,8 @@ :interactions-show? (case (keyword interactions-mode) :hide false :show true - :show-on-click false)}])) + :show-on-click false) + :frame-id frame-id}])) :workspace (let [project-id (some-> params :path :project-id uuid) diff --git a/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs b/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs index 781f1b3ad..34470d0d2 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/layer_item.cljs @@ -23,6 +23,7 @@ [app.main.ui.icons :as i] [app.main.ui.workspace.sidebar.layer-name :refer [layer-name]] [app.util.dom :as dom] + [app.util.i18n :refer [tr]] [app.util.keyboard :as kbd] [app.util.timers :as ts] [beicon.core :as rx] @@ -191,6 +192,7 @@ ;; seek for an alternate solution. Maybe use-context? scroll-node (dom/get-parent-with-data node "scrollContainer") parent-node (dom/get-parent-at node 2) + first-child-node (dom/get-first-child parent-node) subid (when (and single? selected?) @@ -200,9 +202,9 @@ #(let [scroll-distance-ratio (dom/get-scroll-distance-ratio node scroll-node) scroll-behavior (if (> scroll-distance-ratio 1) "instant" "smooth")] (if scroll-to - (dom/scroll-into-view! parent-node #js {:block "center" :behavior scroll-behavior :inline "start"}) + (dom/scroll-into-view! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"}) (do - (dom/scroll-into-view-if-needed! parent-node #js {:block "center" :behavior scroll-behavior :inline "start"}) + (dom/scroll-into-view-if-needed! first-child-node #js {:block "center" :behavior scroll-behavior :inline "start"}) (reset! scroll-to-middle? true)))))))] #(when (some? subid) @@ -291,11 +293,17 @@ [:button {:class (stl/css-case :toggle-element true :selected hidden?) + :title (if hidden? + (tr "workspace.shape.menu.show") + (tr "workspace.shape.menu.hide")) :on-click toggle-visibility} (if ^boolean hidden? i/hide-refactor i/shown-refactor)] [:button {:class (stl/css-case :block-element true :selected blocked?) + :title (if (:blocked item) + (tr "workspace.shape.menu.unlock") + (tr "workspace.shape.menu.lock")) :on-click toggle-blocking} (if ^boolean blocked? i/lock-refactor i/unlock-refactor)]]]] diff --git a/frontend/src/app/main/ui/workspace/viewport/widgets.cljs b/frontend/src/app/main/ui/workspace/viewport/widgets.cljs index 6b069c16e..53f56fedc 100644 --- a/frontend/src/app/main/ui/workspace/viewport/widgets.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/widgets.cljs @@ -261,11 +261,13 @@ (mf/use-callback (mf/deps (:id frame) on-frame-select) (fn [bevent] - (let [event (.-nativeEvent bevent)] + (let [event (.-nativeEvent bevent) + params {:section "interactions" + :frame-id (:id frame)}] (when (= 1 (.-which event)) (dom/prevent-default event) (dom/stop-propagation event) - (on-frame-select event (:id frame)))))) + (st/emit! (dw/go-to-viewer params)))))) on-double-click (mf/use-callback diff --git a/frontend/translations/en.po b/frontend/translations/en.po index f371267ff..3bdb74053 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -2703,6 +2703,9 @@ msgstr "Snap to pixel grid" msgid "shortcuts.start-editing" msgstr "Start editing" +msgid "shortcuts.select-parent-layer" +msgstr "Select parent layer" + msgid "shortcuts.start-measure" msgstr "Start measurement" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 331d79b90..1b4cc403a 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -2778,6 +2778,9 @@ msgstr "Activar alineación a rejilla de pixel" msgid "shortcuts.start-editing" msgstr "Comenzar edición" +msgid "shortcuts.select-parent-layer" +msgstr "Seleccionar capa padre" + msgid "shortcuts.start-measure" msgstr "Comenzar medida"