/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/interface/src/components/fullscreen-mode/index.js
38 строк
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { useEffect } from '@wordpress/element'; const FullscreenMode = ( { isActive } ) => { useEffect( () => { let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as // a consequence of the FullscreenMode setup. if ( document.body.classList.contains( 'sticky-menu' ) ) { isSticky = true; document.body.classList.remove( 'sticky-menu' ); } return () => { if ( isSticky ) { document.body.classList.add( 'sticky-menu' ); } }; }, [] ); useEffect( () => { if ( isActive ) { document.body.classList.add( 'is-fullscreen-mode' ); } else { document.body.classList.remove( 'is-fullscreen-mode' ); } return () => { if ( isActive ) { document.body.classList.remove( 'is-fullscreen-mode' ); } }; }, [ isActive ] ); return null; }; export default FullscreenMode;