Skip to content

Commit

Permalink
fix: remove empty value if exists when setting a property value
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Nov 26, 2024
1 parent 47f33c9 commit 683a0ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions deps/outliner/src/logseq/outliner/property.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
multiple-values? (= :db.cardinality/many (:db/cardinality property))
retract-multiple-values? (and multiple-values? (sequential? value))
multiple-values-empty? (and (sequential? old-value)
(= 1 (count old-value))
(= :logseq.property/empty-placeholder (:db/ident (first old-value))))
(contains? (set (map :db/ident old-value)) :logseq.property/empty-placeholder))
block (assoc (outliner-core/block-with-updated-at {:db/id (:db/id block)})
property-id value)
block-tx-data (cond-> block
Expand Down
6 changes: 1 addition & 5 deletions src/main/frontend/components/block.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3372,11 +3372,7 @@
(when order-list? " is-order-list")
(when (string/blank? title) " is-blank")
(when original-block " embed-block"))
:haschild (str (boolean has-child?))
:on-focus (fn []
(when (:property-default-value? config)
(when-let [f (:on-block-content-pointer-down config)]
(f))))}
:haschild (str (boolean has-child?))}

(:property-default-value? config)
(assoc :data-is-property-default-value (:property-default-value? config))
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/components/property.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
(or (and (map? v) (:block/page v))
(and (coll? v)
(map? (first v))
(:block/page (first v))))
(or (:block/page (first v))
(= :logseq.property/empty-placeholder (:db/ident (first v))))))
(contains? #{:default :url} type))
date? (= type :date)
datetime? (= type :datetime)
Expand Down

0 comments on commit 683a0ba

Please sign in to comment.