|
|
@@ -5,6 +5,7 @@
|
|
|
[cljs-bean.core :as bean]
|
|
|
[cljs.core.match :refer [match]]
|
|
|
[cljs.reader :as reader]
|
|
|
+ [clojure.set :as set]
|
|
|
[clojure.string :as string]
|
|
|
[clojure.walk :as walk]
|
|
|
[datascript.core :as d]
|
|
|
@@ -22,8 +23,8 @@
|
|
|
[frontend.db :as db]
|
|
|
[frontend.db-mixins :as db-mixins]
|
|
|
[frontend.db.model :as model]
|
|
|
- [frontend.db.react :as react]
|
|
|
[frontend.db.query-dsl :as query-dsl]
|
|
|
+ [frontend.db.react :as react]
|
|
|
[frontend.db.utils :as db-utils]
|
|
|
[frontend.extensions.highlight :as highlight]
|
|
|
[frontend.extensions.latex :as latex]
|
|
|
@@ -39,11 +40,13 @@
|
|
|
[frontend.handler.common :as common-handler]
|
|
|
[frontend.handler.dnd :as dnd]
|
|
|
[frontend.handler.editor :as editor-handler]
|
|
|
+ [frontend.handler.file-sync :as file-sync]
|
|
|
[frontend.handler.plugin :as plugin-handler]
|
|
|
[frontend.handler.query :as query-handler]
|
|
|
[frontend.handler.repeated :as repeated]
|
|
|
[frontend.handler.route :as route-handler]
|
|
|
[frontend.handler.ui :as ui-handler]
|
|
|
+ [frontend.handler.whiteboard :as whiteboard-handler]
|
|
|
[frontend.mobile.util :as mobile-util]
|
|
|
[frontend.modules.outliner.tree :as tree]
|
|
|
[frontend.search :as search]
|
|
|
@@ -62,17 +65,15 @@
|
|
|
[logseq.graph-parser.block :as gp-block]
|
|
|
[logseq.graph-parser.config :as gp-config]
|
|
|
[logseq.graph-parser.mldoc :as gp-mldoc]
|
|
|
- [logseq.graph-parser.text :as text]
|
|
|
[logseq.graph-parser.property :as gp-property]
|
|
|
+ [logseq.graph-parser.text :as text]
|
|
|
[logseq.graph-parser.util :as gp-util]
|
|
|
- [logseq.graph-parser.util.page-ref :as page-ref]
|
|
|
[logseq.graph-parser.util.block-ref :as block-ref]
|
|
|
+ [logseq.graph-parser.util.page-ref :as page-ref]
|
|
|
[medley.core :as medley]
|
|
|
[promesa.core :as p]
|
|
|
[reitit.frontend.easy :as rfe]
|
|
|
[rum.core :as rum]
|
|
|
- [frontend.handler.file-sync :as file-sync]
|
|
|
- [clojure.set :as set]
|
|
|
[shadow.loader :as loader]))
|
|
|
|
|
|
(defn safe-read-string
|
|
|
@@ -525,7 +526,7 @@
|
|
|
(declare page-reference)
|
|
|
|
|
|
(defn open-page-ref
|
|
|
- [e page-name redirect-page-name page-name-in-block contents-page?]
|
|
|
+ [e page-name redirect-page-name page-name-in-block contents-page? whiteboard-page?]
|
|
|
(util/stop e)
|
|
|
(cond
|
|
|
(gobj/get e "shiftKey")
|
|
|
@@ -535,6 +536,14 @@
|
|
|
(:db/id page-entity)
|
|
|
:page))
|
|
|
|
|
|
+ (whiteboard-handler/inside-portal (.-target e))
|
|
|
+ (whiteboard-handler/add-new-block-portal-shape!
|
|
|
+ page-name
|
|
|
+ (whiteboard-handler/closest-shape (.-target e)))
|
|
|
+
|
|
|
+ whiteboard-page?
|
|
|
+ (route-handler/redirect-to-whiteboard! page-name)
|
|
|
+
|
|
|
(not= redirect-page-name page-name)
|
|
|
(route-handler/redirect-to-page! redirect-page-name)
|
|
|
|
|
|
@@ -551,17 +560,18 @@
|
|
|
page-name-in-block is the overridable name of the page (legacy)
|
|
|
|
|
|
All page-names are sanitized except page-name-in-block"
|
|
|
- [config page-name-in-block page-name redirect-page-name page-entity contents-page? children html-export? label]
|
|
|
- (let [tag? (:tag? config)]
|
|
|
+ [config page-name-in-block page-name redirect-page-name page-entity contents-page? children html-export? label whiteboard-page?]
|
|
|
+ (let [tag? (:tag? config)
|
|
|
+ config (assoc config :whiteboard-page? whiteboard-page?)]
|
|
|
[:a
|
|
|
{:tabIndex "0"
|
|
|
:class (cond-> (if tag? "tag" "page-ref")
|
|
|
(:property? config)
|
|
|
(str " page-property-key block-property"))
|
|
|
:data-ref page-name
|
|
|
- :on-mouse-down (fn [e] (open-page-ref e page-name redirect-page-name page-name-in-block contents-page?))
|
|
|
+ :on-mouse-down (fn [e] (open-page-ref e page-name redirect-page-name page-name-in-block contents-page? whiteboard-page?))
|
|
|
:on-key-up (fn [e] (when (and e (= (.-key e) "Enter"))
|
|
|
- (open-page-ref e page-name redirect-page-name page-name-in-block contents-page?)))}
|
|
|
+ (open-page-ref e page-name redirect-page-name page-name-in-block contents-page? whiteboard-page?)))}
|
|
|
|
|
|
(if (and (coll? children) (seq children))
|
|
|
(for [child children]
|
|
|
@@ -592,52 +602,56 @@
|
|
|
[{:keys [children sidebar? tippy-position tippy-distance fixed-position? open? manual?] :as config} page-name]
|
|
|
(let [*tippy-ref (rum/create-ref)
|
|
|
page-name (util/page-name-sanity-lc page-name)
|
|
|
+ whiteboard-page? (model/whiteboard-page? page-name)
|
|
|
redirect-page-name (or (model/get-redirect-page-name page-name (:block/alias? config))
|
|
|
page-name)
|
|
|
page-original-name (model/get-page-original-name redirect-page-name)
|
|
|
_ #_:clj-kondo/ignore (rum/defc html-template []
|
|
|
- (let [*el-popup (rum/use-ref nil)]
|
|
|
+ (let [*el-popup (rum/use-ref nil)]
|
|
|
|
|
|
- (rum/use-effect!
|
|
|
- (fn []
|
|
|
- (let [el-popup (rum/deref *el-popup)
|
|
|
- cb (fn [^js e]
|
|
|
- (when-not (:editor/editing? @state/state)
|
|
|
+ (rum/use-effect!
|
|
|
+ (fn []
|
|
|
+ (let [el-popup (rum/deref *el-popup)
|
|
|
+ cb (fn [^js e]
|
|
|
+ (when-not (:editor/editing? @state/state)
|
|
|
;; Esc
|
|
|
- (and (= e.which 27)
|
|
|
- (when-let [tp (rum/deref *tippy-ref)]
|
|
|
- (.hideTooltip tp)))))]
|
|
|
-
|
|
|
- (js/setTimeout #(.focus el-popup))
|
|
|
- (.addEventListener el-popup "keyup" cb)
|
|
|
- #(.removeEventListener el-popup "keyup" cb)))
|
|
|
- [])
|
|
|
-
|
|
|
- (when redirect-page-name
|
|
|
- [:div.tippy-wrapper.overflow-y-auto.p-4.outline-none
|
|
|
- {:ref *el-popup
|
|
|
- :tab-index -1
|
|
|
- :style {:width 600
|
|
|
- :text-align "left"
|
|
|
- :font-weight 500
|
|
|
- :max-height 600
|
|
|
- :padding-bottom 64}}
|
|
|
- (if (and (string? page-original-name) (string/includes? page-original-name "/"))
|
|
|
- [:div.my-2
|
|
|
- (->>
|
|
|
- (for [page (string/split page-original-name #"/")]
|
|
|
- (when (and (string? page) page)
|
|
|
- (page-reference false page {} nil)))
|
|
|
- (interpose [:span.mx-2.opacity-30 "/"]))]
|
|
|
- [:h2.font-bold.text-lg (if (= page-name redirect-page-name)
|
|
|
- page-original-name
|
|
|
- [:span
|
|
|
- [:span.text-sm.mr-2 "Alias:"]
|
|
|
- page-original-name])])
|
|
|
- (let [page (db/entity [:block/name (util/page-name-sanity-lc redirect-page-name)])]
|
|
|
- (editor-handler/insert-first-page-block-if-not-exists! redirect-page-name {:redirect? false})
|
|
|
- (when-let [f (state/get-page-blocks-cp)]
|
|
|
- (f (state/get-current-repo) page {:sidebar? sidebar? :preview? true})))])))]
|
|
|
+ (and (= e.which 27)
|
|
|
+ (when-let [tp (rum/deref *tippy-ref)]
|
|
|
+ (.hideTooltip tp)))))]
|
|
|
+
|
|
|
+ (js/setTimeout #(.focus el-popup))
|
|
|
+ (.addEventListener el-popup "keyup" cb)
|
|
|
+ #(.removeEventListener el-popup "keyup" cb)))
|
|
|
+ [])
|
|
|
+
|
|
|
+ (when redirect-page-name
|
|
|
+ [:div.tippy-wrapper.overflow-y-auto.p-4.outline-none
|
|
|
+ {:ref *el-popup
|
|
|
+ :tab-index -1
|
|
|
+ :style {:width 600
|
|
|
+ :text-align "left"
|
|
|
+ :font-weight 500
|
|
|
+ :max-height 600
|
|
|
+ :padding-bottom 64}}
|
|
|
+ (if (and (string? page-original-name) (string/includes? page-original-name "/"))
|
|
|
+ [:div.my-2
|
|
|
+ (->>
|
|
|
+ (for [page (string/split page-original-name #"/")]
|
|
|
+ (when (and (string? page) page)
|
|
|
+ (page-reference false page {} nil)))
|
|
|
+ (interpose [:span.mx-2.opacity-30 "/"]))]
|
|
|
+ [:h2.font-bold.text-lg (if (= page-name redirect-page-name)
|
|
|
+ page-original-name
|
|
|
+ [:span
|
|
|
+ [:span.text-sm.mr-2 "Alias:"]
|
|
|
+ page-original-name])])
|
|
|
+ (let [page (db/entity [:block/name (util/page-name-sanity-lc redirect-page-name)])]
|
|
|
+ (editor-handler/insert-first-page-block-if-not-exists! redirect-page-name {:redirect? false})
|
|
|
+ (let [page-blocks-cp (state/get-page-blocks-cp)
|
|
|
+ tldraw-preview (state/get-component :whiteboard/tldraw-preview)]
|
|
|
+ (if whiteboard-page?
|
|
|
+ (tldraw-preview page-name)
|
|
|
+ (page-blocks-cp (state/get-current-repo) page {:sidebar? sidebar? :preview? true}))))])))]
|
|
|
|
|
|
(if (or (not manual?) open?)
|
|
|
(ui/tippy {:ref *tippy-ref
|
|
|
@@ -661,6 +675,7 @@
|
|
|
(let [page-name-in-block (gp-util/remove-boundary-slashes page-name-in-block)
|
|
|
page-name (util/page-name-sanity-lc page-name-in-block)
|
|
|
page-entity (db/entity [:block/name page-name])
|
|
|
+ whiteboard-page? (model/whiteboard-page? page-name)
|
|
|
redirect-page-name (or (and (= :org (state/get-preferred-format))
|
|
|
(:org-mode/insert-file-link? (state/get-config))
|
|
|
redirect-page-name)
|
|
|
@@ -668,7 +683,10 @@
|
|
|
inner (page-inner config
|
|
|
page-name-in-block
|
|
|
page-name
|
|
|
- redirect-page-name page-entity contents-page? children html-export? label)]
|
|
|
+ redirect-page-name page-entity contents-page? children html-export? label whiteboard-page?)
|
|
|
+ inner (if whiteboard-page?
|
|
|
+ [:<> [:span.text-gray-500 (ui/icon "whiteboard" {:extension? true}) " "] inner]
|
|
|
+ inner)]
|
|
|
(cond
|
|
|
(:breadcrumb? config)
|
|
|
(or (:block/original-name page)
|
|
|
@@ -730,11 +748,9 @@
|
|
|
(draw-component {:file file :block-uuid block-uuid}))))
|
|
|
|
|
|
(rum/defc page-reference < rum/reactive
|
|
|
- [html-export? s config label]
|
|
|
+ [html-export? s {:keys [nested-link? block-uuid id] :as config} label]
|
|
|
(let [show-brackets? (state/show-brackets?)
|
|
|
- nested-link? (:nested-link? config)
|
|
|
- contents-page? (= "contents" (string/lower-case (str (:id config))))
|
|
|
- block-uuid (:block/uuid config)]
|
|
|
+ contents-page? (= "contents" (string/lower-case (str id)))]
|
|
|
(if (string/ends-with? s ".excalidraw")
|
|
|
[:div.draw {:on-click (fn [e]
|
|
|
(.stopPropagation e))}
|
|
|
@@ -792,7 +808,8 @@
|
|
|
(rum/defc page-embed < rum/reactive db-mixins/query
|
|
|
[config page-name]
|
|
|
(let [page-name (util/page-name-sanity-lc (string/trim page-name))
|
|
|
- current-page (state/get-current-page)]
|
|
|
+ current-page (state/get-current-page)
|
|
|
+ whiteboard-page? (model/whiteboard-page? page-name)]
|
|
|
[:div.color-level.embed.embed-page.bg-base-2
|
|
|
{:class (when (:sidebar? config) "in-sidebar")
|
|
|
:on-double-click #(edit-parent-block % config)
|
|
|
@@ -805,14 +822,16 @@
|
|
|
page-name)
|
|
|
(not= (util/page-name-sanity-lc (get config :id ""))
|
|
|
page-name))
|
|
|
- (let [page (model/get-page page-name)
|
|
|
- blocks (db/get-paginated-blocks (state/get-current-repo) (:db/id page))]
|
|
|
- (blocks-container blocks (assoc config
|
|
|
- :db/id (:db/id page)
|
|
|
- :id page-name
|
|
|
- :embed? true
|
|
|
- :page-embed? true
|
|
|
- :ref? false))))]))
|
|
|
+ (if whiteboard-page?
|
|
|
+ ((state/get-component :whiteboard/tldraw-preview) page-name)
|
|
|
+ (let [page (model/get-page page-name)
|
|
|
+ blocks (db/get-paginated-blocks (state/get-current-repo) (:db/id page))]
|
|
|
+ (blocks-container blocks (assoc config
|
|
|
+ :db/id (:db/id page)
|
|
|
+ :id page-name
|
|
|
+ :embed? true
|
|
|
+ :page-embed? true
|
|
|
+ :ref? false)))))]))
|
|
|
|
|
|
(defn- get-label-text
|
|
|
[label]
|
|
|
@@ -845,10 +864,11 @@
|
|
|
block (when db-id (db/pull-block db-id))
|
|
|
block-type (keyword (get-in block [:block/properties :ls-type]))
|
|
|
hl-type (get-in block [:block/properties :hl-type])
|
|
|
- repo (state/get-current-repo)]
|
|
|
+ repo (state/get-current-repo)
|
|
|
+ stop-inner-events? (= block-type :whiteboard-shape)]
|
|
|
(if (and block (:block/content block))
|
|
|
- (let [title [:span {:class "block-ref"}
|
|
|
- (block-content (assoc config :block-ref? true)
|
|
|
+ (let [title [:span.block-ref
|
|
|
+ (block-content (assoc config :block-ref? true :stop-events? stop-inner-events?)
|
|
|
block nil (:block/uuid block)
|
|
|
(:slide? config))]
|
|
|
inner (if label
|
|
|
@@ -871,16 +891,26 @@
|
|
|
(not (util/right-click? e)))
|
|
|
(util/stop e)
|
|
|
|
|
|
- (if (gobj/get e "shiftKey")
|
|
|
+ (cond
|
|
|
+ (gobj/get e "shiftKey")
|
|
|
(state/sidebar-add-block!
|
|
|
(state/get-current-repo)
|
|
|
(:db/id block)
|
|
|
:block-ref)
|
|
|
|
|
|
+ (whiteboard-handler/inside-portal (.-target e))
|
|
|
+ (whiteboard-handler/add-new-block-portal-shape!
|
|
|
+ (:block/uuid block)
|
|
|
+ (whiteboard-handler/closest-shape (.-target e)))
|
|
|
+
|
|
|
+ :else
|
|
|
(match [block-type (util/electron?)]
|
|
|
;; pdf annotation
|
|
|
[:annotation true] (pdf-assets/open-block-ref! block)
|
|
|
|
|
|
+ [:whiteboard-shape true] (route-handler/redirect-to-whiteboard!
|
|
|
+ (get-in block [:block/page :block/name]) {:block-id block-id})
|
|
|
+
|
|
|
;; default open block page
|
|
|
:else (route-handler/redirect-to-page! id))))))}
|
|
|
|
|
|
@@ -1617,13 +1647,22 @@
|
|
|
|
|
|
(defn- bullet-on-click
|
|
|
[e block uuid]
|
|
|
- (if (gobj/get e "shiftKey")
|
|
|
+ (cond
|
|
|
+ (gobj/get e "shiftKey")
|
|
|
(do
|
|
|
(state/sidebar-add-block!
|
|
|
(state/get-current-repo)
|
|
|
(:db/id block)
|
|
|
:block)
|
|
|
(util/stop e))
|
|
|
+
|
|
|
+ (whiteboard-handler/inside-portal (.-target e))
|
|
|
+ (do (whiteboard-handler/add-new-block-portal-shape!
|
|
|
+ uuid
|
|
|
+ (whiteboard-handler/closest-shape (.-target e)))
|
|
|
+ (util/stop e))
|
|
|
+
|
|
|
+ :else
|
|
|
(route-handler/redirect-to-page! uuid)))
|
|
|
|
|
|
(rum/defc block-children < rum/reactive
|
|
|
@@ -1890,7 +1929,8 @@
|
|
|
(if title
|
|
|
(conj
|
|
|
(map-inline config title)
|
|
|
- (when (and (util/electron?) (not= block-type :default))
|
|
|
+ (when (= block-type :whiteboard-shape) [:span.mr-1 (ui/icon "whiteboard-element" {:extension? true})])
|
|
|
+ (when (and (util/electron?) (not (#{:default :whiteboard-shape} block-type)))
|
|
|
[:a.prefix-link
|
|
|
{:on-click #(case block-type
|
|
|
;; pdf annotation
|
|
|
@@ -2176,6 +2216,7 @@
|
|
|
(merge block (block/parse-title-and-body uuid format pre-block? content)))
|
|
|
collapsed? (util/collapsed? block)
|
|
|
block-ref? (:block-ref? config)
|
|
|
+ stop-events? (:stop-events? config)
|
|
|
block-ref-with-title? (and block-ref? (seq title))
|
|
|
block-type (or (:ls-type properties) :default)
|
|
|
content (if (string? content) (string/trim content) "")
|
|
|
@@ -2186,7 +2227,7 @@
|
|
|
attrs (cond->
|
|
|
{:blockid (str uuid)
|
|
|
:data-type (name block-type)
|
|
|
- :style {:width "100%"}}
|
|
|
+ :style {:width "100%" :pointer-events (when stop-events? "none")}}
|
|
|
(not block-ref?)
|
|
|
(assoc mouse-down-key (fn [e]
|
|
|
(block-content-on-mouse-down e block block-id content edit-input-id))))]
|
|
|
@@ -2236,7 +2277,8 @@
|
|
|
(let [hidden? (property/properties-hidden? properties)]
|
|
|
(not hidden?))
|
|
|
(not (and block-ref? (or (seq title) (seq body))))
|
|
|
- (not (:slide? config)))
|
|
|
+ (not (:slide? config))
|
|
|
+ (not= block-type :whiteboard-shape))
|
|
|
(properties-cp config block))
|
|
|
|
|
|
(let [title-collapse-enabled? (:outliner/block-title-collapse-enabled? (state/get-config))]
|
|
|
@@ -2293,7 +2335,7 @@
|
|
|
|
|
|
(rum/defcs block-content-or-editor < rum/reactive
|
|
|
(rum/local true ::hide-block-refs?)
|
|
|
- [state config {:block/keys [uuid format] :as block} edit-input-id block-id edit?]
|
|
|
+ [state config {:block/keys [uuid format] :as block} edit-input-id block-id edit? hide-block-refs-count?]
|
|
|
(let [*hide-block-refs? (get state ::hide-block-refs?)
|
|
|
hide-block-refs? @*hide-block-refs?
|
|
|
editor-box (get config :editor-box)
|
|
|
@@ -2331,29 +2373,66 @@
|
|
|
(editor-handler/unhighlight-blocks!)
|
|
|
(state/set-editing! edit-input-id (:block/content block) block ""))}})
|
|
|
(block-content config block edit-input-id block-id slide?))]
|
|
|
- [:div.flex.flex-row.items-center
|
|
|
- (when (and (:embed? config)
|
|
|
- (:embed-parent config))
|
|
|
- [:a.opacity-70.hover:opacity-100.svg-small.inline
|
|
|
- {:on-mouse-down (fn [e]
|
|
|
- (util/stop e)
|
|
|
- (when-let [block (:embed-parent config)]
|
|
|
- (editor-handler/edit-block! block :max (:block/uuid block))))}
|
|
|
- svg/edit])
|
|
|
-
|
|
|
- (when block-reference-only?
|
|
|
- [:a.opacity-70.hover:opacity-100.svg-small.inline
|
|
|
- {:on-mouse-down (fn [e]
|
|
|
- (util/stop e)
|
|
|
- (editor-handler/edit-block! block :max (:block/uuid block)))}
|
|
|
- svg/edit])
|
|
|
-
|
|
|
- (block-refs-count block *hide-block-refs?)]]
|
|
|
+ (when-not hide-block-refs-count?
|
|
|
+ [:div.flex.flex-row.items-center
|
|
|
+ (when (and (:embed? config)
|
|
|
+ (:embed-parent config))
|
|
|
+ [:a.opacity-70.hover:opacity-100.svg-small.inline
|
|
|
+ {:on-mouse-down (fn [e]
|
|
|
+ (util/stop e)
|
|
|
+ (when-let [block (:embed-parent config)]
|
|
|
+ (editor-handler/edit-block! block :max (:block/uuid block))))}
|
|
|
+ svg/edit])
|
|
|
+
|
|
|
+ (when block-reference-only?
|
|
|
+ [:a.opacity-70.hover:opacity-100.svg-small.inline
|
|
|
+ {:on-mouse-down (fn [e]
|
|
|
+ (util/stop e)
|
|
|
+ (editor-handler/edit-block! block :max (:block/uuid block)))}
|
|
|
+ svg/edit])
|
|
|
+
|
|
|
+ (block-refs-count block *hide-block-refs?)])]
|
|
|
|
|
|
(when (and (not hide-block-refs?) (> refs-count 0))
|
|
|
(let [refs-cp (state/get-component :block/linked-references)]
|
|
|
(refs-cp uuid)))]))))
|
|
|
|
|
|
+;; FIXME: not updating when block content is updated outbound
|
|
|
+(rum/defcs single-block-cp-inner < rum/reactive db-mixins/query
|
|
|
+ ;; todo: mixin for init-blocks-container-id?
|
|
|
+ {:init (fn [state]
|
|
|
+ (assoc state
|
|
|
+ ::init-blocks-container-id (atom nil)))}
|
|
|
+ [state block-uuid]
|
|
|
+ (let [uuid (if (string? block-uuid) (uuid block-uuid) block-uuid)
|
|
|
+ *init-blocks-container-id (::init-blocks-container-id state)
|
|
|
+ block-entity (db/entity [:block/uuid uuid])
|
|
|
+ block-id (:db/id block-entity)
|
|
|
+ block (first (model/get-paginated-blocks (state/get-current-repo) block-id))
|
|
|
+ blocks-container-id (if @*init-blocks-container-id
|
|
|
+ @*init-blocks-container-id
|
|
|
+ (let [id' (swap! *blocks-container-id inc)]
|
|
|
+ (reset! *init-blocks-container-id id')
|
|
|
+ id'))
|
|
|
+ block-el-id (str "ls-block-" blocks-container-id "-" uuid)
|
|
|
+ config {:id (str uuid)
|
|
|
+ :db/id (:db/id block-entity)
|
|
|
+ :block/uuid uuid
|
|
|
+ :block? true
|
|
|
+ :editor-box (state/get-component :editor/box)}
|
|
|
+ edit-input-id (str "edit-block-" blocks-container-id "-" uuid)
|
|
|
+ edit? (state/sub [:editor/editing? edit-input-id])
|
|
|
+ block (block/parse-title-and-body block)]
|
|
|
+ (when (:block/content block)
|
|
|
+ [:div.single-block.ls-block
|
|
|
+ {:class (str block-uuid)
|
|
|
+ :id (str "ls-block-" blocks-container-id "-" block-uuid)}
|
|
|
+ (block-content-or-editor config block edit-input-id block-el-id edit? true)])))
|
|
|
+
|
|
|
+(rum/defc single-block-cp
|
|
|
+ [block-uuid]
|
|
|
+ (single-block-cp-inner block-uuid))
|
|
|
+
|
|
|
(defn non-dragging?
|
|
|
[e]
|
|
|
(and (= (gobj/get e "buttons") 1)
|
|
|
@@ -2470,6 +2549,16 @@
|
|
|
[*move-to]
|
|
|
(reset! *move-to nil))
|
|
|
|
|
|
+(defn block-drag-end
|
|
|
+ ([_event]
|
|
|
+ (block-drag-end _event *move-to))
|
|
|
+ ([_event *move-to]
|
|
|
+ (reset! *dragging? false)
|
|
|
+ (reset! *dragging-block nil)
|
|
|
+ (reset! *drag-to-block nil)
|
|
|
+ (reset! *move-to nil)
|
|
|
+ (editor-handler/unhighlight-blocks!)))
|
|
|
+
|
|
|
(defn- block-drop
|
|
|
[event uuid target-block *move-to]
|
|
|
(util/stop event)
|
|
|
@@ -2479,19 +2568,7 @@
|
|
|
selected (db/pull-many (state/get-current-repo) '[*] lookup-refs)
|
|
|
blocks (if (seq selected) selected [@*dragging-block])]
|
|
|
(dnd/move-blocks event blocks target-block @*move-to)))
|
|
|
- (reset! *dragging? false)
|
|
|
- (reset! *dragging-block nil)
|
|
|
- (reset! *drag-to-block nil)
|
|
|
- (reset! *move-to nil)
|
|
|
- (editor-handler/unhighlight-blocks!))
|
|
|
-
|
|
|
-(defn- block-drag-end
|
|
|
- [_event *move-to]
|
|
|
- (reset! *dragging? false)
|
|
|
- (reset! *dragging-block nil)
|
|
|
- (reset! *drag-to-block nil)
|
|
|
- (reset! *move-to nil)
|
|
|
- (editor-handler/unhighlight-blocks!))
|
|
|
+ (block-drag-end event *move-to))
|
|
|
|
|
|
(defn- block-mouse-over
|
|
|
[e *control-show? block-id doc-mode?]
|
|
|
@@ -2668,7 +2745,7 @@
|
|
|
(when @*show-left-menu?
|
|
|
(block-left-menu config block))
|
|
|
|
|
|
- (block-content-or-editor config block edit-input-id block-id edit?)
|
|
|
+ (block-content-or-editor config block edit-input-id block-id edit? false)
|
|
|
|
|
|
(when @*show-right-menu?
|
|
|
(block-right-menu config block edit?))]
|
|
|
@@ -3492,7 +3569,8 @@
|
|
|
(let [blocks (remove nil? blocks)]
|
|
|
(when (seq blocks)
|
|
|
(let [alias? (:block/alias? page)
|
|
|
- page (db/entity (:db/id page))]
|
|
|
+ page (db/entity (:db/id page))
|
|
|
+ whiteboard? (= "whiteboard" (:block/type page))]
|
|
|
[:div.my-2 (cond-> {:key (str "page-" (:db/id page))}
|
|
|
(:ref? config)
|
|
|
(assoc :class "color-level px-2 sm:px-7 py-2 rounded"))
|
|
|
@@ -3500,7 +3578,7 @@
|
|
|
[:div
|
|
|
(page-cp config page)
|
|
|
(when alias? [:span.text-sm.font-medium.opacity-50 " Alias"])]
|
|
|
- (blocks-container blocks config)
|
|
|
+ (when-not whiteboard? (blocks-container blocks config))
|
|
|
{})])))))]
|
|
|
|
|
|
:else
|