Просмотр исходного кода

fix: can't copy PDF highlights refs

fix https://github.com/logseq/db-test/issues/673
fix https://github.com/logseq/db-test/issues/650
Tienson Qin 1 день назад
Родитель
Сommit
a97fec165f
1 измененных файлов с 7 добавлено и 8 удалено
  1. 7 8
      src/main/frontend/extensions/pdf/assets.cljs

+ 7 - 8
src/main/frontend/extensions/pdf/assets.cljs

@@ -188,14 +188,13 @@
 (defn ensure-ref-block!
   [pdf-current hl insert-opts]
   (if (config/db-based-graph? (state/get-current-repo))
-    (p/chain
-     (db-based-ensure-ref-block! pdf-current hl insert-opts)
-     (fn []
-       ;; try to move the asset block to the ref block
-       (let [ref-block (db-model/query-block-by-uuid (:id hl))
-             asset-block (:logseq.property.pdf/hl-image ref-block)]
-         (when asset-block
-           (editor-handler/move-blocks! [asset-block] ref-block {:sibling? false})))))
+    (p/let [ref-block (db-based-ensure-ref-block! pdf-current hl insert-opts)
+            asset-block (:logseq.property.pdf/hl-image ref-block)]
+      ;; try to move the asset block to the ref block
+      (p/do!
+       (when asset-block
+         (editor-handler/move-blocks! [asset-block] ref-block {:sibling? false}))
+       ref-block))
     (file-based-ensure-ref-block! pdf-current hl insert-opts)))
 
 (defn file-based-load-hls-data$