diff --git a/deps/db/src/logseq/db/common/initial_data.cljs b/deps/db/src/logseq/db/common/initial_data.cljs index 0f4ecf1e4e..a8df3ae83d 100644 --- a/deps/db/src/logseq/db/common/initial_data.cljs +++ b/deps/db/src/logseq/db/common/initial_data.cljs @@ -201,7 +201,11 @@ (defn ^:large-vars/cleanup-todo get-block-and-children [db id-or-page-name {:keys [children? children-only? nested-children? properties children-props]}] - (let [block (let [eid (cond (uuid? id-or-page-name) [:block/uuid id-or-page-name] (integer? id-or-page-name) id-or-page-name :else nil)] + (let [block (let [eid (cond (uuid? id-or-page-name) + [:block/uuid id-or-page-name] + (integer? id-or-page-name) + id-or-page-name + :else nil)] (cond eid (d/entity db eid) diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index be9ee94257..cab3b3dd17 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -611,11 +611,14 @@ (declare page-reference) -(defn open-page-ref +(defn alias: " source-page) title)] + title' (if source-page (str title " -> alias: " (:block/title source-page)) title)] (hash-map :icon icon :icon-theme :gray :text title' - :source-page (or source-page page)))) + :source-page (or source-page page) + :alias (:alias page)))) (defn- block-item [repo block current-page !input] @@ -437,9 +438,11 @@ (defn- get-highlighted-page-uuid-or-name [state] - (let [highlighted-item (some-> state state->highlighted-item)] - (or (:block/uuid (:source-block highlighted-item)) - (:block/uuid (:source-page highlighted-item))))) + (let [highlighted-item (some-> state state->highlighted-item) + block (or (:alias highlighted-item) + (:source-block highlighted-item) + (:source-page highlighted-item))] + (:block/uuid block))) (defmethod handle-action :open-page [_ state _event] (when-let [page-name (get-highlighted-page-uuid-or-name state)] diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index 9689e89c59..962b7af6e7 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -223,7 +223,7 @@ :else (ui/icon "letter-n" {:size 14}))]) - (let [title (let [alias (:alias block') + (let [title (let [alias (get-in block' [:alias :block/title]) title (if (and db-based? (not (ldb/built-in? block'))) (block-handler/block-unique-title block') (:block/title block'))] diff --git a/src/main/frontend/db/async.cljs b/src/main/frontend/db/async.cljs index 624789acdc..92d9466026 100644 --- a/src/main/frontend/db/async.cljs +++ b/src/main/frontend/db/async.cljs @@ -151,6 +151,13 @@ _ (d/transact! conn result)] result))) +(defn (first (:block/_alias block)) + (select-keys [:block/uuid :block/title]))})))))) page-or-object-result (filter (fn [b] (or (:page? b) (:block/tags result))) result)] (->> (concat page-or-object-result