Bladeren bron

fix: single block does not updating reactively

Peng Xiao 3 jaren geleden
bovenliggende
commit
763165270c
2 gewijzigde bestanden met toevoegingen van 3 en 27 verwijderingen
  1. 3 7
      src/main/frontend/components/block.cljs
  2. 0 20
      tldraw/packages/react/src/hooks/useStylesheet.ts

+ 3 - 7
src/main/frontend/components/block.cljs

@@ -2238,7 +2238,8 @@
   (let [uuid (if (string? block-uuid) (uuid block-uuid) block-uuid)
         *init-blocks-container-id (::init-blocks-container-id state)
         block-entity (db/entity [:block/uuid uuid])
-        {:block/keys [pre-block? level format content]} block-entity
+        block-id (:db/id block-entity)
+        block (first (model/get-paginated-blocks (state/get-current-repo) block-id))
         blocks-container-id (if @*init-blocks-container-id
                               @*init-blocks-container-id
                               (let [id' (swap! *blocks-container-id inc)]
@@ -2250,13 +2251,8 @@
                 :editor-box (state/get-component :editor/box)}
         edit-input-id (str "edit-block-" blocks-container-id "-" uuid)
         edit? (state/sub [:editor/editing? edit-input-id])
-        block {:block/uuid uuid
-               :block/pre-block? pre-block?
-               :block/level level
-               :block/format format
-               :block/content content}
         block (block/parse-title-and-body block)]
-    (block-content-or-editor config block edit-input-id uuid level edit?)))
+    (block-content-or-editor config block edit-input-id uuid 1 edit?)))
 
 (rum/defc single-block-cp
   [block-uuid]

+ 0 - 20
tldraw/packages/react/src/hooks/useStylesheet.ts

@@ -132,15 +132,6 @@ const tlcss = css`
     pointer-events: none;
   }
 
-  .tl-grid {
-    position: absolute;
-    width: 100%;
-    height: 100%;
-    touch-action: none;
-    pointer-events: none;
-    user-select: none;
-  }
-
   .tl-snap-line {
     stroke: var(--tl-accent);
     stroke-width: calc(1px * var(--tl-scale));
@@ -236,13 +227,6 @@ const tlcss = css`
     stroke-width: calc(1.5px * var(--tl-scale));
   }
 
-  .tl-binding {
-    fill: var(--tl-selectFill);
-    stroke: var(--tl-selectStroke);
-    stroke-width: calc(1px * var(--tl-scale));
-    pointer-events: none;
-  }
-
   .tl-user {
     left: -4px;
     top: -4px;
@@ -389,10 +373,6 @@ const tlcss = css`
     stroke-width: calc(2px * var(--tl-scale));
   }
 
-  .tl-grid-dot {
-    fill: var(--tl-grid);
-  }
-
   .tl-counter-scaled-positioned {
     position: absolute;
     top: 0;