|
|
@@ -229,21 +229,21 @@
|
|
|
(let [!input (::input state)
|
|
|
!results (::results state)
|
|
|
repo (state/get-current-repo)
|
|
|
- current-page (page-util/get-current-page-id)
|
|
|
+ current-page (when-let [id (page-util/get-current-page-id)]
|
|
|
+ (db/entity id))
|
|
|
opts {:limit 100}]
|
|
|
(swap! !results assoc-in [group :status] :loading)
|
|
|
(swap! !results assoc-in [:current-page :status] :loading)
|
|
|
(p/let [blocks (search/block-search repo @!input opts)
|
|
|
blocks (remove nil? blocks)
|
|
|
items (map (fn [block]
|
|
|
- (let [id (if (uuid? (:block/uuid block))
|
|
|
- (:block/uuid block)
|
|
|
- (uuid (:block/uuid block)))]
|
|
|
+ (let [id (:block/uuid block)]
|
|
|
{:icon "block"
|
|
|
:icon-theme :gray
|
|
|
:text (:block/content block)
|
|
|
:header (block/breadcrumb {:search? true} repo id {})
|
|
|
- :current-page? (some-> block :block/page #{current-page})
|
|
|
+ :current-page? (when-let [page-id (:block/page block)]
|
|
|
+ (= page-id (:block/uuid current-page)))
|
|
|
:source-block block})) blocks)
|
|
|
items-on-other-pages (remove :current-page? items)
|
|
|
items-on-current-page (filter :current-page? items)]
|
|
|
@@ -314,7 +314,7 @@
|
|
|
(load-results :files state))))
|
|
|
|
|
|
(defn- copy-block-ref [state]
|
|
|
- (when-let [block-uuid (some-> state state->highlighted-item :source-block :block/uuid uuid)]
|
|
|
+ (when-let [block-uuid (some-> state state->highlighted-item :source-block :block/uuid)]
|
|
|
(editor-handler/copy-block-ref! block-uuid block-ref/->block-ref)
|
|
|
(state/close-modal!)))
|
|
|
|
|
|
@@ -331,7 +331,7 @@
|
|
|
(state/close-modal!)))
|
|
|
|
|
|
(defmethod handle-action :open-block [_ state _event]
|
|
|
- (let [block-id (some-> state state->highlighted-item :source-block :block/uuid uuid)
|
|
|
+ (let [block-id (some-> state state->highlighted-item :source-block :block/uuid)
|
|
|
get-block-page (partial model/get-block-page (state/get-current-repo))]
|
|
|
(when-let [page (some-> block-id get-block-page)]
|
|
|
(let [page-name (:block/name page)]
|
|
|
@@ -349,7 +349,7 @@
|
|
|
(state/close-modal!)))
|
|
|
|
|
|
(defmethod handle-action :open-block-right [_ state _event]
|
|
|
- (when-let [block-uuid (some-> state state->highlighted-item :source-block :block/uuid uuid)]
|
|
|
+ (when-let [block-uuid (some-> state state->highlighted-item :source-block :block/uuid)]
|
|
|
(editor-handler/open-block-in-sidebar! block-uuid)
|
|
|
(state/close-modal!)))
|
|
|
|