Commit b361998 1 parent 786cb6a commit b361998 Copy full SHA for b361998
File tree 2 files changed +17
-1
lines changed
packages/block-editor/src/components/editor-skeleton
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,24 @@ import classnames from 'classnames';
6
6
/**
7
7
* WordPress dependencies
8
8
*/
9
+ import { useEffect } from '@wordpress/element' ;
9
10
import { navigateRegions } from '@wordpress/components' ;
10
11
import { __ } from '@wordpress/i18n' ;
11
12
13
+ function useHTMLClass ( className ) {
14
+ useEffect ( ( ) => {
15
+ const element =
16
+ document && document . querySelector ( `html:not(.${ className } ` ) ;
17
+ if ( ! element ) {
18
+ return ;
19
+ }
20
+ element . classList . toggle ( className ) ;
21
+ return ( ) => {
22
+ element . classList . toggle ( className ) ;
23
+ } ;
24
+ } , [ className ] ) ;
25
+ }
26
+
12
27
function EditorSkeleton ( {
13
28
footer,
14
29
header,
@@ -17,6 +32,7 @@ function EditorSkeleton( {
17
32
publish,
18
33
className,
19
34
} ) {
35
+ useHTMLClass ( 'block-editor-editor-skeleton__html-container' ) ;
20
36
return (
21
37
< div
22
38
className = { classnames (
Original file line number Diff line number Diff line change 1
1
// On Mobile devices, swiping the HTML element should not scroll.
2
2
// By making it fixed, we prevent that.
3
- html {
3
+ html .block-editor-editor-skeleton__html-container {
4
4
position : fixed ;
5
5
width : 100% ;
6
6
You can’t perform that action at this time.
0 commit comments