mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 07:29:08 -05:00
🐛 Fixed problems with preview
This commit is contained in:
parent
432a139f35
commit
f3477fefa5
3 changed files with 13 additions and 7 deletions
|
@ -29,7 +29,8 @@
|
||||||
(require 'app.services.mutations.colors)
|
(require 'app.services.mutations.colors)
|
||||||
(require 'app.services.mutations.projects)
|
(require 'app.services.mutations.projects)
|
||||||
(require 'app.services.mutations.files)
|
(require 'app.services.mutations.files)
|
||||||
(require 'app.services.mutations.profile))
|
(require 'app.services.mutations.profile)
|
||||||
|
(require 'app.services.mutations.viewer))
|
||||||
|
|
||||||
(defstate query-services
|
(defstate query-services
|
||||||
:start (load-query-services))
|
:start (load-query-services))
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
(vec))))
|
(vec))))
|
||||||
|
|
||||||
(defn bundle-fetched
|
(defn bundle-fetched
|
||||||
[{:keys [project file page] :as bundle}]
|
[{:keys [project file page share-token] :as bundle}]
|
||||||
(us/verify ::bundle bundle)
|
(us/verify ::bundle bundle)
|
||||||
(ptk/reify ::file-fetched
|
(ptk/reify ::file-fetched
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
|
@ -93,7 +93,8 @@
|
||||||
:objects objects
|
:objects objects
|
||||||
:file file
|
:file file
|
||||||
:page page
|
:page page
|
||||||
:frames frames})))))
|
:frames frames
|
||||||
|
:share-token share-token})))))
|
||||||
|
|
||||||
(def create-share-link
|
(def create-share-link
|
||||||
(ptk/reify ::create-share-link
|
(ptk/reify ::create-share-link
|
||||||
|
@ -101,8 +102,8 @@
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [file-id (get-in state [:viewer-local :file-id])
|
(let [file-id (get-in state [:viewer-local :file-id])
|
||||||
page-id (get-in state [:viewer-local :page-id])]
|
page-id (get-in state [:viewer-local :page-id])]
|
||||||
(->> (rp/mutation :create-file-share-token {:file-id file-id
|
(->> (rp/mutation! :create-file-share-token {:file-id file-id
|
||||||
:page-id page-id})
|
:page-id page-id})
|
||||||
(rx/map (fn [{:keys [token]}]
|
(rx/map (fn [{:keys [token]}]
|
||||||
#(assoc-in % [:viewer-data :share-token] token))))))))
|
#(assoc-in % [:viewer-data :share-token] token))))))))
|
||||||
|
|
||||||
|
@ -233,8 +234,10 @@
|
||||||
(let [page-id (get-in state [:viewer-local :page-id])
|
(let [page-id (get-in state [:viewer-local :page-id])
|
||||||
file-id (get-in state [:viewer-local :file-id])
|
file-id (get-in state [:viewer-local :file-id])
|
||||||
frames (get-in state [:viewer-data :frames])
|
frames (get-in state [:viewer-data :frames])
|
||||||
|
share-token (get-in state [:viewer-data :share-token])
|
||||||
index (d/index-of-pred frames #(= (:id %) frame-id))]
|
index (d/index-of-pred frames #(= (:id %) frame-id))]
|
||||||
(rx/of (rt/nav :viewer {:page-id page-id :file-id file-id} {:index index}))))))
|
(rx/of (rt/nav :viewer {:page-id page-id :file-id file-id} {:token share-token
|
||||||
|
:index index}))))))
|
||||||
|
|
||||||
;; --- Shortcuts
|
;; --- Shortcuts
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
(ns app.main.ui.viewer.header
|
(ns app.main.ui.viewer.header
|
||||||
(:require
|
(:require
|
||||||
[rumext.alpha :as mf]
|
[rumext.alpha :as mf]
|
||||||
|
[cuerdas.core :as str]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.main.data.messages :as dm]
|
[app.main.data.messages :as dm]
|
||||||
[app.main.data.viewer :as dv]
|
[app.main.data.viewer :as dv]
|
||||||
|
@ -84,7 +85,8 @@
|
||||||
delete #(st/emit! dv/delete-share-link)
|
delete #(st/emit! dv/delete-share-link)
|
||||||
|
|
||||||
href (.-href js/location)
|
href (.-href js/location)
|
||||||
link (str href "&token=" token)
|
href (subs href 0 (str/index-of href "?"))
|
||||||
|
link (str href "?token=" token "&index=0")
|
||||||
|
|
||||||
copy-link
|
copy-link
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
|
Loading…
Add table
Reference in a new issue