fix: built-in string properties with internal :string type

Also fix a bug that caused numbered list to fail after first item
pull/11177/head
Gabriel Horner 2024-04-18 09:06:10 -04:00
parent 390892e524
commit 9bab096def
3 changed files with 16 additions and 14 deletions

View File

@ -39,8 +39,9 @@
:public? true
:view-context :page
:cardinality :many}}
:logseq.property/background-color {:schema {:type :default :hide? true}}
:logseq.property/background-color {:schema {:type :string :hide? true}}
:logseq.property/background-image {:schema
;; FIXME: Convert to :string when it's user facing
{:type :default
:hide? true
:view-context :block
@ -77,10 +78,10 @@
:hide? true}}
:logseq.property/hl-stamp {:schema {:type :number
:hide? true}}
:logseq.property/hl-color {:schema {:type :default
:logseq.property/hl-color {:schema {:type :string
:hide? true}}
:logseq.property/order-list-type {:name :logseq.order-list-type
:schema {:type :default
:schema {:type :string
:hide? true}}
:logseq.property.tldraw/page {:name :logseq.tldraw.page
:schema {:type :map

View File

@ -12,7 +12,7 @@
(def internal-built-in-property-types
"Valid property types only for use by internal built-in-properties"
#{:keyword :map :coll :any :entity})
#{:keyword :map :coll :any :entity :string})
(def user-built-in-property-types
"Valid property types for users in order they appear in the UI"
@ -25,11 +25,12 @@
(assert (set/subset? closed-value-property-types (set user-built-in-property-types))
"All closed value types are valid property types")
(def ref-property-types #{:default :page :date :entity})
(def ref-property-types
"User facing ref types"
#{:default :page :date})
(assert (set/subset? ref-property-types
(into internal-built-in-property-types
user-built-in-property-types))
(set user-built-in-property-types))
"All ref types are valid property types")
(def ^:private user-built-in-allowed-schema-attributes
@ -119,10 +120,11 @@
:template [:fn
{:error/message "should has #template"}
entity?]
:entity [:fn
{:error/message "should be a db entity"}
entity?]
;; internal usage
;; Internal usage
;; ==============
:string string?
:entity entity?
:keyword keyword?
:map map?
;; coll elements are ordered as it's saved as a vec

View File

@ -649,7 +649,6 @@
tb (when target-block (block db target-block))
target-block (if sibling? target-block (when tb (:block (otree/-get-down tb conn))))
list-type-fn (fn [block] (db-property-util/get-block-property-value repo db block :logseq.property/order-list-type))
k (db-property-util/get-pid repo :logseq.property/order-list-type)
db-based? (sqlite-util/db-based-graph? repo)]
(if-let [list-type (and target-block (list-type-fn target-block))]
(mapv
@ -660,8 +659,8 @@
list?
((fn [b]
(if db-based?
(assoc b k list-type)
(update b :block/properties assoc k list-type))))
(update b :block/properties conj (sqlite-util/build-property-pair :logseq.property/order-list-type list-type))
(update b :block/properties assoc (db-property-util/get-pid repo :logseq.property/order-list-type) list-type))))
(not db-based?)
(assoc :block/content (gp-property/insert-property repo format content :logseq.order-list-type list-type)))))