mirror of
https://github.com/logseq/logseq.git
synced 2026-05-23 12:14:06 +00:00
enhance(ux): able to create pages directly on Library
This commit is contained in:
14
deps/outliner/src/logseq/outliner/core.cljs
vendored
14
deps/outliner/src/logseq/outliner/core.cljs
vendored
@@ -334,7 +334,7 @@
|
||||
txs (map (fn [id] [:db.fn/retractEntity [:block/uuid id]]) ids)
|
||||
page-tx (let [block (d/entity db [:block/uuid block-id])]
|
||||
(when (:block/pre-block? block)
|
||||
(let [id (:db/id (:block/page block))]
|
||||
(when-let [id (:db/id (:block/page block))]
|
||||
[[:db/retract id :block/properties]
|
||||
[:db/retract id :block/properties-order]
|
||||
[:db/retract id :block/properties-text-values]
|
||||
@@ -531,11 +531,13 @@
|
||||
(let [ref-ids (set (map :block/uuid (:block/refs block)))]
|
||||
(->> (set/intersection block-ids ref-ids)
|
||||
(remove #{(:block/uuid block)})))))
|
||||
m {:db/id (:db/id block)
|
||||
:block/uuid uuid'
|
||||
:block/page target-page
|
||||
:block/parent parent
|
||||
:block/order order}
|
||||
m (cond->
|
||||
{:db/id (:db/id block)
|
||||
:block/uuid uuid'
|
||||
:block/parent parent
|
||||
:block/order order}
|
||||
(not (ldb/page? block))
|
||||
(assoc :block/page target-page))
|
||||
result (->
|
||||
(if (de/entity? block)
|
||||
(assoc m :block/level (:block/level block))
|
||||
|
||||
13
deps/outliner/src/logseq/outliner/validate.cljs
vendored
13
deps/outliner/src/logseq/outliner/validate.cljs
vendored
@@ -88,10 +88,21 @@
|
||||
[?b :block/title ?title]
|
||||
[?b :block/tags ?tag-id]
|
||||
[(not= ?b ?eid)]
|
||||
;; same parent
|
||||
;; same extends
|
||||
[?b :logseq.property.class/extends ?bp]
|
||||
[?eid :logseq.property.class/extends ?ep]
|
||||
[(= ?bp ?ep)]]
|
||||
(:block/parent entity)
|
||||
'[:find [?b ...]
|
||||
:in $ ?eid ?title [?tag-id ...]
|
||||
:where
|
||||
[?b :block/title ?title]
|
||||
[?b :block/tags ?tag-id]
|
||||
[(not= ?b ?eid)]
|
||||
;; same parent
|
||||
[?b :block/parent ?bp]
|
||||
[?eid :block/parent ?ep]
|
||||
[(= ?bp ?ep)]]
|
||||
:else
|
||||
'[:find [?b ...]
|
||||
:in $ ?eid ?title [?tag-id ...]
|
||||
|
||||
@@ -336,14 +336,21 @@
|
||||
true
|
||||
|
||||
:else
|
||||
(not has-children?))]
|
||||
(not has-children?))
|
||||
library? (:library? config)
|
||||
new-block' (if library?
|
||||
(-> new-block
|
||||
(-> (assoc :block/tags #{:logseq.class/Page}
|
||||
:block/name (util/page-name-sanity-lc (:block/title new-block)))
|
||||
(dissoc :block/page)))
|
||||
new-block)]
|
||||
(ui-outliner-tx/transact!
|
||||
{:outliner-op :insert-blocks}
|
||||
(save-current-block! {:current-block current-block})
|
||||
(outliner-op/insert-blocks! [new-block] current-block {:sibling? sibling?
|
||||
:keep-uuid? keep-uuid?
|
||||
:ordered-list? ordered-list?
|
||||
:replace-empty-target? replace-empty-target?}))))
|
||||
(outliner-op/insert-blocks! [new-block'] current-block {:sibling? sibling?
|
||||
:keep-uuid? keep-uuid?
|
||||
:ordered-list? ordered-list?
|
||||
:replace-empty-target? replace-empty-target?}))))
|
||||
|
||||
(defn- block-self-alone-when-insert?
|
||||
[config uuid]
|
||||
|
||||
Reference in New Issue
Block a user