Jelajahi Sumber

Move block-ref fns and vars to their own ns

Similar to page-ref to keep namespaces explicit
Gabriel Horner 3 tahun lalu
induk
melakukan
4ec5827902

+ 2 - 1
.clj-kondo/config.edn

@@ -33,7 +33,8 @@
              logseq.graph-parser.property gp-property
              logseq.graph-parser.config gp-config
              logseq.graph-parser.date-time-util date-time-util
-             logseq.graph-parser.util.page-ref page-ref}}}
+             logseq.graph-parser.util.page-ref page-ref
+             logseq.graph-parser.util.block-ref block-ref}}}
 
  :hooks {:analyze-call {rum.core/defc hooks.rum/defc
                         rum.core/defcs hooks.rum/defcs}}

+ 4 - 4
deps/graph-parser/.carve/ignore

@@ -5,13 +5,13 @@ logseq.graph-parser.mldoc/ast-export-markdown
 ;; API
 logseq.graph-parser.property/register-built-in-properties
 ;; API
-logseq.graph-parser.block/left-and-right-parens
+logseq.graph-parser.util.block-ref/left-and-right-parens
 ;; API
-logseq.graph-parser.block/->block-ref
+logseq.graph-parser.util.block-ref/->block-ref
 ;; API
-logseq.graph-parser.block/block-ref?
+logseq.graph-parser.util.block-ref/block-ref?
 ;; API
-logseq.graph-parser.block/get-all-block-ref-ids
+logseq.graph-parser.util.block-ref/get-all-block-ref-ids
 ;; API
 logseq.graph-parser.util.page-ref/left-and-right-brackets
 ;; API

+ 2 - 1
deps/graph-parser/.clj-kondo/config.edn

@@ -10,6 +10,7 @@
              logseq.graph-parser.property gp-property
              logseq.graph-parser.config gp-config
              logseq.graph-parser.date-time-util date-time-util
-             logseq.graph-parser.util.page-ref page-ref}}}
+             logseq.graph-parser.util.page-ref page-ref
+             logseq.graph-parser.util.block-ref block-ref}}}
  :skip-comments true
  :output {:progress true}}

+ 5 - 42
deps/graph-parser/src/logseq/graph_parser/block.cljs

@@ -11,6 +11,7 @@
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.utf8 :as utf8]
             [logseq.graph-parser.util :as gp-util]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [logseq.graph-parser.util.page-ref :as page-ref]))
 
 (defn heading-block?
@@ -33,44 +34,6 @@
                   "")))
          (string/join))))
 
-(def left-parens "Opening characters for block-ref" "((")
-(def right-parens "Closing characters for block-ref" "))")
-(def left-and-right-parens "Opening and closing characters for block-ref"
-  (str left-parens right-parens))
-(def block-ref-re #"\(\(([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})\)\)")
-
-(defn get-all-block-ref-ids
-  [content]
-  (map second (re-seq block-ref-re content)))
-
-(defn get-block-ref-id
-  "Extracts block id from block-ref using regex"
-  [s]
-  (second (re-matches block-ref-re s)))
-
-(defn get-string-block-ref-id
-  "Extracts block id from block-ref by stripping parens e.g. ((123)) -> 123.
-  This is a less strict version of get-block-ref-id"
-  [s]
-  (subs s 2 (- (count s) 2)))
-
-(defn block-ref?
-  "Determines if string is block ref using regex"
-  [s]
-  (boolean (get-block-ref-id s)))
-
-(defn string-block-ref?
-  "Determines if string is block ref by checking parens. This is less strict version
-of block-ref?"
-  [s]
-  (and (string/starts-with? s left-parens)
-       (string/ends-with? s right-parens)))
-
-(defn ->block-ref
-  "Creates block ref string given id"
-  [block-id]
-  (str left-parens block-id right-parens))
-
 (defn- get-page-reference
   [block supported-formats]
   (let [page (cond
@@ -130,7 +93,7 @@ of block-ref?"
 
                :else
                nil)]
-    (when page (or (get-block-ref-id page) page))))
+    (when page (or (block-ref/get-block-ref-id page) page))))
 
 (defn- get-block-reference
   [block]
@@ -150,8 +113,8 @@ of block-ref?"
                         (let [{:keys [name arguments]} (second block)]
                           (when (and (= name "embed")
                                      (string? (first arguments))
-                                     (string-block-ref? (first arguments)))
-                            (get-string-block-ref-id (first arguments))))
+                                     (block-ref/string-block-ref? (first arguments)))
+                            (block-ref/get-string-block-ref-id (first arguments))))
 
                         (and (vector? block)
                              (= "Link" (first block))
@@ -161,7 +124,7 @@ of block-ref?"
                           (let [id (second (:url (second block)))]
                             ;; these can be maps
                             (when (string? id)
-                              (or (get-block-ref-id id) id))))
+                              (or (block-ref/get-block-ref-id id) id))))
 
                         :else
                         nil)]

+ 41 - 0
deps/graph-parser/src/logseq/graph_parser/util/block_ref.cljs

@@ -0,0 +1,41 @@
+(ns logseq.graph-parser.util.block-ref
+  "General purpose vars and util fns for block-refs"
+  (:require [clojure.string :as string]))
+
+(def left-parens "Opening characters for block-ref" "((")
+(def right-parens "Closing characters for block-ref" "))")
+(def left-and-right-parens "Opening and closing characters for block-ref"
+  (str left-parens right-parens))
+(def block-ref-re #"\(\(([a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})\)\)")
+
+(defn get-all-block-ref-ids
+  [content]
+  (map second (re-seq block-ref-re content)))
+
+(defn get-block-ref-id
+  "Extracts block id from block-ref using regex"
+  [s]
+  (second (re-matches block-ref-re s)))
+
+(defn get-string-block-ref-id
+  "Extracts block id from block-ref by stripping parens e.g. ((123)) -> 123.
+  This is a less strict version of get-block-ref-id"
+  [s]
+  (subs s 2 (- (count s) 2)))
+
+(defn block-ref?
+  "Determines if string is block ref using regex"
+  [s]
+  (boolean (get-block-ref-id s)))
+
+(defn string-block-ref?
+  "Determines if string is block ref by checking parens. This is less strict version
+of block-ref?"
+  [s]
+  (and (string/starts-with? s left-parens)
+       (string/ends-with? s right-parens)))
+
+(defn ->block-ref
+  "Creates block ref string given id"
+  [block-id]
+  (str left-parens block-id right-parens))

+ 3 - 3
src/main/frontend/commands.cljs

@@ -17,9 +17,9 @@
             [frontend.util.property :as property]
             [logseq.graph-parser.util :as gp-util]
             [logseq.graph-parser.config :as gp-config]
-            [logseq.graph-parser.block :as gp-block]
             [logseq.graph-parser.property :as gp-property]
             [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [goog.dom :as gdom]
             [goog.object :as gobj]
             [promesa.core :as p]))
@@ -221,7 +221,7 @@
     [["Page reference" [[:editor/input page-ref/left-and-right-brackets {:backward-pos 2}]
                         [:editor/search-page]] "Create a backlink to a page"]
      ["Page embed" (embed-page) "Embed a page here"]
-     ["Block reference" [[:editor/input gp-block/left-and-right-parens {:backward-pos 2}]
+     ["Block reference" [[:editor/input block-ref/left-and-right-parens {:backward-pos 2}]
                          [:editor/search-block :reference]] "Create a backlink to a block"]
      ["Block embed" (embed-block) "Embed a block here" "Embed a block here"]
      ["Link" (link-steps) "Create a HTTP link"]
@@ -343,7 +343,7 @@
                                    (or
                                     (and s
                                          (string/ends-with? s "(")
-                                         (or (string/starts-with? last-pattern gp-block/left-parens)
+                                         (or (string/starts-with? last-pattern block-ref/left-parens)
                                              (string/starts-with? last-pattern page-ref/left-brackets)))
                                     (and s (string/starts-with? s "{{embed"))
                                     (and last-pattern

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

@@ -65,6 +65,7 @@
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.util :as gp-util]
             [logseq.graph-parser.util.page-ref :as page-ref]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [medley.core :as medley]
             [promesa.core :as p]
             [reitit.frontend.easy :as rfe]
@@ -788,7 +789,7 @@
                         :delay       [1000, 100]} inner)
              inner)])
         [:span.warning.mr-1 {:title "Block ref invalid"}
-         (gp-block/->block-ref id)]))))
+         (block-ref/->block-ref id)]))))
 
 (defn inline-text
   ([format v]
@@ -931,8 +932,8 @@
          (not= \* (last s)))
     (->elem :a {:on-click #(route-handler/jump-to-anchor! (mldoc/anchorLink (subs s 1)))} (subs s 1))
 
-    (gp-block/block-ref? s)
-    (let [id (gp-block/get-block-ref-id s)]
+    (block-ref/block-ref? s)
+    (let [id (block-ref/get-block-ref-id s)]
       (block-reference config id label))
 
     (not (string/includes? s "."))
@@ -1120,8 +1121,8 @@
         (when-not (string/blank? page-name)
           (page-embed (assoc config :link-depth (inc link-depth)) page-name)))
 
-      (gp-block/string-block-ref? a)
-      (when-let [s (-> gp-block/get-string-block-ref-id string/trim)]
+      (block-ref/string-block-ref? a)
+      (when-let [s (-> block-ref/get-string-block-ref-id string/trim)]
         (when-let [id (some-> s parse-uuid)]
           (block-embed (assoc config :link-depth (inc link-depth)) id)))
 
@@ -2152,7 +2153,7 @@
         editor-id (str "editor-" edit-input-id)
         slide? (:slide? config)
         trimmed-content (string/trim (:block/content block))
-        block-reference-only? (gp-block/block-ref? trimmed-content)]
+        block-reference-only? (block-ref/block-ref? trimmed-content)]
     (if (and edit? editor-box)
       [:div.editor-wrapper {:id editor-id}
        (ui/catch-error

+ 2 - 2
src/main/frontend/components/content.cljs

@@ -22,7 +22,7 @@
             [frontend.ui :as ui]
             [frontend.util :as util]
             [logseq.graph-parser.util :as gp-util]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [frontend.util.url :as url-util]
             [goog.dom :as gdom]
             [goog.object :as gobj]
@@ -208,7 +208,7 @@
           (ui/menu-link
            {:key      "Copy block ref"
             :on-click (fn [_e]
-                        (editor-handler/copy-block-ref! block-id gp-block/->block-ref))}
+                        (editor-handler/copy-block-ref! block-id block-ref/->block-ref))}
            "Copy block ref")
 
           (ui/menu-link

+ 2 - 2
src/main/frontend/components/shortcut.cljs

@@ -7,7 +7,7 @@
             [frontend.ui :as ui]
             [frontend.extensions.latex :as latex]
             [frontend.extensions.highlight :as highlight]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [logseq.graph-parser.util.page-ref :as page-ref]
             [rum.core :as rum]))
 
@@ -102,7 +102,7 @@
      [:td.text-right [:code page-ref/left-and-right-brackets]]]
     [:tr
      [:td.text-left (t :help/block-reference)]
-     [:td.text-right [:code gp-block/left-and-right-parens]]]
+     [:td.text-right [:code block-ref/left-and-right-parens]]]
     [:tr
      [:td.text-left (t :command.editor/open-link-in-sidebar)]
      [:td.text-right (ui/render-keyboard-shortcut ["shift" "click"])]]

+ 2 - 2
src/main/frontend/extensions/pdf/assets.cljs

@@ -11,7 +11,7 @@
             [frontend.state :as state]
             [frontend.util :as util]
             [logseq.graph-parser.config :as gp-config]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [medley.core :as medley]
             [promesa.core :as p]
             [reitit.frontend.easy :as rfe]
@@ -214,7 +214,7 @@
 (defn copy-hl-ref!
   [highlight]
   (when-let [ref-block (create-ref-block! highlight)]
-    (util/copy-to-clipboard! (gp-block/->block-ref (:block/uuid ref-block)))))
+    (util/copy-to-clipboard! (block-ref/->block-ref (:block/uuid ref-block)))))
 
 (defn open-block-ref!
   [block]

+ 2 - 2
src/main/frontend/external/roam.cljs

@@ -5,7 +5,7 @@
             [clojure.walk :as walk]
             [clojure.string :as string]
             [goog.string :as gstring]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [logseq.graph-parser.util :as gp-util]
             [logseq.graph-parser.text :as text]))
 
@@ -31,7 +31,7 @@
   [text]
   (string/replace text uid-pattern (fn [[_ uid]]
                                      (let [id (get @uid->uuid uid uid)]
-                                       (gp-block/->block-ref id)))))
+                                       (block-ref/->block-ref id)))))
 
 (defn macro-transform
   [text]

+ 2 - 2
src/main/frontend/fs/watcher_handler.cljs

@@ -9,7 +9,7 @@
             [frontend.handler.repo :as repo-handler]
             [frontend.handler.ui :as ui-handler]
             [logseq.graph-parser.util :as gp-util]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [lambdaisland.glogi :as log]
             [electron.ipc :as ipc]
             [promesa.core :as p]
@@ -22,7 +22,7 @@
 (defn- set-missing-block-ids!
   [content]
   (when (string? content)
-    (doseq [block-id (gp-block/get-all-block-ref-ids content)]
+    (doseq [block-id (block-ref/get-all-block-ref-ids content)]
       (when-let [block (try
                          (model/get-block-by-uuid block-id)
                          (catch js/Error _e

+ 2 - 2
src/main/frontend/handler/dnd.cljs

@@ -3,7 +3,7 @@
             [frontend.modules.outliner.core :as outliner-core]
             [frontend.modules.outliner.tree :as tree]
             [frontend.modules.outliner.transaction :as outliner-tx]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [frontend.state :as state]))
 
 (defn move-blocks
@@ -23,7 +23,7 @@
                                             :id
                                             (str (:block/uuid first-block)))
         (editor-handler/api-insert-new-block!
-         (gp-block/->block-ref (:block/uuid first-block))
+         (block-ref/->block-ref (:block/uuid first-block))
          {:block-uuid (:block/uuid target-block)
           :sibling? (not nested?)
           :before? top?}))

+ 20 - 19
src/main/frontend/handler/editor.cljs

@@ -51,6 +51,7 @@
             [lambdaisland.glogi :as log]
             [promesa.core :as p]
             [logseq.graph-parser.util :as gp-util]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [logseq.graph-parser.util.page-ref :as page-ref]
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.graph-parser.block :as gp-block]))
@@ -364,7 +365,7 @@
                                (nil? (:size first-elem-meta)))
         block-with-title? (mldoc/block-with-title? first-elem-type)
         content (string/triml content)
-        content (string/replace content (gp-block/->block-ref uuid) "")
+        content (string/replace content (block-ref/->block-ref uuid) "")
         [content content'] (cond
                              (and first-block? properties?)
                              [content content]
@@ -1032,9 +1033,9 @@
                             (map (fn [{:keys [id level]}]
                                    (condp = (:block/format block)
                                      :org
-                                     (str (string/join (repeat level "*")) " " (gp-block/->block-ref id))
+                                     (str (string/join (repeat level "*")) " " (block-ref/->block-ref id))
                                      :markdown
-                                     (str (string/join (repeat (dec level) "\t")) "- " (gp-block/->block-ref id)))))
+                                     (str (string/join (repeat (dec level) "\t")) "- " (block-ref/->block-ref id)))))
                             (string/join "\n\n"))]
       (set-blocks-id! (map :id blocks))
       (util/copy-to-clipboard! copy-str))))
@@ -1094,7 +1095,7 @@
         page-pattern #"\[\[([^\]]+)]]"
         tag-pattern #"#\S+"
         page-matches (util/re-pos page-pattern text)
-        block-matches (util/re-pos gp-block/block-ref-re text)
+        block-matches (util/re-pos block-ref/block-ref-re text)
         tag-matches (util/re-pos tag-pattern text)
         additional-matches (mapcat #(util/re-pos % text) additional-patterns)
         matches (->> (concat page-matches block-matches tag-matches additional-matches)
@@ -1559,7 +1560,7 @@
             (commands/handle-step [:editor/search-page])
             (state/set-editor-action-data! {:pos (cursor/get-caret-pos input)}))
 
-          (= prefix gp-block/left-parens)
+          (= prefix block-ref/left-parens)
           (do
             (commands/handle-step [:editor/search-block :reference])
             (state/set-editor-action-data! {:pos (cursor/get-caret-pos input)})))))))
@@ -1876,11 +1877,11 @@
 
       ;; block reference
       (insert-command! id
-                       (gp-block/->block-ref uuid-string)
+                       (block-ref/->block-ref uuid-string)
                        format
-                       {:last-pattern (str gp-block/left-parens (if @*selected-text "" q))
-                        :end-pattern gp-block/right-parens
-                        :postfix-fn   (fn [s] (util/replace-first gp-block/right-parens s ""))
+                       {:last-pattern (str block-ref/left-parens (if @*selected-text "" q))
+                        :end-pattern block-ref/right-parens
+                        :postfix-fn   (fn [s] (util/replace-first block-ref/right-parens s ""))
                         :forward-pos 3})
 
       ;; Save it so it'll be parsed correctly in the future
@@ -2346,7 +2347,7 @@
           (let [{:keys [raw-content start end]} embed-ref]
             (delete-and-update input start end)
             (if (= 5 (count raw-content))
-              (block-ref-fn gp-block/left-and-right-parens 2)
+              (block-ref-fn block-ref/left-and-right-parens 2)
               (insert raw-content)))
           (if-let [page-ref (thingatpt/block-ref-at-point input)]
             (let [{:keys [start end full-content raw-content]} page-ref]
@@ -2354,7 +2355,7 @@
               (if (= raw-content "")
                 (block-ref-fn "{{embed (())}}" 4)
                 (insert (util/format "{{embed %s}}" full-content))))
-            (block-ref-fn gp-block/left-and-right-parens 2)))))))
+            (block-ref-fn block-ref/left-and-right-parens 2)))))))
 
 (defn- keydown-new-block
   [state]
@@ -2892,9 +2893,9 @@
                    (contains? keycode/left-paren-keys k)
                    (= (:key last-key-code) k)
                    (> current-pos 0)
-                   (not (wrapped-by? input gp-block/left-parens gp-block/right-parens)))
+                   (not (wrapped-by? input block-ref/left-parens block-ref/right-parens)))
               (do
-                (commands/handle-step [:editor/input gp-block/left-and-right-parens {:backward-truncate-number 2
+                (commands/handle-step [:editor/input block-ref/left-and-right-parens {:backward-truncate-number 2
                                                              :backward-pos 2}])
                 (commands/handle-step [:editor/search-block :reference])
                 (state/set-editor-action-data! {:pos (cursor/get-caret-pos input)}))
@@ -2967,13 +2968,13 @@
     (when-let [block-id (:block/uuid current-block)]
       (if (= format "embed")
        (copy-block-ref! block-id #(str "{{embed ((" % "))}}"))
-       (copy-block-ref! block-id gp-block/->block-ref))
+       (copy-block-ref! block-id block-ref/->block-ref))
       (notification/show!
        [:div
         [:span.mb-1.5 (str "Block " format " copied!")]
         [:div [:code.whitespace.break-all (if (= format "embed")
                                          (str "{{embed ((" block-id "))}}")
-                                         (gp-block/->block-ref block-id))]]]
+                                         (block-ref/->block-ref block-id))]]]
        :success true
        ;; use uuid to make sure there is only one toast a time
        (str "copied-block-ref:" block-id)))))
@@ -3421,13 +3422,13 @@
 (defn copy-current-ref
   [block-id]
   (when block-id
-    (util/copy-to-clipboard! (gp-block/->block-ref block-id))))
+    (util/copy-to-clipboard! (block-ref/->block-ref block-id))))
 
 (defn delete-current-ref!
   [block ref-id]
   (when (and block ref-id)
     (let [match (re-pattern (str "\\s?"
-                                 (string/replace (gp-block/->block-ref ref-id) #"([\(\)])" "\\$1")))
+                                 (string/replace (block-ref/->block-ref ref-id) #"([\(\)])" "\\$1")))
           content (string/replace-first (:block/content block) match "")]
       (save-block! (state/get-current-repo)
                    (:block/uuid block)
@@ -3436,7 +3437,7 @@
 (defn replace-ref-with-text!
   [block ref-id]
   (when (and block ref-id)
-    (let [match (gp-block/->block-ref ref-id)
+    (let [match (block-ref/->block-ref ref-id)
           ref-block (db/entity [:block/uuid ref-id])
           block-ref-content (->> (or (:block/content ref-block)
                                      "")
@@ -3451,7 +3452,7 @@
 (defn replace-ref-with-embed!
   [block ref-id]
   (when (and block ref-id)
-    (let [match (gp-block/->block-ref ref-id)
+    (let [match (block-ref/->block-ref ref-id)
           content (string/replace-first (:block/content block) match
                                         (util/format "{{embed ((%s))}}"
                                                      (str ref-id)))]

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

@@ -23,7 +23,7 @@
             [lambdaisland.glogi :as log]
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.graph-parser.util :as gp-util]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [logseq.graph-parser.util.page-ref :as page-ref]
             [promesa.core :as p]
             [frontend.handler.notification :as notification])
@@ -187,9 +187,9 @@
                                                 (string/lower-case)))
                              (some-> (:arguments (second i))
                                      (first)
-                                     gp-block/string-block-ref?))
+                                     block-ref/string-block-ref?))
                         (let [arguments (:arguments (second i))
-                              block-uuid (gp-block/get-string-block-ref-id (first arguments))]
+                              block-uuid (block-ref/get-string-block-ref-id (first arguments))]
                           (conj! result block-uuid)
                           i)
                         :else

+ 4 - 3
src/main/frontend/handler/paste.cljs

@@ -5,6 +5,7 @@
             [logseq.graph-parser.util :as gp-util]
             [logseq.graph-parser.mldoc :as gp-mldoc]
             [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [clojure.string :as string]
             [frontend.util :as util]
             [frontend.handler.editor :as editor-handler]
@@ -80,9 +81,9 @@
                (not (string/blank? (util/get-selected-text))))
           (editor-handler/html-link-format! text)
 
-          (and (gp-block/block-ref? text)
-               (editor-handler/wrapped-by? input gp-block/left-parens gp-block/right-parens))
-          (commands/simple-insert! (state/get-edit-input-id) (gp-block/get-block-ref-id text) nil)
+          (and (block-ref/block-ref? text)
+               (editor-handler/wrapped-by? input block-ref/left-parens block-ref/right-parens))
+          (commands/simple-insert! (state/get-edit-input-id) (block-ref/get-block-ref-id text) nil)
 
           :else
           ;; from external

+ 2 - 2
src/main/frontend/mobile/action_bar.cljs

@@ -11,7 +11,7 @@
    [goog.dom :as gdom]
    [goog.object :as gobj]
    [rum.core :as rum]
-   [logseq.graph-parser.block :as gp-block]
+   [logseq.graph-parser.util.block-ref :as block-ref]
    [frontend.mobile.util :as mobile-util]))
 
 (defn- action-command
@@ -64,7 +64,7 @@
         (action-command "cut" "Cut" #(editor-handler/cut-selection-blocks true))
         (action-command "trash" "Delete" #(editor-handler/delete-block-aux! block true))
         (action-command "registered" "Copy ref"
-                        (fn [_event] (editor-handler/copy-block-ref! uuid gp-block/->block-ref)))
+                        (fn [_event] (editor-handler/copy-block-ref! uuid block-ref/->block-ref)))
         (action-command "link" "Copy url"
                         (fn [_event] (let [current-repo (state/get-current-repo)
                                            tap-f (fn [block-id]

+ 2 - 2
src/main/frontend/util/thingatpt.cljs

@@ -5,7 +5,7 @@
             [frontend.config :as config]
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.property :as gp-property]
-            [logseq.graph-parser.block :as gp-block]
+            [logseq.graph-parser.util.block-ref :as block-ref]
             [logseq.graph-parser.util.page-ref :as page-ref]
             [cljs.reader :as reader]
             [goog.object :as gobj]))
@@ -48,7 +48,7 @@
          :end line-end-pos}))))
 
 (defn block-ref-at-point [& [input]]
-  (when-let [block-ref (thing-at-point [gp-block/left-parens gp-block/right-parens] input " ")]
+  (when-let [block-ref (thing-at-point [block-ref/left-parens block-ref/right-parens] input " ")]
     (when-let [uuid (uuid (:raw-content block-ref))]
       (assoc block-ref
              :type "block-ref"