Skip to content

Commit

Permalink
fix: re render when the page is visible #578
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed May 17, 2024
1 parent d49ed5e commit 24aa33a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/editor/core/event/GlobalEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,19 @@ export class GlobalEvent {
}

private _handleVisibilityChange = () => {
if (document.visibilityState) {
const isCollapsed = this.range.getIsCollapsed()
this.cursor?.drawCursor({
isShow: isCollapsed
if (document.visibilityState === 'visible') {
// 页面可见时重新渲染激活页面
const range = this.range.getRange()
const isSetCursor =
!!~range.startIndex &&
!!~range.endIndex &&
range.startIndex === range.endIndex
this.range.replaceRange(range)
this.draw.render({
isSetCursor,
isCompute: false,
isSubmitHistory: false,
curIndex: range.startIndex
})
}
}
Expand Down

0 comments on commit 24aa33a

Please sign in to comment.