mirror of https://github.com/logseq/logseq
fix: property set icon
parent
afde2df1f0
commit
837e1aad6d
|
@ -95,13 +95,14 @@
|
|||
(rum/defc page-blocks-inner <
|
||||
{:did-mount open-root-block!}
|
||||
[page-e blocks config sidebar? whiteboard? _block-uuid]
|
||||
(let [hiccup (component-block/->hiccup blocks config {})]
|
||||
[:div.page-blocks-inner {:style {:margin-left (if (or sidebar? whiteboard?) 0 -20)}}
|
||||
(rum/with-key
|
||||
(content/content (str (:block/uuid page-e))
|
||||
{:hiccup hiccup
|
||||
:sidebar? sidebar?})
|
||||
(str (:block/uuid page-e) "-hiccup"))]))
|
||||
(when page-e
|
||||
(let [hiccup (component-block/->hiccup blocks config {})]
|
||||
[:div.page-blocks-inner {:style {:margin-left (if (or sidebar? whiteboard?) 0 -20)}}
|
||||
(rum/with-key
|
||||
(content/content (str (:block/uuid page-e))
|
||||
{:hiccup hiccup
|
||||
:sidebar? sidebar?})
|
||||
(str (:block/uuid page-e) "-hiccup"))])))
|
||||
|
||||
(declare page)
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@
|
|||
items (if closed-values?
|
||||
(keep (fn [id]
|
||||
(when-let [block (when id (db/entity [:block/uuid id]))]
|
||||
(let [icon (get block (pu/get-pid :logseq.property/icon))
|
||||
(let [icon (pu/get-block-property-value block :logseq.property/icon)
|
||||
value (db-property/closed-value-name block)]
|
||||
{:label (if icon
|
||||
[:div.flex.flex-row.gap-2
|
||||
|
@ -541,7 +541,7 @@
|
|||
(let [eid (if (de/entity? value) (:db/id value) [:block/uuid value])]
|
||||
(when-let [block (db/sub-block (:db/id (db/entity eid)))]
|
||||
(let [value' (get-in block [:block/schema :value])
|
||||
icon (get block (pu/get-pid :logseq.property/icon))]
|
||||
icon (pu/get-block-property-value block :logseq.property/icon)]
|
||||
(cond
|
||||
(:block/name block)
|
||||
(page-cp {:disable-preview? true
|
||||
|
|
|
@ -28,19 +28,21 @@
|
|||
;; min, max -> string length, number range, cardinality size limit
|
||||
|
||||
(defn- build-property-value-tx-data
|
||||
[block property-id value status?]
|
||||
(when value
|
||||
(let [property-pair-e (db-property/get-pair-e block property-id)
|
||||
property-tx-data (outliner-core/block-with-updated-at
|
||||
(if property-pair-e
|
||||
{:db/id (:db/id property-pair-e)
|
||||
property-id value}
|
||||
{:db/id (:db/id block)
|
||||
:block/properties (sqlite-util/build-property-pair property-id value)}))
|
||||
block-tx-data (cond-> (outliner-core/block-with-updated-at {:db/id (:db/id block)})
|
||||
status?
|
||||
(assoc :block/tags :logseq.class/task))]
|
||||
[property-tx-data block-tx-data])))
|
||||
([block property-id value]
|
||||
(build-property-value-tx-data block property-id value (= property-id :logseq.task/status)))
|
||||
([block property-id value status?]
|
||||
(when value
|
||||
(let [property-pair-e (db-property/get-pair-e block property-id)
|
||||
property-tx-data (outliner-core/block-with-updated-at
|
||||
(if property-pair-e
|
||||
{:db/id (:db/id property-pair-e)
|
||||
property-id value}
|
||||
{:db/id (:db/id block)
|
||||
:block/properties (sqlite-util/build-property-pair property-id value)}))
|
||||
block-tx-data (cond-> (outliner-core/block-with-updated-at {:db/id (:db/id block)})
|
||||
status?
|
||||
(assoc :block/tags :logseq.class/task))]
|
||||
[property-tx-data block-tx-data]))))
|
||||
|
||||
(defn built-in-validation-schemas
|
||||
"A frontend version of built-in-validation-schemas that adds the current database to
|
||||
|
@ -150,16 +152,18 @@
|
|||
(assert (qualified-keyword? db-ident))
|
||||
(if-let [property (and (qualified-keyword? property-id) (db/entity db-ident))]
|
||||
(let [tx-data (->>
|
||||
(conj
|
||||
(concat
|
||||
[(cond->
|
||||
(merge
|
||||
(outliner-core/block-with-updated-at
|
||||
{:db/ident db-ident
|
||||
:block/schema schema})
|
||||
properties)
|
||||
(outliner-core/block-with-updated-at
|
||||
{:db/ident db-ident
|
||||
:block/schema schema})
|
||||
property-name
|
||||
(assoc :block/original-name property-name))]
|
||||
(update-schema property schema))
|
||||
(when (seq properties)
|
||||
(mapcat
|
||||
(fn [[property-id v]]
|
||||
(build-property-value-tx-data property property-id v)) properties))
|
||||
[(update-schema property schema)])
|
||||
(remove nil?))
|
||||
many->one? (and (= (:db/cardinality property) :db.cardinality/many)
|
||||
(= :one (:cardinality schema)))]
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
[frontend.components.page :as page]
|
||||
[frontend.util :as util]
|
||||
[logseq.sdk.utils :as sdk-util]
|
||||
[camel-snake-kebab.core :as csk]
|
||||
[goog.object :as gobj]
|
||||
[frontend.handler.plugin :as plugin-handler]))
|
||||
|
||||
(defn ^:export cp_page_editor
|
||||
|
|
Loading…
Reference in New Issue