Przeglądaj źródła

fix: don't quit tag auto-completion after input a space

Tienson Qin 2 lat temu
rodzic
commit
f91e8ea744

+ 0 - 5
src/main/frontend/handler/editor.cljs

@@ -3073,11 +3073,6 @@
                (= c (util/nth-safe value (dec (dec current-pos))) " "))
           (state/clear-editor-action!)
 
-          ;; When you type a space after a #
-          (and (state/get-editor-show-page-search-hashtag?)
-               (= c " "))
-          (state/clear-editor-action!)
-
           :else
           (default-case-for-keyup-handler input current-pos k code is-processed? c))
 

+ 3 - 3
src/main/frontend/handler/page.cljs

@@ -221,15 +221,15 @@
           (when (config/db-based-graph? (state/get-current-repo))
             (let [tag (string/trim q)
                   edit-block (state/get-edit-block)]
-              (when (and (not (string/blank? tag)) edit-block)
+              (when (and (not (string/blank? tag)) (:block/uuid edit-block))
                 (let [tag-entity (db/entity [:block/name (util/page-name-sanity-lc tag)])]
                   (when-not tag-entity
                     (create! tag {:redirect? false
                                   :create-first-block? false
                                   :class? true}))
                   (let [tag-entity (or tag-entity (db/entity [:block/name (util/page-name-sanity-lc tag)]))]
-                    (db/transact! [[:db/add (:db/id edit-block) :block/tags (:db/id tag-entity)]
-                                   [:db/add (:db/id edit-block) :block/refs (:db/id tag-entity)]]))))))
+                    (db/transact! [[:db/add [:block/uuid (:block/uuid edit-block)] :block/tags (:db/id tag-entity)]
+                                   [:db/add [:block/uuid (:block/uuid edit-block)] :block/refs (:db/id tag-entity)]]))))))
 
           (editor-handler/insert-command! id
                                           (str "#" (when wrapped? page-ref/left-brackets) chosen)