Tienson Qin 10 месяцев назад
Родитель
Сommit
c1a336372d

+ 3 - 3
clj-e2e/test/logseq/e2e/reference_basic_test.clj

@@ -43,7 +43,7 @@
     (b/wait-editor-text "b2")
     (b/paste)
     (util/exit-edit)
-    (b/assert-blocks-visible ["b1b2" "b2b1"])))
+    (b/assert-blocks-visible ["b1[[b2]]" "b2[[b1]]"])))
 
 (deftest parent-reference
   (testing "parent reference"
@@ -59,7 +59,7 @@
     (b/wait-editor-text "b2")
     (b/paste)
     (util/exit-edit)
-    (b/assert-blocks-visible ["b1b2" "b2b1"])))
+    (b/assert-blocks-visible ["b1[[b2]]" "b2[[b1]]"])))
 
 (deftest cycle-reference
   (testing "cycle reference"
@@ -80,6 +80,6 @@
     (assert/assert-editor-mode)
     (b/paste)
     (util/exit-edit)
-    (b/assert-blocks-visible ["b1b3b2" "b2b1b3" "b3b2b1"])))
+    (b/assert-blocks-visible ["b1[[b3[[b2]]]]" "b2[[b1[[b3]]]]" "b3[[b2[[b1]]]]"])))
 
 ;; TODO: page references

+ 6 - 3
src/main/frontend/components/block.cljs

@@ -1071,7 +1071,10 @@
   [{:keys [html-export? nested-link? show-brackets? id] :as config*} uuid-or-title* label]
   (when uuid-or-title*
     (let [uuid-or-title (if (string? uuid-or-title*)
-                          (string/trim uuid-or-title*)
+                          (let [str-id (string/trim uuid-or-title*)]
+                            (if (util/uuid-string? str-id)
+                              (parse-uuid str-id)
+                              str-id))
                           uuid-or-title*)
           self-reference? (when (set? (:ref-set config*))
                             (contains? (:ref-set config*) uuid-or-title))]
@@ -1079,8 +1082,8 @@
         (let [config (update config* :ref-set (fn [s]
                                                 (let [bid (:block/uuid (:block config*))]
                                                   (if (nil? s)
-                                                    #{uuid-or-title*}
-                                                    (conj s bid uuid-or-title*)))))
+                                                    #{bid}
+                                                    (conj s bid uuid-or-title)))))
               show-brackets? (if (some? show-brackets?) show-brackets? (state/show-brackets?))
               contents-page? (= "contents" (string/lower-case (str id)))
               block* (db/get-page uuid-or-title)