@wordpress/edit-post 8.13.0 → 8.13.1-next.a9f418477.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/layout/index.js +10 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/meta-boxes/index.js +1 -34
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/use-meta-box-initialization.js +38 -0
- package/build/components/meta-boxes/use-meta-box-initialization.js.map +1 -0
- package/build/components/welcome-guide/default.js +5 -5
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/layout/index.js +10 -19
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +2 -35
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/use-meta-box-initialization.js +31 -0
- package/build-module/components/meta-boxes/use-meta-box-initialization.js.map +1 -0
- package/build-module/components/welcome-guide/default.js +5 -5
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-style/style-rtl.css +0 -3
- package/build-style/style.css +0 -3
- package/package.json +30 -30
- package/src/components/layout/index.js +13 -25
- package/src/components/layout/style.scss +3 -5
- package/src/components/meta-boxes/index.js +4 -33
- package/src/components/meta-boxes/use-meta-box-initialization.js +32 -0
- package/src/components/welcome-guide/default.js +5 -5
|
@@ -107,11 +107,9 @@
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
.has-metaboxes .editor-visual-editor {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
isolation: isolate;
|
|
114
|
-
}
|
|
110
|
+
// Contains z-indexes of children so that the block toolbar will appear behind
|
|
111
|
+
// the drop shadow of the meta box pane.
|
|
112
|
+
isolation: isolate;
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
// Adjust the position of the notices
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect
|
|
5
|
-
import { useEffect } from '@wordpress/element';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Internal dependencies
|
|
@@ -13,38 +11,11 @@ import MetaBoxVisibility from './meta-box-visibility';
|
|
|
13
11
|
import { store as editPostStore } from '../../store';
|
|
14
12
|
|
|
15
13
|
export default function MetaBoxes( { location } ) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const { __unstableIsEditorReady } = select( editorStore );
|
|
20
|
-
const {
|
|
21
|
-
getMetaBoxesPerLocation,
|
|
22
|
-
areMetaBoxesInitialized: _areMetaBoxesInitialized,
|
|
23
|
-
} = select( editPostStore );
|
|
24
|
-
return {
|
|
25
|
-
metaBoxes: getMetaBoxesPerLocation( location ),
|
|
26
|
-
areMetaBoxesInitialized: _areMetaBoxesInitialized(),
|
|
27
|
-
isEditorReady: __unstableIsEditorReady(),
|
|
28
|
-
};
|
|
29
|
-
},
|
|
14
|
+
const metaBoxes = useSelect(
|
|
15
|
+
( select ) =>
|
|
16
|
+
select( editPostStore ).getMetaBoxesPerLocation( location ),
|
|
30
17
|
[ location ]
|
|
31
18
|
);
|
|
32
|
-
|
|
33
|
-
const hasMetaBoxes = !! metaBoxes?.length;
|
|
34
|
-
|
|
35
|
-
// When editor is ready, initialize postboxes (wp core script) and metabox
|
|
36
|
-
// saving. This initializes all meta box locations, not just this specific
|
|
37
|
-
// one.
|
|
38
|
-
useEffect( () => {
|
|
39
|
-
if ( isEditorReady && hasMetaBoxes && ! areMetaBoxesInitialized ) {
|
|
40
|
-
registry.dispatch( editPostStore ).initializeMetaBoxes();
|
|
41
|
-
}
|
|
42
|
-
}, [ isEditorReady, hasMetaBoxes, areMetaBoxesInitialized ] );
|
|
43
|
-
|
|
44
|
-
if ( ! areMetaBoxesInitialized ) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
19
|
return (
|
|
49
20
|
<>
|
|
50
21
|
{ ( metaBoxes ?? [] ).map( ( { id } ) => (
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
6
|
+
import { useEffect } from '@wordpress/element';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as editPostStore } from '../../store';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initializes WordPress `postboxes` script and the logic for saving meta boxes.
|
|
15
|
+
*
|
|
16
|
+
* @param { boolean } enabled
|
|
17
|
+
*/
|
|
18
|
+
export const useMetaBoxInitialization = ( enabled ) => {
|
|
19
|
+
const isEnabledAndEditorReady = useSelect(
|
|
20
|
+
( select ) =>
|
|
21
|
+
enabled && select( editorStore ).__unstableIsEditorReady(),
|
|
22
|
+
[ enabled ]
|
|
23
|
+
);
|
|
24
|
+
const { initializeMetaBoxes } = useDispatch( editPostStore );
|
|
25
|
+
// The effect has to rerun when the editor is ready because initializeMetaBoxes
|
|
26
|
+
// will noop until then.
|
|
27
|
+
useEffect( () => {
|
|
28
|
+
if ( isEnabledAndEditorReady ) {
|
|
29
|
+
initializeMetaBoxes();
|
|
30
|
+
}
|
|
31
|
+
}, [ isEnabledAndEditorReady, initializeMetaBoxes ] );
|
|
32
|
+
};
|
|
@@ -18,7 +18,7 @@ export default function WelcomeGuideDefault() {
|
|
|
18
18
|
return (
|
|
19
19
|
<Guide
|
|
20
20
|
className="edit-post-welcome-guide"
|
|
21
|
-
contentLabel={ __( 'Welcome to the
|
|
21
|
+
contentLabel={ __( 'Welcome to the editor' ) }
|
|
22
22
|
finishButtonText={ __( 'Get started' ) }
|
|
23
23
|
onFinish={ () => toggleFeature( 'welcomeGuide' ) }
|
|
24
24
|
pages={ [
|
|
@@ -32,7 +32,7 @@ export default function WelcomeGuideDefault() {
|
|
|
32
32
|
content: (
|
|
33
33
|
<>
|
|
34
34
|
<h1 className="edit-post-welcome-guide__heading">
|
|
35
|
-
{ __( 'Welcome to the
|
|
35
|
+
{ __( 'Welcome to the editor' ) }
|
|
36
36
|
</h1>
|
|
37
37
|
<p className="edit-post-welcome-guide__text">
|
|
38
38
|
{ __(
|
|
@@ -52,7 +52,7 @@ export default function WelcomeGuideDefault() {
|
|
|
52
52
|
content: (
|
|
53
53
|
<>
|
|
54
54
|
<h1 className="edit-post-welcome-guide__heading">
|
|
55
|
-
{ __( '
|
|
55
|
+
{ __( 'Customize each block' ) }
|
|
56
56
|
</h1>
|
|
57
57
|
<p className="edit-post-welcome-guide__text">
|
|
58
58
|
{ __(
|
|
@@ -72,7 +72,7 @@ export default function WelcomeGuideDefault() {
|
|
|
72
72
|
content: (
|
|
73
73
|
<>
|
|
74
74
|
<h1 className="edit-post-welcome-guide__heading">
|
|
75
|
-
{ __( '
|
|
75
|
+
{ __( 'Explore all blocks' ) }
|
|
76
76
|
</h1>
|
|
77
77
|
<p className="edit-post-welcome-guide__text">
|
|
78
78
|
{ createInterpolateElement(
|
|
@@ -102,7 +102,7 @@ export default function WelcomeGuideDefault() {
|
|
|
102
102
|
content: (
|
|
103
103
|
<>
|
|
104
104
|
<h1 className="edit-post-welcome-guide__heading">
|
|
105
|
-
{ __( 'Learn
|
|
105
|
+
{ __( 'Learn more' ) }
|
|
106
106
|
</h1>
|
|
107
107
|
<p className="edit-post-welcome-guide__text">
|
|
108
108
|
{ createInterpolateElement(
|