mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 15:09:41 +00:00
fix: disallow remove pages from #Page view
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
[rum.core :as rum]))
|
||||
|
||||
(rum/defc action-bar < rum/reactive
|
||||
[& {:keys [on-cut on-copy selected-blocks hide-dots? button-border?]
|
||||
[& {:keys [on-cut on-copy selected-blocks hide-dots? button-border? view-parent]
|
||||
:or {on-cut #(editor-handler/cut-selection-blocks true)}}]
|
||||
(when-not (or (state/sub :search/mode)
|
||||
(state/sub :ui/show-property-dialog?))
|
||||
@@ -66,13 +66,14 @@
|
||||
:select-opts {:show-new-when-not-exact-match? false}
|
||||
:on-dialog-close #(state/pub-event! [:editor/hide-action-bar])}])))
|
||||
"Unset property"))
|
||||
(shui/button
|
||||
(assoc button-opts
|
||||
:on-pointer-down (fn [e]
|
||||
(util/stop e)
|
||||
(on-cut)
|
||||
(state/pub-event! [:editor/hide-action-bar])))
|
||||
(ui/icon "trash" {:size 13}))
|
||||
(when-not (contains? #{:logseq.class/Page} (:db/ident view-parent))
|
||||
(shui/button
|
||||
(assoc button-opts
|
||||
:on-pointer-down (fn [e]
|
||||
(util/stop e)
|
||||
(on-cut)
|
||||
(state/pub-event! [:editor/hide-action-bar])))
|
||||
(ui/icon "trash" {:size 13})))
|
||||
(when-not hide-dots?
|
||||
(shui/button
|
||||
(assoc button-opts
|
||||
|
||||
@@ -584,7 +584,8 @@
|
||||
{:on-cut #(on-delete-rows table selected-rows)
|
||||
:selected-blocks selected-rows
|
||||
:hide-dots? true
|
||||
:button-border? true})))
|
||||
:button-border? true
|
||||
:view-parent (:logseq.property/view-for (:view-entity table))})))
|
||||
|
||||
(rum/defc column-resizer
|
||||
[_column on-sized!]
|
||||
@@ -714,9 +715,10 @@
|
||||
(case view-feature-type
|
||||
:class-objects
|
||||
(when (seq page-ids)
|
||||
(let [tx-data (map (fn [pid] [:db/retract pid :block/tags (:db/id view-parent)]) page-ids)]
|
||||
(when (seq tx-data)
|
||||
(outliner-op/transact! tx-data {:outliner-op :save-block}))))
|
||||
(when-not (= :logseq.class/Page (:db/ident view-parent))
|
||||
(let [tx-data (map (fn [pid] [:db/retract pid :block/tags (:db/id view-parent)]) page-ids)]
|
||||
(when (seq tx-data)
|
||||
(outliner-op/transact! tx-data {:outliner-op :save-block})))))
|
||||
|
||||
:property-objects
|
||||
;; Relationships with built-in properties must not be deleted e.g. built-in? or parent
|
||||
|
||||
Reference in New Issue
Block a user