fix: can't use property shortcuts

experiment/tanstack-table
Tienson Qin 2024-06-24 14:29:16 +08:00
parent ec2cc78997
commit 0b580fcdfc
2 changed files with 13 additions and 6 deletions

View File

@ -473,7 +473,6 @@
(rum/defcs property-input < rum/reactive
(rum/local nil ::ref)
(rum/local nil ::property)
(rum/local false ::show-new-property-config?)
(rum/local false ::show-class-select?)
(rum/local {} ::property-schema)
@ -489,7 +488,8 @@
(.focus input)))))))
{:init (fn [state]
(state/set-editor-action! :property-input)
state)
(assoc state ::property (or (:*property (last (:rum/args state)))
(atom nil))))
:will-unmount (fn [state]
(let [args (:rum/args state)
*property-key (second args)
@ -517,7 +517,7 @@
;; Filters out properties from being in wrong :view-context
(and (not page?) (= :page (get-in m [:block/schema :view-context])))
(and page? (= :block (get-in m [:block/schema :view-context])))))
property @*property
property (rum/react *property)
property-key (rum/react *property-key)]
[:div.ls-property-input.flex.flex-1.flex-row.items-center.flex-wrap.gap-1
{:ref #(reset! *ref %)}

View File

@ -3,17 +3,24 @@
(:require [frontend.components.property :as property-component]
[rum.core :as rum]
[frontend.modules.shortcut.core :as shortcut]
[logseq.db :as ldb]))
[logseq.db :as ldb]
[frontend.db :as db]))
(rum/defcs dialog <
shortcut/disable-all-shortcuts
(rum/local nil ::property-value)
{:init (fn [state]
(assoc state ::property-key (atom (:property-key (last (:rum/args state))))))}
(let [k (:property-key (last (:rum/args state)))]
(assoc state
::property-key (atom k)
::property (atom (when k (db/get-page k))))))}
[state blocks opts]
(when (seq blocks)
(let [*property-key (::property-key state)
*property (::property state)
block (first blocks)
page? (ldb/page? block)]
[:div.ls-property-dialog
(property-component/property-input block *property-key (assoc opts :page? page?))])))
(property-component/property-input block *property-key (assoc opts
:*property *property
:page? page?))])))