|
|
@@ -1,6 +1,7 @@
|
|
|
(ns frontend.handler.dnd
|
|
|
"Provides fns for drag and drop"
|
|
|
- (:require [frontend.db :as db]
|
|
|
+ (:require [frontend.config :as config]
|
|
|
+ [frontend.db :as db]
|
|
|
[frontend.handler.block :as block-handler]
|
|
|
[frontend.handler.editor :as editor-handler]
|
|
|
[frontend.handler.property :as property-handler]
|
|
|
@@ -8,6 +9,7 @@
|
|
|
[frontend.modules.outliner.ui :as ui-outliner-tx]
|
|
|
[frontend.state :as state]
|
|
|
[logseq.common.util.block-ref :as block-ref]
|
|
|
+ [logseq.common.util.page-ref :as page-ref]
|
|
|
[logseq.db :as ldb]))
|
|
|
|
|
|
(defn move-blocks
|
|
|
@@ -25,10 +27,10 @@
|
|
|
(cond
|
|
|
;; alt pressed, make a block-ref
|
|
|
(and alt-key? (= (count blocks) 1))
|
|
|
- (do
|
|
|
+ (let [->ref (if (config/db-based-graph?) page-ref/->page-ref block-ref/->block-ref)]
|
|
|
(property-handler/file-persist-block-id! (state/get-current-repo) (:block/uuid first-block))
|
|
|
(editor-handler/api-insert-new-block!
|
|
|
- (block-ref/->block-ref (:block/uuid first-block))
|
|
|
+ (->ref (:block/uuid first-block))
|
|
|
{:block-uuid (:block/uuid target-block)
|
|
|
:sibling? (not nested?)
|
|
|
:before? top?}))
|