mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
feat(electron): add isMaximized flag to html (#6199)
to make some special ui rules for desktop
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import './register-blocksuite-components';
|
||||
import './edgeless-template';
|
||||
|
||||
import { apis, events } from '@affine/electron-api';
|
||||
import { setupGlobal } from '@affine/env/global';
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { useEffect } from 'react';
|
||||
@@ -51,10 +52,16 @@ export function setup() {
|
||||
|
||||
// load persistent config for electron
|
||||
// TODO: should be sync, but it's not necessary for now
|
||||
environment.isDesktop &&
|
||||
if (environment.isDesktop) {
|
||||
appConfigProxy
|
||||
.getSync()
|
||||
.catch(() => console.error('failed to load app config'));
|
||||
const handleMaximized = (maximized: boolean | undefined) => {
|
||||
document.documentElement.dataset.maximized = String(maximized);
|
||||
};
|
||||
apis?.ui.isMaximized().then(handleMaximized).catch(console.error);
|
||||
events?.ui.onMaximized(handleMaximized);
|
||||
}
|
||||
|
||||
performanceSetupLogger.info('done');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user