mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 23:56:10 +02:00
✨ Improve event registry.
This commit is contained in:
parent
b5b97f7626
commit
926fa483b9
25 changed files with 245 additions and 93 deletions
|
@ -7,10 +7,13 @@
|
|||
(ns app.main.ui.viewer.handoff.code
|
||||
(:require
|
||||
["js-beautify" :as beautify]
|
||||
[app.main.data.events :as ev]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.ui.components.code-block :refer [code-block]]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.main.ui.icons :as i]
|
||||
[app.main.store :as st]
|
||||
[potok.core :as ptk]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.util.dom :as dom]
|
||||
[cuerdas.core :as str]
|
||||
|
@ -48,7 +51,25 @@
|
|||
(format-code "css"))
|
||||
|
||||
markup-code (-> (mf/use-memo (mf/deps shapes) #(generate-markup-code @markup-type shapes))
|
||||
(format-code "svg"))]
|
||||
(format-code "svg"))
|
||||
|
||||
on-markup-copied
|
||||
(mf/use-callback
|
||||
(mf/deps @markup-type)
|
||||
(fn []
|
||||
(st/emit! (ptk/event ::ev/event
|
||||
{::ev/name "copy-handoff-code"
|
||||
:type @markup-type}))))
|
||||
|
||||
on-style-copied
|
||||
(mf/use-callback
|
||||
(mf/deps @style-type)
|
||||
(fn []
|
||||
(st/emit! (ptk/event ::ev/event
|
||||
{::ev/name "copy-handoff-style"
|
||||
:type @style-type}))))
|
||||
]
|
||||
|
||||
[:div.element-options
|
||||
[:div.code-block
|
||||
[:div.code-row-lang
|
||||
|
@ -62,7 +83,8 @@
|
|||
{:on-click on-expand }
|
||||
i/full-screen]
|
||||
|
||||
[:& copy-button { :data style-code }]]
|
||||
[:& copy-button {:data style-code
|
||||
:on-copied on-style-copied}]]
|
||||
|
||||
[:div.code-row-display
|
||||
[:& code-block {:type @style-type
|
||||
|
@ -78,8 +100,8 @@
|
|||
{:on-click on-expand}
|
||||
i/full-screen]
|
||||
|
||||
[:& copy-button { :data markup-code }]]
|
||||
|
||||
[:& copy-button {:data markup-code
|
||||
:on-copied on-markup-copied}]]
|
||||
[:div.code-row-display
|
||||
[:& code-block {:type @markup-type
|
||||
:code markup-code}]]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue