mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
Add behavior to the view
button on workspace.
This commit is contained in:
parent
dc6391c1db
commit
c5b93a3a61
1 changed files with 13 additions and 6 deletions
|
@ -9,6 +9,7 @@
|
||||||
(:require [sablono.core :as html :refer-macros [html]]
|
(:require [sablono.core :as html :refer-macros [html]]
|
||||||
[rum.core :as rum]
|
[rum.core :as rum]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
|
[uxbox.config :as cfg]
|
||||||
[uxbox.util.router :as r]
|
[uxbox.util.router :as r]
|
||||||
[uxbox.util.rstore :as rs]
|
[uxbox.util.rstore :as rs]
|
||||||
[uxbox.main.data.workspace :as dw]
|
[uxbox.main.data.workspace :as dw]
|
||||||
|
@ -68,16 +69,21 @@
|
||||||
url (.createObjectURL (.-URL js/window) data)]
|
url (.createObjectURL (.-URL js/window) data)]
|
||||||
(set! (.-href (.-currentTarget event)) url)))
|
(set! (.-href (.-currentTarget event)) url)))
|
||||||
|
|
||||||
|
(defn on-view-clicked
|
||||||
|
[event project page]
|
||||||
|
(let [url (str cfg/viewurl "#/" (:share-token project))]
|
||||||
|
(js/open url "new tab" "")
|
||||||
|
#_(set! (.-href js/location) url)))
|
||||||
|
|
||||||
(defn header-render
|
(defn header-render
|
||||||
[own]
|
[own]
|
||||||
(let [page (mx/react wb/page-ref)
|
(let [project (mx/react wb/project-ref)
|
||||||
|
page (mx/react wb/page-ref)
|
||||||
flags (mx/react wb/flags-ref)
|
flags (mx/react wb/flags-ref)
|
||||||
toggle #(rs/emit! (dw/toggle-flag %))
|
toggle #(rs/emit! (dw/toggle-flag %))
|
||||||
on-undo #(rs/emit! (udh/backwards-to-previous-version))
|
on-undo #(rs/emit! (udh/backwards-to-previous-version))
|
||||||
on-redo #(rs/emit! (udh/forward-to-next-version))
|
on-redo #(rs/emit! (udh/forward-to-next-version))
|
||||||
on-image #(udl/open! :new-image)
|
on-image #(udl/open! :new-image)]
|
||||||
;; TODO: temporary
|
|
||||||
open-confirm-dialog #(udl/open! :confirm)]
|
|
||||||
(html
|
(html
|
||||||
[:header#workspace-bar.workspace-bar
|
[:header#workspace-bar.workspace-bar
|
||||||
[:div.main-icon
|
[:div.main-icon
|
||||||
|
@ -155,7 +161,8 @@
|
||||||
i/alignment]]
|
i/alignment]]
|
||||||
[:ul.options-btn
|
[:ul.options-btn
|
||||||
[:li.tooltip.tooltip-bottom
|
[:li.tooltip.tooltip-bottom
|
||||||
{:alt "View mode (Ctrl + P)"}
|
{:alt "View mode (Ctrl + P)"
|
||||||
|
:on-click #(on-view-clicked % project page)}
|
||||||
i/play]]
|
i/play]]
|
||||||
(coordinates)]
|
(coordinates)]
|
||||||
(ui.u/user)])))
|
(ui.u/user)])))
|
||||||
|
@ -164,4 +171,4 @@
|
||||||
(mx/component
|
(mx/component
|
||||||
{:render header-render
|
{:render header-render
|
||||||
:name "workspace-header"
|
:name "workspace-header"
|
||||||
:mixins [mx/reactive]}))
|
:mixins [mx/static mx/reactive]}))
|
||||||
|
|
Loading…
Reference in a new issue