Browse Source

fix: links not resolving

fixes https://github.com/logseq/db-test/issues/311
Tienson Qin 7 months ago
parent
commit
fac981bea0

+ 4 - 4
src/main/frontend/components/block.cljs

@@ -615,10 +615,10 @@
   [config page-entity e page-name contents-page?]
   [config page-entity e page-name contents-page?]
   (when (not (util/right-click? e))
   (when (not (util/right-click? e))
     (p/let [ignore-alias? (:ignore-alias? config)
     (p/let [ignore-alias? (:ignore-alias? config)
-            page (or (and (not ignore-alias?)
-                          (or (first (:block/_alias page-entity))
-                              (db-async/<get-block-source (state/get-current-repo) (:db/id page-entity))))
-                     page-entity)]
+            source-page (and (not ignore-alias?)
+                             (or (first (:block/_alias page-entity))
+                                 (db-async/<get-block-source (state/get-current-repo) (:db/id page-entity))))
+            page (or source-page page-entity)]
       (cond
       (cond
         (gobj/get e "shiftKey")
         (gobj/get e "shiftKey")
         (when page
         (when page

+ 1 - 1
src/main/frontend/components/page.cljs

@@ -108,7 +108,7 @@
     (when page?
     (when page?
       [:div.ls-block.block-add-button.flex-1.flex-col.rounded-sm.cursor-text.transition-opacity.ease-in.duration-100.!py-0
       [:div.ls-block.block-add-button.flex-1.flex-col.rounded-sm.cursor-text.transition-opacity.ease-in.duration-100.!py-0
        {:class opacity-class
        {:class opacity-class
-        :data-blockId (:db/id block)
+        :data-block-id (:db/id block)
         :ref *ref
         :ref *ref
         :on-click (fn [e]
         :on-click (fn [e]
                     (util/stop e)
                     (util/stop e)

+ 4 - 4
src/main/frontend/handler/common/page.cljs

@@ -2,7 +2,8 @@
   "Common fns for file and db based page handlers, including create!, delete!
   "Common fns for file and db based page handlers, including create!, delete!
   and favorite fns. This ns should be agnostic of file or db concerns but there
   and favorite fns. This ns should be agnostic of file or db concerns but there
   is still some file-specific tech debt to remove from create!"
   is still some file-specific tech debt to remove from create!"
-  (:require [clojure.string :as string]
+  (:require [clojure.set :as set]
+            [clojure.string :as string]
             [datascript.core :as d]
             [datascript.core :as d]
             [dommy.core :as dom]
             [dommy.core :as dom]
             [frontend.config :as config]
             [frontend.config :as config]
@@ -21,8 +22,7 @@
             [logseq.common.util :as common-util]
             [logseq.common.util :as common-util]
             [logseq.common.util.page-ref :as page-ref]
             [logseq.common.util.page-ref :as page-ref]
             [logseq.db :as ldb]
             [logseq.db :as ldb]
-            [promesa.core :as p]
-            [clojure.set :as set]))
+            [promesa.core :as p]))
 
 
 (defn- wrap-tags
 (defn- wrap-tags
   "Tags might have multiple words"
   "Tags might have multiple words"
@@ -83,7 +83,7 @@
                  (js/setTimeout
                  (js/setTimeout
                   (fn []
                   (fn []
                     (when-let [block-add-button (->> (dom/sel ".block-add-button")
                     (when-let [block-add-button (->> (dom/sel ".block-add-button")
-                                                     (filter #(= (str (:db/id page)) (dom/attr % "data-blockId")))
+                                                     (filter #(= (str (:db/id page)) (dom/attr % "data-block-id")))
                                                      first)]
                                                      first)]
                       (.click block-add-button)))
                       (.click block-add-button)))
                   200)))
                   200)))