|
328 | 328 | state)} |
329 | 329 | [state _edit-block input id q format selected-text] |
330 | 330 | (let [result (->> (rum/react (get state ::result)) |
331 | | - (remove (fn [b] (or (nil? (:block/uuid b)) |
332 | | - (string/blank? (:block/title (db-model/query-block-by-uuid (:block/uuid b)))))))) |
| 331 | + (remove (fn [b] (nil? (:block/uuid b))))) |
333 | 332 | db? (config/db-based-graph? (state/get-current-repo)) |
334 | 333 | embed? (and db? (= @commands/*current-command "Block embed")) |
335 | 334 | chosen-handler (block-on-chosen-handler embed? input id q format selected-text) |
|
339 | 338 | {:on-chosen chosen-handler |
340 | 339 | :on-enter non-exist-block-handler |
341 | 340 | :empty-placeholder [:div.text-gray-500.text-sm.px-4.py-2 (t :editor/block-search)] |
342 | | - :item-render (fn [{:block/keys [page uuid]}] ;; content returned from search engine is normalized |
| 341 | + :item-render (fn [{:block/keys [page uuid title]}] |
343 | 342 | (let [page-entity (db/entity [:block/uuid page]) |
344 | 343 | repo (state/sub :git/current-repo) |
345 | | - format (get page-entity :block/format :markdown) |
346 | | - block (db-model/get-block-by-uuid uuid) |
347 | | - content (:block/title block)] |
348 | | - (when-not (string/blank? content) |
349 | | - [:.py-2 (search/block-search-result-item repo uuid format content q :block)]))) |
| 344 | + format (get page-entity :block/format :markdown)] |
| 345 | + (when-not (string/blank? title) |
| 346 | + [:.py-2 (search/block-search-result-item repo uuid format title q :block)]))) |
350 | 347 | :class "ac-block-search"}))) |
351 | 348 |
|
352 | 349 | (rum/defcs block-search < rum/reactive |
|
0 commit comments