From 60f2b3eea262a85f0375d6ffc8aad41776d0b191 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 19 May 2025 18:26:10 +0800 Subject: [PATCH] fix: mod+enter can't open search in sidebar --- .../frontend/components/right_sidebar.cljs | 133 ++++++++++-------- 1 file changed, 73 insertions(+), 60 deletions(-) diff --git a/src/main/frontend/components/right_sidebar.cljs b/src/main/frontend/components/right_sidebar.cljs index a898507adb..50d9b95eb3 100644 --- a/src/main/frontend/components/right_sidebar.cljs +++ b/src/main/frontend/components/right_sidebar.cljs @@ -69,77 +69,89 @@ :sidebar-key sidebar-key} repo block-id {:indent? false})] (block-cp repo idx block)])) +(rum/defc search-title < rum/reactive + [*input] + (let [input (rum/react *input) + input' (if (string/blank? input) "Blank input" input)] + [:span.overflow-hidden.text-ellipsis input'])) + +(rum/defc sidebar-search + [repo block-type init-key input *input] + (rum/with-key + (cmdk/cmdk-block {:initial-input input + :sidebar? true + :on-input-change (fn [new-value] + (reset! *input new-value)) + :on-input-blur (fn [new-value] + (state/sidebar-replace-block! [repo input block-type] + [repo new-value block-type]))}) + (str init-key))) + (defn- + (p/do! + (when-not (contains? #{:contents :search} block-type) + (db-async/ (when (zero? idx) (drop-indicator (dec idx) drag-to))