fix: can't switch back to single input value for :default property

https://linear.app/logseq/issue/LOG-2810/cant-switch-back-to-single-input-value-for-default-property
pull/10438/head
Tienson Qin 2023-09-13 14:04:45 +08:00
parent 73c5930672
commit 5cc4c4b676
3 changed files with 16 additions and 10 deletions

View File

@ -292,7 +292,8 @@
empty-block? (or (nil? parent) (zero? children-count))]
(when empty-block?
(when parent
(db/transact! repo [[:db/retractEntity (:db/id parent)]]))
(db/transact! repo [[:db/retractEntity (:db/id parent)]]
{:outliner-op :delete-blocks}))
(property-handler/delete-property-value! repo block (:block/uuid property) value))
(when (seq children)
[:div.property-block-container.w-full

View File

@ -339,8 +339,8 @@
:block/tags)]
(when property-value-id
(db/transact! repo
[[:db/retract (:db/id block) attribute property-value-id]]
{:outliner-op :save-block})))
[[:db/retract (:db/id block) attribute property-value-id]]
{:outliner-op :save-block})))
(if (= :many (:cardinality schema))
(let [properties (:block/properties block)
properties' (update properties property-id
@ -348,13 +348,17 @@
(set (remove #{property-value} col))))
refs (outliner-core/rebuild-block-refs block properties')]
(db/transact! repo
[[:db/retract (:db/id block) :block/refs]
{:block/uuid (:block/uuid block)
:block/properties properties'
:block/refs refs}]
{:outliner-op :save-block}))
;; remove block property if cardinality is not many
(remove-block-property! repo (:block/uuid block) property-id))))))))
[[:db/retract (:db/id block) :block/refs]
{:block/uuid (:block/uuid block)
:block/properties properties'
:block/refs refs}]
{:outliner-op :save-block}))
(if (= :default (get-in property [:block/schema :type]))
(set-block-property! repo (:block/uuid block)
(:block/original-name property)
""
{})
(remove-block-property! repo (:block/uuid block) property-id)))))))))
(defn replace-key-with-id!
"Notice: properties need to be created first"

View File

@ -28,6 +28,7 @@
(pipelines/invoke-hooks tx-report)
(when (or (:outliner/transact? tx-meta)
(:outliner-op tx-meta)
(:whiteboard/transact? tx-meta))
(undo-redo/listen-db-changes! tx-report))