mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 06:46:11 +02:00
💄 Update inspect tab in code area
This commit is contained in:
parent
82f0cc7cff
commit
dfe1022d7b
77 changed files with 2239 additions and 698 deletions
frontend/src/app/main/ui/components
|
@ -5,17 +5,21 @@
|
|||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns app.main.ui.components.code-block
|
||||
(:require-macros [app.main.style :as stl])
|
||||
(:require
|
||||
["highlight.js" :as hljs]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.main.ui.context :as ctx]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc code-block
|
||||
{::mf/wrap-props false}
|
||||
[{:keys [code type]}]
|
||||
(let [block-ref (mf/use-ref)]
|
||||
(let [new-css-system (mf/use-ctx ctx/new-css-system)
|
||||
block-ref (mf/use-ref)]
|
||||
(mf/with-effect [code type]
|
||||
(when-let [node (mf/ref-val block-ref)]
|
||||
(hljs/highlightElement node)))
|
||||
|
||||
[:pre.code-display {:class type :ref block-ref} code]))
|
||||
[:pre {:class (dm/str type " " (stl/css new-css-system :code-display)) :ref block-ref} code]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue