mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(core): fix viewtransition and css property missing (#7377)
This commit is contained in:
@@ -13,7 +13,11 @@ import {
|
|||||||
borderAngle3,
|
borderAngle3,
|
||||||
} from './styles.css';
|
} from './styles.css';
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.CSS) {
|
if (
|
||||||
|
typeof window !== 'undefined' &&
|
||||||
|
window.CSS &&
|
||||||
|
window.CSS.registerProperty
|
||||||
|
) {
|
||||||
const getName = (nameWithVar: string) => nameWithVar.slice(4, -1);
|
const getName = (nameWithVar: string) => nameWithVar.slice(4, -1);
|
||||||
const registerAngle = (varName: string, initialValue: number) => {
|
const registerAngle = (varName: string, initialValue: number) => {
|
||||||
window.CSS.registerProperty({
|
window.CSS.registerProperty({
|
||||||
|
|||||||
@@ -103,11 +103,15 @@ export const PeekViewModalContainer = forwardRef<
|
|||||||
) {
|
) {
|
||||||
const [vtOpen, setVtOpen] = useState(open);
|
const [vtOpen, setVtOpen] = useState(open);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.startViewTransition(() => {
|
if (document.startViewTransition) {
|
||||||
flushSync(() => {
|
document.startViewTransition(() => {
|
||||||
setVtOpen(open);
|
flushSync(() => {
|
||||||
|
setVtOpen(open);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
|
setVtOpen(open);
|
||||||
|
}
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user