fix: can't edit blocks on whiteboards

This commit is contained in:
Tienson Qin
2024-05-02 17:33:24 +08:00
parent d907eb7654
commit 742ac92561
2 changed files with 7 additions and 3 deletions

View File

@@ -2614,11 +2614,15 @@
(when-let [refs-cp (state/get-component :block/linked-references)]
(refs-cp uuid)))]))]))
(rum/defc single-block-cp
[block-uuid]
(rum/defcs single-block-cp <
{:init (fn [state]
(let [container-id (swap! (:ui/container-id @state/state) inc)]
(assoc state ::container-id container-id)))}
[state block-uuid]
(let [uuid (if (string? block-uuid) (uuid block-uuid) block-uuid)
block (db/entity [:block/uuid uuid])
config {:id (str uuid)
:container-id (::container-id state)
:db/id (:db/id block)
:block/uuid uuid
:block? true

View File

@@ -623,7 +623,7 @@
(when-let [block-uuid (and block-uuid (sdk-utils/uuid-or-throw-error block-uuid))]
(when-let [block (db-model/query-block-by-uuid block-uuid)]
(let [{:keys [pos] :or {pos :max}} (bean/->clj opts)]
(editor-handler/edit-block! block pos))))))
(editor-handler/edit-block! block pos {:container-id :unknown-container}))))))
;; TODO: perf improvement, some operations such as delete-block doesn't need to load the full page
;; instead, the db worker should provide those calls