enhance: be able to collapse/expand properties

This commit is contained in:
Tienson Qin
2023-08-07 17:31:34 +08:00
parent 59ce087247
commit 668a17c2af
5 changed files with 20 additions and 15 deletions

View File

@@ -2867,7 +2867,7 @@
hide-block-refs-count? (and (:embed? config)
(= (:block/uuid block) (:embed-id config)))]
(block-content-or-editor config block edit-input-id block-id edit? hide-block-refs-count? selected?))
(when (config/db-based-graph? repo)
(when (and (config/db-based-graph? repo) (not collapsed?))
(db-properties-cp config
block
edit-input-id

View File

@@ -465,7 +465,7 @@
(or (seq properties)
(:page-configure? opts))
[:a {:style {:margin-left 3}
[:a {:style {:margin-left 2}
:title "Add another property"
:on-click (fn []
(property-handler/set-editing-new-property! edit-input-id)

View File

@@ -3352,6 +3352,8 @@
(or (db-model/has-children? block-id)
(valid-dsl-query-block? block)
(valid-custom-query-block? block)
(seq (:block/properties block))
(seq (:block/alias block))
(and
(:outliner/block-title-collapse-enabled? (state/get-config))
(block-with-title? (:block/format block)

View File

@@ -548,7 +548,7 @@
_ (state/add-repo! {:url full-graph-name})
_ (route-handler/redirect-to-home!)
_ (db/transact! full-graph-name [(react/kv :db/type "db")]
{:skip-persist? true})
{:skip-persist? true})
initial-files [{:block/uuid (db/new-block-id)
:file/path (str "logseq/" "config.edn")
:file/content config/config-default-content}
@@ -559,15 +559,15 @@
:file/path (str "logseq/" "custom.js")
:file/content ""}]
default-properties (map
(fn [[k-keyword {:keys [schema]}]]
(let [k-name (name k-keyword)]
(outliner-core/block-with-timestamps
{:block/schema schema
:block/original-name k-name
:block/name (util/page-name-sanity-lc k-name)
:block/uuid (db/new-block-id)
:block/type "property"})))
gp-property/db-built-in-properties)
(fn [[k-keyword {:keys [schema original-name]}]]
(let [k-name (name k-keyword)]
(outliner-core/block-with-timestamps
{:block/schema schema
:block/original-name (or original-name k-name)
:block/name (util/page-name-sanity-lc k-name)
:block/uuid (db/new-block-id)
:block/type "property"})))
gp-property/db-built-in-properties)
initial-data (concat initial-files default-properties)
_ (db/transact! full-graph-name initial-data)
_ (repo-config-handler/set-repo-config-state! full-graph-name config/config-default-content)