mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 01:46:35 +00:00
Lazy load code-editor.js
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
(ns frontend.extensions.code
|
||||
(:require [rum.core :as rum]
|
||||
[frontend.loader :as loader]
|
||||
[frontend.config :as config]
|
||||
[frontend.util :as util]
|
||||
[frontend.mixins :as mixins]
|
||||
@@ -44,22 +43,6 @@
|
||||
|
||||
(def from-text-area (gobj/get cm "fromTextArea"))
|
||||
|
||||
(defn highlight!
|
||||
[state]
|
||||
(let [[id attr] (:rum/args state)]
|
||||
(when (:data-lang attr)
|
||||
(when-let [element (js/document.getElementById id)]
|
||||
(js/hljs.highlightBlock element)))))
|
||||
|
||||
(rum/defcs highlight < rum/reactive
|
||||
{:did-mount (fn [state]
|
||||
(highlight! state)
|
||||
state)}
|
||||
[state id attr code]
|
||||
[:pre.code.pre-wrap-white-space
|
||||
[:code (assoc attr :id id)
|
||||
code]])
|
||||
|
||||
(defn render!
|
||||
[state]
|
||||
(let [[config id attr] (:rum/args state)
|
||||
@@ -123,9 +106,3 @@
|
||||
(get attr :data-lang "javascript")]
|
||||
[:textarea (merge {:id id
|
||||
:default-value code} attr)]])
|
||||
|
||||
(defn html-export
|
||||
[attr code]
|
||||
[:pre.pre-wrap-white-space
|
||||
[:code attr
|
||||
code]])
|
||||
|
||||
Reference in New Issue
Block a user