mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 11:31:37 +02:00
✨ Click on flow tag open viewer
This commit is contained in:
parent
ff14208a95
commit
8669207086
6 changed files with 26 additions and 12 deletions
|
@ -5,6 +5,7 @@
|
||||||
### :sparkles: New features
|
### :sparkles: New features
|
||||||
|
|
||||||
- Navigate up in layer hierarchy with Shift+Enter shortcut [Taiga #5734](https://tree.taiga.io/project/penpot/us/5734)
|
- 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)
|
||||||
|
|
||||||
## 1.19.1
|
## 1.19.1
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.flow-badge {
|
.flow-badge {
|
||||||
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
& .content {
|
& .content {
|
||||||
|
@ -199,7 +200,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selected .content {
|
&.selected .content,
|
||||||
|
&:hover .content {
|
||||||
background-color: $color-primary;
|
background-color: $color-primary;
|
||||||
|
|
||||||
& svg {
|
& svg {
|
||||||
|
|
|
@ -155,6 +155,8 @@
|
||||||
(rx/of (df/fonts-fetched fonts)
|
(rx/of (df/fonts-fetched fonts)
|
||||||
(bundle-fetched (merge bundle params))))))))))
|
(bundle-fetched (merge bundle params))))))))))
|
||||||
|
|
||||||
|
(declare go-to-frame)
|
||||||
|
(declare go-to-frame-by-index)
|
||||||
(declare go-to-frame-auto)
|
(declare go-to-frame-auto)
|
||||||
|
|
||||||
(defn bundle-fetched
|
(defn bundle-fetched
|
||||||
|
@ -182,16 +184,20 @@
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [route (:route state)
|
(let [route (:route state)
|
||||||
qparams (:query-params route)
|
qparams (:query-params route)
|
||||||
index (:index qparams)]
|
index (:index qparams)
|
||||||
|
frame-id (:frame-id qparams)]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (case (:zoom qparams)
|
(rx/of (case (:zoom qparams)
|
||||||
"fit" zoom-to-fit
|
"fit" zoom-to-fit
|
||||||
"fill" zoom-to-fill
|
"fill" zoom-to-fill
|
||||||
nil))
|
nil))
|
||||||
(when (nil? index)
|
(rx/of
|
||||||
(rx/of (go-to-frame-auto)))))))))
|
(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
|
(defn fetch-comment-threads
|
||||||
[{:keys [file-id page-id share-id] :as params}]
|
[{:keys [file-id page-id share-id] :as params}]
|
||||||
|
|
|
@ -1376,7 +1376,7 @@
|
||||||
|
|
||||||
(defn go-to-viewer
|
(defn go-to-viewer
|
||||||
([] (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/reify ::go-to-viewer
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
|
@ -1384,7 +1384,9 @@
|
||||||
pparams {:file-id (or file-id current-file-id)}
|
pparams {:file-id (or file-id current-file-id)}
|
||||||
qparams (cond-> {:page-id (or page-id current-page-id)}
|
qparams (cond-> {:page-id (or page-id current-page-id)}
|
||||||
(some? section)
|
(some? section)
|
||||||
(assoc :section section))]
|
(assoc :section section)
|
||||||
|
(some? frame-id)
|
||||||
|
(assoc :frame-id frame-id))]
|
||||||
(rx/of ::dwp/force-persist
|
(rx/of ::dwp/force-persist
|
||||||
(rt/nav-new-window* {:rname :viewer
|
(rt/nav-new-window* {:rname :viewer
|
||||||
:path-params pparams
|
:path-params pparams
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
:viewer
|
:viewer
|
||||||
(let [{:keys [query-params path-params]} route
|
(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]
|
{:keys [file-id]} path-params]
|
||||||
(if (:token query-params)
|
(if (:token query-params)
|
||||||
[:& viewer/breaking-change-notice]
|
[:& viewer/breaking-change-notice]
|
||||||
|
@ -119,7 +119,8 @@
|
||||||
:interactions-show? (case (keyword interactions-mode)
|
:interactions-show? (case (keyword interactions-mode)
|
||||||
:hide false
|
:hide false
|
||||||
:show true
|
:show true
|
||||||
:show-on-click false)}]))
|
:show-on-click false)
|
||||||
|
:frame-id frame-id}]))
|
||||||
|
|
||||||
:workspace
|
:workspace
|
||||||
(let [project-id (some-> params :path :project-id uuid)
|
(let [project-id (some-> params :path :project-id uuid)
|
||||||
|
|
|
@ -222,11 +222,13 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps (:id frame) on-frame-select)
|
(mf/deps (:id frame) on-frame-select)
|
||||||
(fn [bevent]
|
(fn [bevent]
|
||||||
(let [event (.-nativeEvent bevent)]
|
(let [event (.-nativeEvent bevent)
|
||||||
|
params {:section "interactions"
|
||||||
|
:frame-id (:id frame)}]
|
||||||
(when (= 1 (.-which event))
|
(when (= 1 (.-which event))
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(on-frame-select event (:id frame))))))
|
(st/emit! (dw/go-to-viewer params))))))
|
||||||
|
|
||||||
on-double-click
|
on-double-click
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue