Skip to content

Commit 46c4f66

Browse files
committed
fix: allow moving non page blocks to library on UI
1 parent 97e8140 commit 46c4f66

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

deps/outliner/src/logseq/outliner/core.cljs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
(defn- remove-inline-page-classes
241241
[db {:block/keys [tags] :as block}]
242242
;; Notice: should check `page?` for block from the current db
243-
(if (ldb/page? (d/entity db (:db/id block)))
243+
(if (or (ldb/page? (d/entity db (:db/id block))) (:block/name block))
244244
block
245245
(let [tags' (cond
246246
(or (integer? tags)
@@ -922,10 +922,8 @@
922922
(let [target-block (d/entity db (:db/id target-block))
923923
block (d/entity db (:db/id block))]
924924
(if (or
925-
;; target-block doesn't have parent or moving non-page block to library
926-
(and sibling? (or (nil? (:block/parent target-block))
927-
(and (not (ldb/page? block))
928-
(ldb/library? (:block/parent target-block)))))
925+
;; target-block doesn't have parent
926+
(and sibling? (nil? (:block/parent target-block)))
929927
;; move page to be a child of block
930928
(and (not sibling?)
931929
(not (ldb/page? target-block))

src/main/frontend/worker/pipeline.cljs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,7 @@
183183
page-tag-update? (and (= :block/tags (:a datom))
184184
(= (:db/id page-tag) (:v datom)))
185185
move-to-library? (and (= :block/parent (:a datom))
186-
(or (= (:db/id library-page) (:v datom))
187-
(and
188-
(ldb/page? (d/entity db (:v datom)))
189-
(let [parents (->> (ldb/get-block-parents db (:block/uuid (d/entity db (:v datom))))
190-
(map :db/id)
191-
(set))]
192-
(contains? parents (:db/id library-page)))))
193-
186+
(= (:db/id library-page) (:v datom))
194187
(:added datom))]
195188
(when (or page-tag-update? move-to-library?)
196189
(let [block-before (d/entity db-before id)

0 commit comments

Comments
 (0)