mirror of https://github.com/logseq/logseq
parent
223b62de28
commit
ef7e3d2fa4
|
@ -2716,7 +2716,7 @@
|
||||||
edit? (state/sub [:editor/editing? edit-input-id])
|
edit? (state/sub [:editor/editing? edit-input-id])
|
||||||
card? (string/includes? data-refs-self "\"card\"")
|
card? (string/includes? data-refs-self "\"card\"")
|
||||||
review-cards? (:review-cards? config)
|
review-cards? (:review-cards? config)
|
||||||
selected? (state/sub-block-selected? uuid)]
|
selected? (when-not slide? (state/sub-block-selected? uuid))]
|
||||||
[:div.ls-block
|
[:div.ls-block
|
||||||
(cond->
|
(cond->
|
||||||
{:id block-id
|
{:id block-id
|
||||||
|
@ -2728,7 +2728,7 @@
|
||||||
(when (and card? (not review-cards?)) " shadow-md")
|
(when (and card? (not review-cards?)) " shadow-md")
|
||||||
(when selected? " selected noselect"))
|
(when selected? " selected noselect"))
|
||||||
:blockid (str uuid)
|
:blockid (str uuid)
|
||||||
:haschild (str has-child?)}
|
:haschild (str (boolean has-child?))}
|
||||||
|
|
||||||
level
|
level
|
||||||
(assoc :level level)
|
(assoc :level level)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
[cljs-bean.core :as bean]
|
[cljs-bean.core :as bean]
|
||||||
[frontend.loader :as loader]
|
[frontend.loader :as loader]
|
||||||
[frontend.ui :as ui]
|
[frontend.ui :as ui]
|
||||||
|
[frontend.util :as util]
|
||||||
[frontend.config :as config]
|
[frontend.config :as config]
|
||||||
[frontend.components.block :as block]
|
[frontend.components.block :as block]
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
|
@ -37,17 +38,17 @@
|
||||||
:controls true
|
:controls true
|
||||||
:history false
|
:history false
|
||||||
:center true
|
:center true
|
||||||
:transition "slide"}))]
|
:transition "slide"
|
||||||
|
:keyboardCondition "focused"}))]
|
||||||
(.initialize deck)))
|
(.initialize deck)))
|
||||||
|
|
||||||
;; reveal.js doesn't support multiple nested sections yet.
|
;; reveal.js doesn't support multiple nested sections yet.
|
||||||
;; https://github.com/hakimel/reveal.js/issues/1440
|
;; https://github.com/hakimel/reveal.js/issues/1440
|
||||||
(rum/defc block-container
|
(rum/defc block-container
|
||||||
[config block level]
|
[config block level]
|
||||||
(let [deep-level? (>= level 2)
|
(let [children (:block/children block)
|
||||||
children (:block/children block)
|
|
||||||
has-children? (seq children)
|
has-children? (seq children)
|
||||||
children (when (and has-children? (not deep-level?))
|
children (when has-children?
|
||||||
(map (fn [block]
|
(map (fn [block]
|
||||||
(block-container config block (inc level))) children))
|
(block-container config block (inc level))) children))
|
||||||
block-el (block/block-container config (dissoc block :block/children))
|
block-el (block/block-container config (dissoc block :block/children))
|
||||||
|
@ -55,9 +56,7 @@
|
||||||
(if has-children?
|
(if has-children?
|
||||||
[:section dom-attrs
|
[:section dom-attrs
|
||||||
[:section.relative
|
[:section.relative
|
||||||
block-el
|
block-el]
|
||||||
(when deep-level?
|
|
||||||
[:span.opacity-30.text-xl "Hidden children"])]
|
|
||||||
children]
|
children]
|
||||||
[:section dom-attrs block-el])))
|
[:section dom-attrs block-el])))
|
||||||
|
|
||||||
|
@ -93,11 +92,21 @@
|
||||||
page (db/entity [:block/name page-name])
|
page (db/entity [:block/name page-name])
|
||||||
journal? (:journal? page)
|
journal? (:journal? page)
|
||||||
repo (state/get-current-repo)
|
repo (state/get-current-repo)
|
||||||
blocks (-> (db/get-paginated-blocks repo (:db/id page))
|
blocks (-> (db/get-paginated-blocks repo (:db/id page)
|
||||||
|
{:limit 1000})
|
||||||
(outliner-tree/blocks->vec-tree page-name))
|
(outliner-tree/blocks->vec-tree page-name))
|
||||||
blocks (if journal?
|
blocks (if journal?
|
||||||
(rest blocks)
|
(rest blocks)
|
||||||
blocks)
|
blocks)
|
||||||
|
blocks (map (fn [block]
|
||||||
|
(update block :block/children
|
||||||
|
(fn [children]
|
||||||
|
(->>
|
||||||
|
(mapcat
|
||||||
|
(fn [x]
|
||||||
|
(tree-seq map? :block/children x))
|
||||||
|
children)
|
||||||
|
(map #(dissoc % :block/children)))))) blocks)
|
||||||
config {:id "slide-reveal-js"
|
config {:id "slide-reveal-js"
|
||||||
:slide? true
|
:slide? true
|
||||||
:sidebar? true
|
:sidebar? true
|
||||||
|
|
|
@ -3089,9 +3089,15 @@
|
||||||
(when (state/editing?)
|
(when (state/editing?)
|
||||||
(keydown-backspace-handler false e)))
|
(keydown-backspace-handler false e)))
|
||||||
|
|
||||||
|
(defn- slide-focused?
|
||||||
|
[]
|
||||||
|
(some-> (first (dom/by-class "reveal"))
|
||||||
|
(dom/has-class? "focused")))
|
||||||
|
|
||||||
(defn shortcut-up-down [direction]
|
(defn shortcut-up-down [direction]
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(when-not (auto-complete?)
|
(when (and (not (auto-complete?))
|
||||||
|
(not (slide-focused?)))
|
||||||
(util/stop e)
|
(util/stop e)
|
||||||
(cond
|
(cond
|
||||||
(state/editing?)
|
(state/editing?)
|
||||||
|
|
|
@ -723,7 +723,7 @@
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defn get-blocks-noncollapse []
|
(defn get-blocks-noncollapse []
|
||||||
(->> (d/by-class "ls-block")
|
(->> (d/sel "div:not(.reveal) .ls-block")
|
||||||
(filter (fn [b] (some? (gobj/get b "offsetParent")))))))
|
(filter (fn [b] (some? (gobj/get b "offsetParent")))))))
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
|
|
Loading…
Reference in New Issue