Browse Source

fix: whiteboards block auto resize

Tienson Qin 5 months ago
parent
commit
81ed9bc09b

+ 1 - 1
packages/tldraw/apps/tldraw-logseq/src/lib/shapes/HTMLShape.tsx

@@ -96,7 +96,7 @@ export class HTMLShape extends TLBoxShape<HTMLShapeProps> {
     React.useEffect(() => {
       if (this.props.size[1] === 0) {
         this.onResetBounds({ zoom: app.viewport.camera.zoom })
-        app.persist({replace: true})
+        app.persist()
       }
     }, [])
 

+ 4 - 3
packages/tldraw/apps/tldraw-logseq/src/lib/shapes/LogseqPortalShape.tsx

@@ -296,7 +296,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
             size: [this.props.size[0], newHeight],
           })
 
-          if (loaded) app.persist({replace: true})
+          if (loaded) app.persist({})
         }
       }
     }, [innerHeight, this.props.isAutoResizing])
@@ -305,7 +305,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
       if (!this.initialHeightCalculated) {
         setTimeout(() => {
           this.onResetBounds()
-          app.persist({replace: true})
+          app.persist({})
         })
       }
     }, [this.initialHeightCalculated])
@@ -423,9 +423,10 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
     const onPageNameChanged = React.useCallback((id: string, isPage: boolean) => {
       this.initialHeightCalculated = false
       const blockType = isPage ? 'P' : 'B'
+      const height = isPage ? 320 : 40
       this.update({
         pageId: id,
-        size: [400, 320],
+        size: [400, height],
         blockType: blockType,
         compact: blockType === 'B',
       })

+ 2 - 2
packages/tldraw/apps/tldraw-logseq/src/lib/shapes/TweetShape.tsx

@@ -61,7 +61,7 @@ export class TweetShape extends TLBoxShape<TweetShapeProps> {
         this.update({
           size: [this.props.size[0], newHeight],
         })
-        app.persist({replace: true})
+        app.persist()
       }
     }, [innerHeight])
 
@@ -69,7 +69,7 @@ export class TweetShape extends TLBoxShape<TweetShapeProps> {
       if (!this.initialHeightCalculated) {
         setTimeout(() => {
           this.onResetBounds()
-          app.persist({replace: true})
+          app.persist()
         })
       }
     }, [this.initialHeightCalculated])

File diff suppressed because it is too large
+ 4 - 797
packages/tldraw/yarn.lock


Some files were not shown because too many files changed in this diff