|
|
@@ -2969,107 +2969,108 @@
|
|
|
selected? (when-not (:slide? config)
|
|
|
(state/sub-block-selected? uuid))
|
|
|
children (:block/_parent block)]
|
|
|
- [:div.ls-block
|
|
|
- (cond->
|
|
|
- {:id (str "ls-block-" uuid)
|
|
|
- :blockid (str uuid)
|
|
|
- :containerid container-id
|
|
|
- :ref #(when (nil? @*ref) (reset! *ref %))
|
|
|
- :data-collapsed (and collapsed? has-child?)
|
|
|
- :class (str "id" uuid " "
|
|
|
- (when selected? " selected")
|
|
|
- (when pre-block? " pre-block")
|
|
|
- (when order-list? " is-order-list")
|
|
|
- (when (string/blank? content) " is-blank")
|
|
|
- (when original-block " embed-block"))
|
|
|
- :haschild (str (boolean has-child?))}
|
|
|
-
|
|
|
- original-block
|
|
|
- (assoc :originalblockid (str (:block/uuid original-block)))
|
|
|
-
|
|
|
- level
|
|
|
- (assoc :level level)
|
|
|
-
|
|
|
- (not slide?)
|
|
|
- (merge attrs)
|
|
|
-
|
|
|
- (or reference? embed?)
|
|
|
- (assoc :data-transclude true)
|
|
|
-
|
|
|
- embed?
|
|
|
- (assoc :data-embed true)
|
|
|
-
|
|
|
- custom-query?
|
|
|
- (assoc :data-query true))
|
|
|
-
|
|
|
- (when (and ref? breadcrumb-show?)
|
|
|
- (breadcrumb config repo uuid {:show-page? false
|
|
|
- :indent? true
|
|
|
- :navigating-block *navigating-block}))
|
|
|
+ (when-not (= (:ui/deleting-block @state/state) (:block/uuid block))
|
|
|
+ [:div.ls-block
|
|
|
+ (cond->
|
|
|
+ {:id (str "ls-block-" uuid)
|
|
|
+ :blockid (str uuid)
|
|
|
+ :containerid container-id
|
|
|
+ :ref #(when (nil? @*ref) (reset! *ref %))
|
|
|
+ :data-collapsed (and collapsed? has-child?)
|
|
|
+ :class (str "id" uuid " "
|
|
|
+ (when selected? " selected")
|
|
|
+ (when pre-block? " pre-block")
|
|
|
+ (when order-list? " is-order-list")
|
|
|
+ (when (string/blank? content) " is-blank")
|
|
|
+ (when original-block " embed-block"))
|
|
|
+ :haschild (str (boolean has-child?))}
|
|
|
+
|
|
|
+ original-block
|
|
|
+ (assoc :originalblockid (str (:block/uuid original-block)))
|
|
|
+
|
|
|
+ level
|
|
|
+ (assoc :level level)
|
|
|
+
|
|
|
+ (not slide?)
|
|
|
+ (merge attrs)
|
|
|
+
|
|
|
+ (or reference? embed?)
|
|
|
+ (assoc :data-transclude true)
|
|
|
+
|
|
|
+ embed?
|
|
|
+ (assoc :data-embed true)
|
|
|
+
|
|
|
+ custom-query?
|
|
|
+ (assoc :data-query true))
|
|
|
+
|
|
|
+ (when (and ref? breadcrumb-show?)
|
|
|
+ (breadcrumb config repo uuid {:show-page? false
|
|
|
+ :indent? true
|
|
|
+ :navigating-block *navigating-block}))
|
|
|
|
|
|
;; only render this for the first block in each container
|
|
|
- (when top?
|
|
|
- (dnd-separator-wrapper block children block-id slide? true false))
|
|
|
-
|
|
|
- [:div.block-main-container.flex.flex-row.pr-2
|
|
|
- {:class (if (and heading? (seq (:block/title block))) "items-baseline" "")
|
|
|
- :on-touch-start (fn [event uuid] (block-handler/on-touch-start event uuid))
|
|
|
- :on-touch-move (fn [event]
|
|
|
- (block-handler/on-touch-move event block uuid edit? *show-left-menu? *show-right-menu?))
|
|
|
- :on-touch-end (fn [event]
|
|
|
- (block-handler/on-touch-end event block uuid *show-left-menu? *show-right-menu?))
|
|
|
- :on-touch-cancel (fn [_e]
|
|
|
- (block-handler/on-touch-cancel *show-left-menu? *show-right-menu?))
|
|
|
- :on-mouse-over (fn [e]
|
|
|
- (block-mouse-over e *control-show? block-id doc-mode?))
|
|
|
- :on-mouse-leave (fn [e]
|
|
|
- (block-mouse-leave e *control-show? block-id doc-mode?))}
|
|
|
- (when (and (not slide?) (not in-whiteboard?))
|
|
|
- (let [edit? (or edit?
|
|
|
- (= uuid (:block/uuid (state/get-edit-block))))]
|
|
|
- (block-control config block
|
|
|
- {:uuid uuid
|
|
|
- :block-id block-id
|
|
|
- :collapsed? collapsed?
|
|
|
- :*control-show? *control-show?
|
|
|
- :edit? edit?
|
|
|
- :selected? selected?})))
|
|
|
-
|
|
|
- (when (and @*show-left-menu? (not in-whiteboard?))
|
|
|
- (block-left-menu config block))
|
|
|
-
|
|
|
- (if whiteboard-block?
|
|
|
- (block-reference {} (str uuid) nil)
|
|
|
+ (when top?
|
|
|
+ (dnd-separator-wrapper block children block-id slide? true false))
|
|
|
+
|
|
|
+ [:div.block-main-container.flex.flex-row.pr-2
|
|
|
+ {:class (if (and heading? (seq (:block/title block))) "items-baseline" "")
|
|
|
+ :on-touch-start (fn [event uuid] (block-handler/on-touch-start event uuid))
|
|
|
+ :on-touch-move (fn [event]
|
|
|
+ (block-handler/on-touch-move event block uuid edit? *show-left-menu? *show-right-menu?))
|
|
|
+ :on-touch-end (fn [event]
|
|
|
+ (block-handler/on-touch-end event block uuid *show-left-menu? *show-right-menu?))
|
|
|
+ :on-touch-cancel (fn [_e]
|
|
|
+ (block-handler/on-touch-cancel *show-left-menu? *show-right-menu?))
|
|
|
+ :on-mouse-over (fn [e]
|
|
|
+ (block-mouse-over e *control-show? block-id doc-mode?))
|
|
|
+ :on-mouse-leave (fn [e]
|
|
|
+ (block-mouse-leave e *control-show? block-id doc-mode?))}
|
|
|
+ (when (and (not slide?) (not in-whiteboard?))
|
|
|
+ (let [edit? (or edit?
|
|
|
+ (= uuid (:block/uuid (state/get-edit-block))))]
|
|
|
+ (block-control config block
|
|
|
+ {:uuid uuid
|
|
|
+ :block-id block-id
|
|
|
+ :collapsed? collapsed?
|
|
|
+ :*control-show? *control-show?
|
|
|
+ :edit? edit?
|
|
|
+ :selected? selected?})))
|
|
|
+
|
|
|
+ (when (and @*show-left-menu? (not in-whiteboard?))
|
|
|
+ (block-left-menu config block))
|
|
|
+
|
|
|
+ (if whiteboard-block?
|
|
|
+ (block-reference {} (str uuid) nil)
|
|
|
;; Not embed self
|
|
|
- [:div.flex.flex-col.w-full
|
|
|
- (let [block (merge block (block/parse-title-and-body uuid (:block/format block) pre-block? (or raw-content content)))
|
|
|
- hide-block-refs-count? (and (:embed? config)
|
|
|
- (= (:block/uuid block) (:embed-id config)))]
|
|
|
- (block-content-or-editor config block
|
|
|
- {:edit-input-id edit-input-id
|
|
|
- :block-id block-id
|
|
|
- :edit? edit?
|
|
|
- :hide-block-refs-count? hide-block-refs-count?
|
|
|
- :selected? selected?}))])
|
|
|
-
|
|
|
- (when (and @*show-right-menu? (not in-whiteboard?))
|
|
|
- (block-right-menu config block edit?))]
|
|
|
-
|
|
|
- (when (and (config/db-based-graph? repo) (not collapsed?))
|
|
|
- [:div {:style {:padding-left 29}}
|
|
|
- (db-properties-cp config
|
|
|
- block
|
|
|
- edit-input-id
|
|
|
- {:selected? selected?
|
|
|
- :in-block-container? true})])
|
|
|
-
|
|
|
- (when-not (or (:hide-children? config) in-whiteboard?)
|
|
|
- (let [children' (db/sort-by-left children block)
|
|
|
- config' (-> (update config :level inc)
|
|
|
- (dissoc :original-block))]
|
|
|
- (block-children config' block children' collapsed?)))
|
|
|
-
|
|
|
- (when-not in-whiteboard? (dnd-separator-wrapper block children block-id slide? false false))]))
|
|
|
+ [:div.flex.flex-col.w-full
|
|
|
+ (let [block (merge block (block/parse-title-and-body uuid (:block/format block) pre-block? (or raw-content content)))
|
|
|
+ hide-block-refs-count? (and (:embed? config)
|
|
|
+ (= (:block/uuid block) (:embed-id config)))]
|
|
|
+ (block-content-or-editor config block
|
|
|
+ {:edit-input-id edit-input-id
|
|
|
+ :block-id block-id
|
|
|
+ :edit? edit?
|
|
|
+ :hide-block-refs-count? hide-block-refs-count?
|
|
|
+ :selected? selected?}))])
|
|
|
+
|
|
|
+ (when (and @*show-right-menu? (not in-whiteboard?))
|
|
|
+ (block-right-menu config block edit?))]
|
|
|
+
|
|
|
+ (when (and (config/db-based-graph? repo) (not collapsed?))
|
|
|
+ [:div {:style {:padding-left 29}}
|
|
|
+ (db-properties-cp config
|
|
|
+ block
|
|
|
+ edit-input-id
|
|
|
+ {:selected? selected?
|
|
|
+ :in-block-container? true})])
|
|
|
+
|
|
|
+ (when-not (or (:hide-children? config) in-whiteboard?)
|
|
|
+ (let [children' (db/sort-by-left children block)
|
|
|
+ config' (-> (update config :level inc)
|
|
|
+ (dissoc :original-block))]
|
|
|
+ (block-children config' block children' collapsed?)))
|
|
|
+
|
|
|
+ (when-not in-whiteboard? (dnd-separator-wrapper block children block-id slide? false false))])))
|
|
|
|
|
|
(defn- block-changed?
|
|
|
[old-block new-block]
|