fix: re render when the page is visible #578
This commit is contained in:
@@ -146,10 +146,19 @@ export class GlobalEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _handleVisibilityChange = () => {
|
private _handleVisibilityChange = () => {
|
||||||
if (document.visibilityState) {
|
if (document.visibilityState === 'visible') {
|
||||||
const isCollapsed = this.range.getIsCollapsed()
|
// 页面可见时重新渲染激活页面
|
||||||
this.cursor?.drawCursor({
|
const range = this.range.getRange()
|
||||||
isShow: isCollapsed
|
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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user