mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
fix(editor): should set event dispatcher active as false when document is hidden (#12559)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - The application now automatically becomes inactive when the document is hidden, improving resource management and responsiveness to visibility changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -220,6 +220,12 @@ export class UIEventDispatcher extends LifeCycleWatcher {
|
|||||||
|
|
||||||
this._setActive(false);
|
this._setActive(false);
|
||||||
});
|
});
|
||||||
|
// When the document is hidden, the event dispatcher should be inactive
|
||||||
|
this.disposables.addFromEvent(document, 'visibilitychange', () => {
|
||||||
|
if (document.visibilityState === 'hidden') {
|
||||||
|
this._setActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _buildEventScopeBySelection(name: EventName) {
|
private _buildEventScopeBySelection(name: EventName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user