@wordpress/edit-post 8.3.0 → 8.5.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/CHANGELOG.md +4 -0
- package/build/components/back-button/fullscreen-mode-close.js +2 -13
- package/build/components/back-button/fullscreen-mode-close.js.map +1 -1
- package/build/components/init-pattern-modal/index.js +2 -10
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/layout/index.js +9 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/more-menu/manage-patterns-menu-item.js +4 -1
- package/build/components/more-menu/manage-patterns-menu-item.js.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/store/private-selectors.js +6 -2
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/components/back-button/fullscreen-mode-close.js +2 -13
- package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js +2 -11
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +9 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/more-menu/manage-patterns-menu-item.js +4 -1
- package/build-module/components/more-menu/manage-patterns-menu-item.js.map +1 -1
- package/build-module/index.js +4 -2
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-selectors.js +6 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/classic-rtl.css +3 -0
- package/build-style/classic.css +3 -0
- package/build-style/style-rtl.css +3 -8
- package/build-style/style.css +3 -8
- package/package.json +31 -31
- package/src/components/back-button/fullscreen-mode-close.js +3 -11
- package/src/components/back-button/style.scss +0 -4
- package/src/components/init-pattern-modal/index.js +1 -10
- package/src/components/layout/index.js +12 -2
- package/src/components/layout/style.scss +0 -5
- package/src/components/more-menu/manage-patterns-menu-item.js +6 -1
- package/src/components/preferences-modal/test/__snapshots__/enable-custom-fields.js.snap +4 -4
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +3 -3
- package/src/index.js +4 -2
- package/src/store/private-selectors.js +7 -2
|
@@ -19,23 +19,16 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
19
19
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
20
|
import { useReducedMotion } from '@wordpress/compose';
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
import { store as editPostStore } from '../../store';
|
|
26
|
-
|
|
27
22
|
function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
28
|
-
const {
|
|
23
|
+
const { isRequestingSiteIcon, postType, siteIconUrl } = useSelect(
|
|
29
24
|
( select ) => {
|
|
30
25
|
const { getCurrentPostType } = select( editorStore );
|
|
31
|
-
const { isFeatureActive } = select( editPostStore );
|
|
32
26
|
const { getEntityRecord, getPostType, isResolving } =
|
|
33
27
|
select( coreStore );
|
|
34
28
|
const siteData =
|
|
35
29
|
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
36
30
|
const _postType = initialPost?.type || getCurrentPostType();
|
|
37
31
|
return {
|
|
38
|
-
isActive: isFeatureActive( 'fullscreenMode' ),
|
|
39
32
|
isRequestingSiteIcon: isResolving( 'getEntityRecord', [
|
|
40
33
|
'root',
|
|
41
34
|
'__unstableBase',
|
|
@@ -50,7 +43,7 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
50
43
|
|
|
51
44
|
const disableMotion = useReducedMotion();
|
|
52
45
|
|
|
53
|
-
if ( !
|
|
46
|
+
if ( ! postType ) {
|
|
54
47
|
return null;
|
|
55
48
|
}
|
|
56
49
|
|
|
@@ -83,8 +76,7 @@ function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
|
83
76
|
buttonIcon = <Icon size="36px" icon={ icon } />;
|
|
84
77
|
}
|
|
85
78
|
|
|
86
|
-
const classes = clsx( {
|
|
87
|
-
'edit-post-fullscreen-mode-close': true,
|
|
79
|
+
const classes = clsx( 'edit-post-fullscreen-mode-close', {
|
|
88
80
|
'has-icon': siteIconUrl,
|
|
89
81
|
} );
|
|
90
82
|
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
// They need to be updated in both places.
|
|
3
3
|
|
|
4
4
|
.edit-post-fullscreen-mode-close.components-button {
|
|
5
|
-
// Do not show the toolbar icon on small screens,
|
|
6
|
-
// when Fullscreen Mode is not an option in the "More" menu.
|
|
7
|
-
display: none;
|
|
8
|
-
|
|
9
5
|
@include break-medium() {
|
|
10
6
|
display: flex;
|
|
11
7
|
align-items: center;
|
|
@@ -13,15 +13,6 @@ import {
|
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { useEffect, useState } from '@wordpress/element';
|
|
15
15
|
import { store as editorStore } from '@wordpress/editor';
|
|
16
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import { unlock } from '../../lock-unlock';
|
|
23
|
-
|
|
24
|
-
const { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );
|
|
25
16
|
|
|
26
17
|
export default function InitPatternModal() {
|
|
27
18
|
const { editPost } = useDispatch( editorStore );
|
|
@@ -82,8 +73,8 @@ export default function InitPatternModal() {
|
|
|
82
73
|
__nextHasNoMarginBottom
|
|
83
74
|
__next40pxDefaultSize
|
|
84
75
|
/>
|
|
85
|
-
<ReusableBlocksRenameHint />
|
|
86
76
|
<ToggleControl
|
|
77
|
+
__nextHasNoMarginBottom
|
|
87
78
|
label={ _x( 'Synced', 'pattern (singular)' ) }
|
|
88
79
|
help={ __(
|
|
89
80
|
'Sync this pattern across multiple locations.'
|
|
@@ -37,6 +37,7 @@ import { addQueryArgs } from '@wordpress/url';
|
|
|
37
37
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
38
38
|
import { store as coreStore } from '@wordpress/core-data';
|
|
39
39
|
import { SlotFillProvider } from '@wordpress/components';
|
|
40
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Internal dependencies
|
|
@@ -198,7 +199,10 @@ function Layout( {
|
|
|
198
199
|
const supportsTemplateMode = settings.supportsTemplateMode;
|
|
199
200
|
const isViewable =
|
|
200
201
|
getPostType( currentPost.postType )?.viewable ?? false;
|
|
201
|
-
const canViewTemplate = canUser( 'read',
|
|
202
|
+
const canViewTemplate = canUser( 'read', {
|
|
203
|
+
kind: 'postType',
|
|
204
|
+
name: 'wp_template',
|
|
205
|
+
} );
|
|
202
206
|
|
|
203
207
|
return {
|
|
204
208
|
mode: select( editorStore ).getEditorMode(),
|
|
@@ -324,6 +328,12 @@ function Layout( {
|
|
|
324
328
|
id: initialPostId,
|
|
325
329
|
};
|
|
326
330
|
}, [ initialPostType, initialPostId ] );
|
|
331
|
+
|
|
332
|
+
const backButton =
|
|
333
|
+
useViewportMatch( 'medium' ) && isFullscreenActive ? (
|
|
334
|
+
<BackButton initialPost={ initialPost } />
|
|
335
|
+
) : null;
|
|
336
|
+
|
|
327
337
|
return (
|
|
328
338
|
<SlotFillProvider>
|
|
329
339
|
<ErrorBoundary>
|
|
@@ -370,7 +380,7 @@ function Layout( {
|
|
|
370
380
|
<InitPatternModal />
|
|
371
381
|
<PluginArea onError={ onPluginAreaError } />
|
|
372
382
|
<PostEditorMoreMenu />
|
|
373
|
-
|
|
383
|
+
{ backButton }
|
|
374
384
|
<EditorSnackbars />
|
|
375
385
|
</Editor>
|
|
376
386
|
</ErrorBoundary>
|
|
@@ -20,7 +20,12 @@ function ManagePatternsMenuItem() {
|
|
|
20
20
|
// The site editor and templates both check whether the user has
|
|
21
21
|
// edit_theme_options capabilities. We can leverage that here and not
|
|
22
22
|
// display the manage patterns link if the user can't access it.
|
|
23
|
-
return canUser( 'create',
|
|
23
|
+
return canUser( 'create', {
|
|
24
|
+
kind: 'postType',
|
|
25
|
+
name: 'wp_template',
|
|
26
|
+
} )
|
|
27
|
+
? patternsUrl
|
|
28
|
+
: defaultUrl;
|
|
24
29
|
}, [] );
|
|
25
30
|
|
|
26
31
|
return (
|
|
@@ -29,7 +29,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
|
|
|
29
29
|
-webkit-flex-direction: row;
|
|
30
30
|
-ms-flex-direction: row;
|
|
31
31
|
flex-direction: row;
|
|
32
|
-
gap: calc(4px *
|
|
32
|
+
gap: calc(4px * 2);
|
|
33
33
|
-webkit-box-pack: start;
|
|
34
34
|
-ms-flex-pack: start;
|
|
35
35
|
-webkit-justify-content: flex-start;
|
|
@@ -135,7 +135,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
|
|
|
135
135
|
-webkit-flex-direction: row;
|
|
136
136
|
-ms-flex-direction: row;
|
|
137
137
|
flex-direction: row;
|
|
138
|
-
gap: calc(4px *
|
|
138
|
+
gap: calc(4px * 2);
|
|
139
139
|
-webkit-box-pack: start;
|
|
140
140
|
-ms-flex-pack: start;
|
|
141
141
|
-webkit-justify-content: flex-start;
|
|
@@ -231,7 +231,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
|
|
|
231
231
|
-webkit-flex-direction: row;
|
|
232
232
|
-ms-flex-direction: row;
|
|
233
233
|
flex-direction: row;
|
|
234
|
-
gap: calc(4px *
|
|
234
|
+
gap: calc(4px * 2);
|
|
235
235
|
-webkit-box-pack: start;
|
|
236
236
|
-ms-flex-pack: start;
|
|
237
237
|
-webkit-justify-content: flex-start;
|
|
@@ -338,7 +338,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
|
|
|
338
338
|
-webkit-flex-direction: row;
|
|
339
339
|
-ms-flex-direction: row;
|
|
340
340
|
flex-direction: row;
|
|
341
|
-
gap: calc(4px *
|
|
341
|
+
gap: calc(4px * 2);
|
|
342
342
|
-webkit-box-pack: start;
|
|
343
343
|
-ms-flex-pack: start;
|
|
344
344
|
-webkit-justify-content: flex-start;
|
|
@@ -29,7 +29,7 @@ exports[`MetaBoxesSection renders a Custom Fields option 1`] = `
|
|
|
29
29
|
-webkit-flex-direction: row;
|
|
30
30
|
-ms-flex-direction: row;
|
|
31
31
|
flex-direction: row;
|
|
32
|
-
gap: calc(4px *
|
|
32
|
+
gap: calc(4px * 2);
|
|
33
33
|
-webkit-box-pack: start;
|
|
34
34
|
-ms-flex-pack: start;
|
|
35
35
|
-webkit-justify-content: flex-start;
|
|
@@ -141,7 +141,7 @@ exports[`MetaBoxesSection renders a Custom Fields option and meta box options 1`
|
|
|
141
141
|
-webkit-flex-direction: row;
|
|
142
142
|
-ms-flex-direction: row;
|
|
143
143
|
flex-direction: row;
|
|
144
|
-
gap: calc(4px *
|
|
144
|
+
gap: calc(4px * 2);
|
|
145
145
|
-webkit-box-pack: start;
|
|
146
146
|
-ms-flex-pack: start;
|
|
147
147
|
-webkit-justify-content: flex-start;
|
|
@@ -337,7 +337,7 @@ exports[`MetaBoxesSection renders meta box options 1`] = `
|
|
|
337
337
|
-webkit-flex-direction: row;
|
|
338
338
|
-ms-flex-direction: row;
|
|
339
339
|
flex-direction: row;
|
|
340
|
-
gap: calc(4px *
|
|
340
|
+
gap: calc(4px * 2);
|
|
341
341
|
-webkit-box-pack: start;
|
|
342
342
|
-ms-flex-pack: start;
|
|
343
343
|
-webkit-justify-content: flex-start;
|
package/src/index.js
CHANGED
|
@@ -27,7 +27,8 @@ import { unlock } from './lock-unlock';
|
|
|
27
27
|
|
|
28
28
|
const {
|
|
29
29
|
BackButton: __experimentalMainDashboardButton,
|
|
30
|
-
|
|
30
|
+
registerCoreBlockBindingsSources,
|
|
31
|
+
bootstrapBlockBindingsSourcesFromServer,
|
|
31
32
|
} = unlock( editorPrivateApis );
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -86,6 +87,8 @@ export function initializeEditor(
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
registerCoreBlocks();
|
|
90
|
+
bootstrapBlockBindingsSourcesFromServer( settings?.blockBindingsSources );
|
|
91
|
+
registerCoreBlockBindingsSources();
|
|
89
92
|
registerLegacyWidgetBlock( { inserter: false } );
|
|
90
93
|
registerWidgetGroupBlock( { inserter: false } );
|
|
91
94
|
if ( globalThis.IS_GUTENBERG_PLUGIN ) {
|
|
@@ -93,7 +96,6 @@ export function initializeEditor(
|
|
|
93
96
|
enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,
|
|
94
97
|
} );
|
|
95
98
|
}
|
|
96
|
-
registerDefaultActions();
|
|
97
99
|
|
|
98
100
|
// Show a console log warning if the browser is not in Standards rendering mode.
|
|
99
101
|
const documentMode =
|
|
@@ -12,8 +12,13 @@ export const getEditedPostTemplateId = createRegistrySelector(
|
|
|
12
12
|
type: postType,
|
|
13
13
|
slug,
|
|
14
14
|
} = select( editorStore ).getCurrentPost();
|
|
15
|
-
const { getSite, getEntityRecords } = select( coreStore );
|
|
16
|
-
const siteSettings =
|
|
15
|
+
const { getSite, getEntityRecords, canUser } = select( coreStore );
|
|
16
|
+
const siteSettings = canUser( 'read', {
|
|
17
|
+
kind: 'root',
|
|
18
|
+
name: 'site',
|
|
19
|
+
} )
|
|
20
|
+
? getSite()
|
|
21
|
+
: undefined;
|
|
17
22
|
// First check if the current page is set as the posts page.
|
|
18
23
|
const isPostsPage = +postId === siteSettings?.page_for_posts;
|
|
19
24
|
if ( isPostsPage ) {
|