Преглед на файлове

fix: can't edit blocks on whiteboards

Tienson Qin преди 1 година
родител
ревизия
742ac92561
променени са 2 файла, в които са добавени 7 реда и са изтрити 3 реда
  1. 6 2
      src/main/frontend/components/block.cljs
  2. 1 1
      src/main/logseq/api.cljs

+ 6 - 2
src/main/frontend/components/block.cljs

@@ -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

+ 1 - 1
src/main/logseq/api.cljs

@@ -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