Browse Source

enhance: display type block editing check

`state/get-edit-block` returns the block when it's going to be edited,
we need to get the current block value to determine whether it's a
display type block, because adding #quote/math/query can happen during
the editing phase.
Tienson Qin 5 tháng trước cách đây
mục cha
commit
6101ecd785
1 tập tin đã thay đổi với 2 bổ sung6 xóa
  1. 2 6
      src/main/frontend/handler/paste.cljs

+ 2 - 6
src/main/frontend/handler/paste.cljs

@@ -239,12 +239,8 @@
 (defn- editing-display-type-block?
   []
   (boolean
-   (when-let [editing-block (state/get-edit-block)]
-     ;; FIXME: `logseq.property.node/display-type` doesn't exist within the editing-block when pasting
-     ;; Therefore, now using `querySelectorAll` to determine if we are editing a quote block
-     ;; (contains? #{:quote :math} (:logseq.property.node/display-type editing-block))
-     (let [selector (str "#ls-block-" (:block/uuid editing-block) " [data-node-type]")]
-       (some? (seq (js/document.querySelectorAll selector)))))))
+   (when-let [editing-block (some-> (state/get-edit-block) :db/id db/entity)]
+     (:logseq.property.node/display-type editing-block))))
 
 (defn- paste-text-or-blocks-aux
   [input e text html]