0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-09 21:41:23 -05:00

Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2023-08-29 13:25:51 +02:00
commit 1794ea0d9e
13 changed files with 88 additions and 23 deletions

View file

@ -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

View file

@ -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

View file

@ -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 {

View file

@ -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)))]

View file

@ -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 [_ _ _]

View file

@ -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}]

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)]]]]

View file

@ -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

View file

@ -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"

View file

@ -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"