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:
donteatfriedrice
2025-06-05 02:28:32 +00:00
parent c7aebd0412
commit 053efb61f0

View File

@@ -220,6 +220,12 @@ export class UIEventDispatcher extends LifeCycleWatcher {
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) {