fix: whiteboards block auto resize

This commit is contained in:
Tienson Qin
2025-05-06 18:34:39 +08:00
parent 95037b10cd
commit 81ed9bc09b
4 changed files with 24 additions and 1143 deletions

View File

@@ -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()
}
}, [])

View File

@@ -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',
})

View File

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