mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor: unify theme (#1303)
This commit is contained in:
17
apps/web/src/utils/create-emotion-cache.ts
Normal file
17
apps/web/src/utils/create-emotion-cache.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import createCache from '@emotion/cache';
|
||||
|
||||
const isBrowser = getEnvironment().isBrowser;
|
||||
|
||||
export default function createEmotionCache() {
|
||||
let insertionPoint;
|
||||
|
||||
if (isBrowser) {
|
||||
const emotionInsertionPoint = document.querySelector<HTMLMetaElement>(
|
||||
'meta[name="emotion-insertion-point"]'
|
||||
);
|
||||
insertionPoint = emotionInsertionPoint ?? undefined;
|
||||
}
|
||||
|
||||
return createCache({ key: 'affine-style', insertionPoint });
|
||||
}
|
||||
Reference in New Issue
Block a user