mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
Refactor/names (#190)
* refactor: rename frontend.components.hiccup to block * refactor: rename v1,v2 to fst-block-text, snd-block-text
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@
|
||||
[frontend.state :as state]
|
||||
[clojure.string :as string]
|
||||
[frontend.db :as db]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.ui :as ui]
|
||||
[frontend.format :as format]
|
||||
[frontend.format.mldoc :as mldoc]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
[frontend.ui :as ui]
|
||||
[frontend.format :as format]
|
||||
[frontend.components.content :as content]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.components.block :as block]
|
||||
[frontend.components.editor :as editor]
|
||||
[frontend.components.reference :as reference]
|
||||
[frontend.components.page :as page]
|
||||
@@ -47,11 +47,11 @@
|
||||
(let [start-level (or (:block/level (first blocks)) 1)]
|
||||
(content/content
|
||||
encoded-page-name
|
||||
{:hiccup (hiccup/->hiccup blocks
|
||||
{:id encoded-page-name
|
||||
:start-level 2
|
||||
:editor-box editor/box}
|
||||
{})})))
|
||||
{:hiccup (block/->hiccup blocks
|
||||
{:id encoded-page-name
|
||||
:start-level 2
|
||||
:editor-box editor/box}
|
||||
{})})))
|
||||
|
||||
(rum/defc blocks-cp < rum/reactive db-mixins/query
|
||||
{}
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
[clojure.string :as string]
|
||||
[frontend.db :as db]
|
||||
[dommy.core :as d]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.components.editor :as editor]
|
||||
[frontend.components.block :as block]
|
||||
[frontend.components.editor :as editor]
|
||||
[frontend.components.reference :as reference]
|
||||
[frontend.components.svg :as svg]
|
||||
[frontend.extensions.graph-2d :as graph-2d]
|
||||
@@ -73,7 +72,7 @@
|
||||
:sidebar? sidebar?
|
||||
:block? block?
|
||||
:editor-box editor/box}
|
||||
hiccup (hiccup/->hiccup page-blocks hiccup-config {})]
|
||||
hiccup (block/->hiccup page-blocks hiccup-config {})]
|
||||
(rum/with-key
|
||||
(content/content encoded-page-name
|
||||
{:hiccup hiccup
|
||||
@@ -108,9 +107,9 @@
|
||||
[:div#today-queries.mt-10
|
||||
(for [{:keys [title] :as query} queries]
|
||||
(rum/with-key
|
||||
(hiccup/custom-query {:start-level 2
|
||||
:attr {:class "mt-10"}
|
||||
:editor-box editor/box} query)
|
||||
(block/custom-query {:start-level 2
|
||||
:attr {:class "mt-10"}
|
||||
:editor-box editor/box} query)
|
||||
(str repo "-custom-query-" (:query query))))]))))
|
||||
|
||||
(defn- delete-page!
|
||||
@@ -340,7 +339,7 @@
|
||||
(if (and (string/includes? page-original-name "[[")
|
||||
(string/includes? page-original-name "]]"))
|
||||
(let [ast (mldoc/->edn page-original-name (mldoc/default-config format))]
|
||||
(hiccup/block-cp {} (ffirst ast)))
|
||||
(block/markup-element-cp {} (ffirst ast)))
|
||||
page-original-name)
|
||||
(or
|
||||
page-name
|
||||
@@ -454,16 +453,16 @@
|
||||
(let [encoded-page (util/encode-str page)]
|
||||
[:tr {:key encoded-page}
|
||||
[:td [:a {:on-click (fn [e]
|
||||
(util/stop e)
|
||||
(let [repo (state/get-current-repo)
|
||||
page (db/pull repo '[*] [:page/name (string/lower-case page)])]
|
||||
(when (gobj/get e "shiftKey")
|
||||
(state/sidebar-add-block!
|
||||
repo
|
||||
(:db/id page)
|
||||
:page
|
||||
{:page page}))))
|
||||
:href (rfe/href :page {:name encoded-page})}
|
||||
(util/stop e)
|
||||
(let [repo (state/get-current-repo)
|
||||
page (db/pull repo '[*] [:page/name (string/lower-case page)])]
|
||||
(when (gobj/get e "shiftKey")
|
||||
(state/sidebar-add-block!
|
||||
repo
|
||||
(:db/id page)
|
||||
:page
|
||||
{:page page}))))
|
||||
:href (rfe/href :page {:name encoded-page})}
|
||||
page]]
|
||||
[:td [:span.text-gray-500.text-sm
|
||||
(if (zero? modified-at)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
[frontend.state :as state]
|
||||
[clojure.string :as string]
|
||||
[frontend.db :as db]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.components.block :as block]
|
||||
[frontend.ui :as ui]
|
||||
[frontend.format :as format]
|
||||
[frontend.components.content :as content]
|
||||
@@ -48,13 +48,13 @@
|
||||
[:h2.font-bold.opacity-50 (let []
|
||||
"SCHEDULED AND DEADLINE")]
|
||||
[:div.references-blocks.mb-6
|
||||
(let [ref-hiccup (hiccup/->hiccup scheduled-or-deadlines
|
||||
{:id (str encoded-page-name "-agenda")
|
||||
:start-level 2
|
||||
:ref? true
|
||||
:group-by-page? true
|
||||
:editor-box editor/box}
|
||||
{})]
|
||||
(let [ref-hiccup (block/->hiccup scheduled-or-deadlines
|
||||
{:id (str encoded-page-name "-agenda")
|
||||
:start-level 2
|
||||
:ref? true
|
||||
:group-by-page? true
|
||||
:editor-box editor/box}
|
||||
{})]
|
||||
(content/content encoded-page-name
|
||||
{:hiccup ref-hiccup}))]))
|
||||
|
||||
@@ -62,13 +62,13 @@
|
||||
[:h2.font-bold.opacity-50 (let []
|
||||
(str n-ref " Linked References"))]
|
||||
[:div.references-blocks
|
||||
(let [ref-hiccup (hiccup/->hiccup ref-blocks
|
||||
{:id encoded-page-name
|
||||
:start-level 2
|
||||
:ref? true
|
||||
:group-by-page? true
|
||||
:editor-box editor/box}
|
||||
{})]
|
||||
(let [ref-hiccup (block/->hiccup ref-blocks
|
||||
{:id encoded-page-name
|
||||
:start-level 2
|
||||
:ref? true
|
||||
:group-by-page? true
|
||||
:editor-box editor/box}
|
||||
{})]
|
||||
(content/content encoded-page-name
|
||||
{:hiccup ref-hiccup}))])]]))))
|
||||
|
||||
@@ -78,13 +78,13 @@
|
||||
encoded-page-name (util/url-encode page-name)]
|
||||
(reset! n-ref (count ref-blocks))
|
||||
[:div.references-blocks
|
||||
(let [ref-hiccup (hiccup/->hiccup ref-blocks
|
||||
{:id (str encoded-page-name "-unlinked-")
|
||||
:start-level 2
|
||||
:ref? true
|
||||
:group-by-page? true
|
||||
:editor-box editor/box}
|
||||
{})]
|
||||
(let [ref-hiccup (block/->hiccup ref-blocks
|
||||
{:id (str encoded-page-name "-unlinked-")
|
||||
:start-level 2
|
||||
:ref? true
|
||||
:group-by-page? true
|
||||
:editor-box editor/box}
|
||||
{})]
|
||||
(content/content encoded-page-name
|
||||
{:hiccup ref-hiccup}))]))
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
[frontend.ui :as ui]
|
||||
[frontend.components.svg :as svg]
|
||||
[frontend.components.page :as page]
|
||||
[frontend.components.hiccup :as hiccup]
|
||||
[frontend.components.block :as block]
|
||||
[frontend.extensions.graph-2d :as graph-2d]
|
||||
[frontend.components.onboarding :as onboarding]
|
||||
@@ -150,10 +149,10 @@
|
||||
blocks (if journal?
|
||||
(rest blocks)
|
||||
blocks)
|
||||
sections (hiccup/build-slide-sections blocks {:id "slide-reveal-js"
|
||||
:start-level 2
|
||||
:slide? true
|
||||
:sidebar? true})]
|
||||
sections (block/build-slide-sections blocks {:id "slide-reveal-js"
|
||||
:start-level 2
|
||||
:slide? true
|
||||
:sidebar? true})]
|
||||
[[:a {:href (str "/page/" (util/url-encode page-name))}
|
||||
(util/capitalize-all page-name)]
|
||||
[:div.ml-2.slide.mt-2
|
||||
@@ -238,12 +237,12 @@
|
||||
[:div.flex.flex-row.mb-2 {:key "right-sidebar-settings"}
|
||||
[:div.mr-4.text-sm
|
||||
[:a.right-sidebar-button {:on-click (fn [e]
|
||||
(state/sidebar-add-block! repo "contents" :contents nil))}
|
||||
(state/sidebar-add-block! repo "contents" :contents nil))}
|
||||
(t :right-side-bar/contents)]]
|
||||
|
||||
[:div.mr-4.text-sm
|
||||
[:a.right-sidebar-button {:on-click (fn [_e]
|
||||
(state/sidebar-add-block! repo "recent" :recent nil))}
|
||||
(state/sidebar-add-block! repo "recent" :recent nil))}
|
||||
(t :right-side-bar/recent)]]
|
||||
|
||||
(when config/publishing?
|
||||
@@ -253,25 +252,25 @@
|
||||
|
||||
[:div.mr-4.text-sm
|
||||
[:a.right-sidebar-button {:on-click (fn []
|
||||
(when-let [page (get-current-page)]
|
||||
(state/sidebar-add-block!
|
||||
repo
|
||||
(str "page-graph-" page)
|
||||
:page-graph
|
||||
page)))}
|
||||
(when-let [page (get-current-page)]
|
||||
(state/sidebar-add-block!
|
||||
repo
|
||||
(str "page-graph-" page)
|
||||
:page-graph
|
||||
page)))}
|
||||
(t :right-side-bar/page)]]
|
||||
|
||||
[:div.mr-4.text-sm
|
||||
(let [theme (if dark? "white" "dark")]
|
||||
[:a.right-sidebar-button {:title (t :right-side-bar/switch-theme theme)
|
||||
:on-click (fn []
|
||||
(state/set-theme! theme))}
|
||||
:on-click (fn []
|
||||
(state/set-theme! theme))}
|
||||
(t :right-side-bar/theme (t (keyword theme)))])]
|
||||
|
||||
(when-not config/publishing?
|
||||
[:div.mr-4.text-sm
|
||||
[:a.right-sidebar-button {:on-click (fn [_e]
|
||||
(state/sidebar-add-block! repo "help" :help nil))}
|
||||
(state/sidebar-add-block! repo "help" :help nil))}
|
||||
(t :right-side-bar/help)]])]
|
||||
|
||||
(for [[idx [repo db-id block-type block-data]] (medley/indexed blocks)]
|
||||
|
||||
Reference in New Issue
Block a user