@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.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/add-new-template/utils.js +1 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +0 -3
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +4 -12
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +18 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +13 -5
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +133 -0
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/screen-block.js +18 -5
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +11 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +17 -1
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -2
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +4 -8
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/post-edit/index.js +10 -12
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +3 -3
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js +3 -4
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/home.js +48 -0
- package/build/components/posts-app-routes/home.js.map +1 -0
- package/build/components/posts-app-routes/index.js +37 -0
- package/build/components/posts-app-routes/index.js.map +1 -0
- package/build/components/posts-app-routes/posts-edit.js +44 -0
- package/build/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view.js +48 -0
- package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-view.js +41 -0
- package/build/components/posts-app-routes/posts-view.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-editor-routes/index.js +1 -2
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/style-book/examples.js +24 -2
- package/build/components/style-book/examples.js.map +1 -1
- package/build/index.js +0 -9
- package/build/index.js.map +1 -1
- package/build/store/actions.js +13 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +21 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +0 -3
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +18 -27
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +13 -5
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +18 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -5
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +18 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -2
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +4 -8
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/post-edit/index.js +9 -11
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +2 -2
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +3 -4
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app-routes/home.js +40 -0
- package/build-module/components/posts-app-routes/home.js.map +1 -0
- package/build-module/components/posts-app-routes/index.js +30 -0
- package/build-module/components/posts-app-routes/index.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-edit.js +36 -0
- package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
- package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view.js +33 -0
- package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +1 -2
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/style-book/examples.js +24 -2
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/index.js +1 -10
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +13 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/posts-rtl.css +59 -18
- package/build-style/posts.css +59 -18
- package/build-style/style-rtl.css +74 -57
- package/build-style/style.css +74 -57
- package/package.json +38 -38
- package/src/components/add-new-template/utils.js +2 -2
- package/src/components/app/index.js +0 -3
- package/src/components/block-editor/use-site-editor-settings.js +7 -21
- package/src/components/editor/index.js +22 -33
- package/src/components/editor/use-editor-title.js +17 -4
- package/src/components/editor/use-resolve-edited-entity.js +132 -0
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/global-styles/block-preview-panel.js +10 -10
- package/src/components/global-styles/screen-block.js +26 -8
- package/src/components/global-styles/screen-style-variations.js +14 -5
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/global-styles-sidebar/index.js +16 -2
- package/src/components/page-patterns/header.js +3 -2
- package/src/components/page-patterns/use-patterns.js +9 -7
- package/src/components/page-templates/style.scss +1 -0
- package/src/components/post-edit/index.js +10 -13
- package/src/components/post-list/index.js +1 -2
- package/src/components/posts-app/index.js +3 -4
- package/src/components/posts-app-routes/home.js +36 -0
- package/src/components/posts-app-routes/index.js +36 -0
- package/src/components/posts-app-routes/posts-edit.js +31 -0
- package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
- package/src/components/posts-app-routes/posts-list-view.js +40 -0
- package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
- package/src/components/posts-app-routes/posts-view.js +35 -0
- package/src/components/sidebar-navigation-screen/style.scss +7 -2
- package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
- package/src/components/site-editor-routes/README.md +2 -2
- package/src/components/site-editor-routes/index.js +0 -2
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/examples.tsx +24 -2
- package/src/index.js +1 -13
- package/src/store/actions.js +15 -0
- package/src/store/selectors.js +24 -1
- package/src/style.scss +0 -2
- package/build/components/post-fields/index.js +0 -96
- package/build/components/post-fields/index.js.map +0 -1
- package/build/components/posts-app/router.js +0 -85
- package/build/components/posts-app/router.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build/components/site-editor-routes/styles-edit.js +0 -33
- package/build/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/build-module/components/post-fields/index.js +0 -88
- package/build-module/components/post-fields/index.js.map +0 -1
- package/build-module/components/posts-app/router.js +0 -77
- package/build-module/components/posts-app/router.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build-module/components/site-editor-routes/styles-edit.js +0 -25
- package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/src/components/post-fields/index.js +0 -107
- package/src/components/post-fields/style.scss +0 -3
- package/src/components/posts-app/router.js +0 -69
- package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
- package/src/components/site-editor-routes/styles-edit.js +0 -26
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
- package/src/store/test/actions.js +0 -83
- package/src/store/test/reducer.js +0 -69
- package/src/store/test/selectors.js +0 -41
|
@@ -50,6 +50,10 @@ import useEditorTitle from './use-editor-title';
|
|
|
50
50
|
import { useIsSiteEditorLoading } from '../layout/hooks';
|
|
51
51
|
import { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';
|
|
52
52
|
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
53
|
+
import {
|
|
54
|
+
useResolveEditedEntity,
|
|
55
|
+
useSyncDeprecatedEntityIntoState,
|
|
56
|
+
} from './use-resolve-edited-entity';
|
|
53
57
|
|
|
54
58
|
const { Editor, BackButton } = unlock( editorPrivateApis );
|
|
55
59
|
const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
@@ -85,38 +89,25 @@ export default function EditSiteEditor( { isPostsList = false } ) {
|
|
|
85
89
|
const { canvas = 'view' } = params;
|
|
86
90
|
const isLoading = useIsSiteEditorLoading();
|
|
87
91
|
useAdaptEditorToCanvas( canvas );
|
|
92
|
+
const entity = useResolveEditedEntity();
|
|
93
|
+
// deprecated sync state with url
|
|
94
|
+
useSyncDeprecatedEntityIntoState( entity );
|
|
95
|
+
const { postType, postId, context } = entity;
|
|
88
96
|
const {
|
|
89
|
-
editedPostType,
|
|
90
|
-
editedPostId,
|
|
91
|
-
contextPostType,
|
|
92
|
-
contextPostId,
|
|
93
|
-
isEditingPage,
|
|
94
97
|
supportsGlobalStyles,
|
|
95
98
|
showIconLabels,
|
|
96
99
|
editorCanvasView,
|
|
97
100
|
currentPostIsTrashed,
|
|
98
101
|
hasSiteIcon,
|
|
99
102
|
} = useSelect( ( select ) => {
|
|
100
|
-
const {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
isPage,
|
|
104
|
-
getEditedPostType,
|
|
105
|
-
getEditedPostId,
|
|
106
|
-
} = unlock( select( editSiteStore ) );
|
|
103
|
+
const { getEditorCanvasContainerView } = unlock(
|
|
104
|
+
select( editSiteStore )
|
|
105
|
+
);
|
|
107
106
|
const { get } = select( preferencesStore );
|
|
108
107
|
const { getCurrentTheme, getEntityRecord } = select( coreDataStore );
|
|
109
|
-
const _context = getEditedPostContext();
|
|
110
108
|
const siteData = getEntityRecord( 'root', '__unstableBase', undefined );
|
|
111
109
|
|
|
112
|
-
// The currently selected entity to display.
|
|
113
|
-
// Typically template or template part in the site editor.
|
|
114
110
|
return {
|
|
115
|
-
editedPostType: getEditedPostType(),
|
|
116
|
-
editedPostId: getEditedPostId(),
|
|
117
|
-
contextPostType: _context?.postId ? _context.postType : undefined,
|
|
118
|
-
contextPostId: _context?.postId ? _context.postId : undefined,
|
|
119
|
-
isEditingPage: isPage(),
|
|
120
111
|
supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
|
|
121
112
|
showIconLabels: get( 'core', 'showIconLabels' ),
|
|
122
113
|
editorCanvasView: getEditorCanvasContainerView(),
|
|
@@ -126,10 +117,10 @@ export default function EditSiteEditor( { isPostsList = false } ) {
|
|
|
126
117
|
hasSiteIcon: !! siteData?.site_icon_url,
|
|
127
118
|
};
|
|
128
119
|
}, [] );
|
|
129
|
-
const postWithTemplate = !!
|
|
120
|
+
const postWithTemplate = !! context?.postId;
|
|
130
121
|
useEditorTitle(
|
|
131
|
-
postWithTemplate ?
|
|
132
|
-
postWithTemplate ?
|
|
122
|
+
postWithTemplate ? context.postType : postType,
|
|
123
|
+
postWithTemplate ? context.postId : postId
|
|
133
124
|
);
|
|
134
125
|
const _isPreviewingTheme = isPreviewingTheme();
|
|
135
126
|
const hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();
|
|
@@ -219,25 +210,21 @@ export default function EditSiteEditor( { isPostsList = false } ) {
|
|
|
219
210
|
return (
|
|
220
211
|
<>
|
|
221
212
|
<GlobalStylesRenderer
|
|
222
|
-
disableRootPadding={
|
|
213
|
+
disableRootPadding={ postType !== TEMPLATE_POST_TYPE }
|
|
223
214
|
/>
|
|
224
215
|
<EditorKeyboardShortcutsRegister />
|
|
225
216
|
{ isEditMode && <BlockKeyboardShortcuts /> }
|
|
226
217
|
{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }
|
|
227
218
|
{ isEditMode && (
|
|
228
219
|
<WelcomeGuide
|
|
229
|
-
postType={
|
|
230
|
-
postWithTemplate ? contextPostType : editedPostType
|
|
231
|
-
}
|
|
220
|
+
postType={ postWithTemplate ? context.postType : postType }
|
|
232
221
|
/>
|
|
233
222
|
) }
|
|
234
223
|
{ isReady && (
|
|
235
224
|
<Editor
|
|
236
|
-
postType={
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
postId={ postWithTemplate ? contextPostId : editedPostId }
|
|
240
|
-
templateId={ postWithTemplate ? editedPostId : undefined }
|
|
225
|
+
postType={ postWithTemplate ? context.postType : postType }
|
|
226
|
+
postId={ postWithTemplate ? context.postId : postId }
|
|
227
|
+
templateId={ postWithTemplate ? postId : undefined }
|
|
241
228
|
settings={ settings }
|
|
242
229
|
className={ clsx( 'edit-site-editor__editor-interface', {
|
|
243
230
|
'show-icon-labels': showIconLabels,
|
|
@@ -252,7 +239,9 @@ export default function EditSiteEditor( { isPostsList = false } ) {
|
|
|
252
239
|
iframeProps={ iframeProps }
|
|
253
240
|
onActionPerformed={ onActionPerformed }
|
|
254
241
|
extraSidebarPanels={
|
|
255
|
-
!
|
|
242
|
+
! postWithTemplate && (
|
|
243
|
+
<PluginTemplateSettingPanel.Slot />
|
|
244
|
+
)
|
|
256
245
|
}
|
|
257
246
|
>
|
|
258
247
|
{ isEditMode && (
|
|
@@ -4,33 +4,46 @@
|
|
|
4
4
|
import { _x, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
7
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
+
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import useTitle from '../routes/use-title';
|
|
14
14
|
import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
|
+
|
|
17
|
+
const { getTemplateInfo } = unlock( editorPrivateApis );
|
|
15
18
|
|
|
16
19
|
function useEditorTitle( postType, postId ) {
|
|
17
20
|
const { title, isLoaded } = useSelect(
|
|
18
21
|
( select ) => {
|
|
19
22
|
const { getEditedEntityRecord, hasFinishedResolution } =
|
|
20
23
|
select( coreStore );
|
|
21
|
-
|
|
22
|
-
select( editorStore );
|
|
24
|
+
|
|
23
25
|
const _record = getEditedEntityRecord(
|
|
24
26
|
'postType',
|
|
25
27
|
postType,
|
|
26
28
|
postId
|
|
27
29
|
);
|
|
30
|
+
|
|
31
|
+
const { default_template_types: templateTypes = [] } =
|
|
32
|
+
select( coreStore ).getEntityRecord(
|
|
33
|
+
'root',
|
|
34
|
+
'__unstableBase'
|
|
35
|
+
) ?? {};
|
|
36
|
+
|
|
37
|
+
const templateInfo = getTemplateInfo( {
|
|
38
|
+
template: _record,
|
|
39
|
+
templateTypes,
|
|
40
|
+
} );
|
|
41
|
+
|
|
28
42
|
const _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [
|
|
29
43
|
'postType',
|
|
30
44
|
postType,
|
|
31
45
|
postId,
|
|
32
46
|
] );
|
|
33
|
-
const templateInfo = getTemplateInfo( _record );
|
|
34
47
|
|
|
35
48
|
return {
|
|
36
49
|
title: templateInfo.title,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEffect, useMemo } from '@wordpress/element';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { store as coreDataStore } from '@wordpress/core-data';
|
|
7
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import {
|
|
15
|
+
TEMPLATE_POST_TYPE,
|
|
16
|
+
TEMPLATE_PART_POST_TYPE,
|
|
17
|
+
NAVIGATION_POST_TYPE,
|
|
18
|
+
PATTERN_TYPES,
|
|
19
|
+
} from '../../utils/constants';
|
|
20
|
+
|
|
21
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
22
|
+
|
|
23
|
+
const postTypesWithoutParentTemplate = [
|
|
24
|
+
TEMPLATE_POST_TYPE,
|
|
25
|
+
TEMPLATE_PART_POST_TYPE,
|
|
26
|
+
NAVIGATION_POST_TYPE,
|
|
27
|
+
PATTERN_TYPES.user,
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const authorizedPostTypes = [ 'page', 'post' ];
|
|
31
|
+
|
|
32
|
+
export function useResolveEditedEntity() {
|
|
33
|
+
const { params = {} } = useLocation();
|
|
34
|
+
const { postId, postType } = params;
|
|
35
|
+
const homePage = useSelect( ( select ) => {
|
|
36
|
+
const { getHomePage } = unlock( select( coreDataStore ) );
|
|
37
|
+
return getHomePage();
|
|
38
|
+
}, [] );
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId
|
|
42
|
+
* in order to match the frontend as closely as possible in the site editor.
|
|
43
|
+
*
|
|
44
|
+
* It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.
|
|
45
|
+
*/
|
|
46
|
+
const resolvedTemplateId = useSelect(
|
|
47
|
+
( select ) => {
|
|
48
|
+
// If we're rendering a post type that doesn't have a template
|
|
49
|
+
// no need to resolve its template.
|
|
50
|
+
if (
|
|
51
|
+
postTypesWithoutParentTemplate.includes( postType ) &&
|
|
52
|
+
postId
|
|
53
|
+
) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Don't trigger resolution for multi-selected posts.
|
|
58
|
+
if ( postId && postId.includes( ',' ) ) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const { getTemplateId } = unlock( select( coreDataStore ) );
|
|
63
|
+
|
|
64
|
+
// If we're rendering a specific page, we need to resolve its template.
|
|
65
|
+
// The site editor only supports pages for now, not other CPTs.
|
|
66
|
+
if (
|
|
67
|
+
postType &&
|
|
68
|
+
postId &&
|
|
69
|
+
authorizedPostTypes.includes( postType )
|
|
70
|
+
) {
|
|
71
|
+
return getTemplateId( postType, postId );
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// If we're rendering the home page, and we have a static home page, resolve its template.
|
|
75
|
+
if ( homePage?.postType === 'page' ) {
|
|
76
|
+
return getTemplateId( 'page', homePage?.postId );
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ( homePage?.postType === 'wp_template' ) {
|
|
80
|
+
return homePage?.postId;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[ homePage, postId, postType ]
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const context = useMemo( () => {
|
|
87
|
+
if ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if ( postType && postId && authorizedPostTypes.includes( postType ) ) {
|
|
92
|
+
return { postType, postId };
|
|
93
|
+
}
|
|
94
|
+
// TODO: for post types lists we should probably not render the front page, but maybe a placeholder
|
|
95
|
+
// with a message like "Select a page" or something similar.
|
|
96
|
+
if ( homePage?.postType === 'page' ) {
|
|
97
|
+
return { postType: 'page', postId: homePage?.postId };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {};
|
|
101
|
+
}, [ homePage, postType, postId ] );
|
|
102
|
+
|
|
103
|
+
if ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {
|
|
104
|
+
return { isReady: true, postType, postId, context };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if ( !! homePage ) {
|
|
108
|
+
return {
|
|
109
|
+
isReady: resolvedTemplateId !== undefined,
|
|
110
|
+
postType: TEMPLATE_POST_TYPE,
|
|
111
|
+
postId: resolvedTemplateId,
|
|
112
|
+
context,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return { isReady: false };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function useSyncDeprecatedEntityIntoState( {
|
|
120
|
+
postType,
|
|
121
|
+
postId,
|
|
122
|
+
context,
|
|
123
|
+
isReady,
|
|
124
|
+
} ) {
|
|
125
|
+
const { setEditedEntity } = useDispatch( editSiteStore );
|
|
126
|
+
|
|
127
|
+
useEffect( () => {
|
|
128
|
+
if ( isReady ) {
|
|
129
|
+
setEditedEntity( postType, postId, context );
|
|
130
|
+
}
|
|
131
|
+
}, [ isReady, postType, postId, context, setEditedEntity ] );
|
|
132
|
+
}
|
|
@@ -141,7 +141,7 @@ function EditorCanvasContainer( {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
function useHasEditorCanvasContainer() {
|
|
144
|
-
const fills = useSlotFills( EditorContentSlotFill.
|
|
144
|
+
const fills = useSlotFills( EditorContentSlotFill.name );
|
|
145
145
|
return !! fills?.length;
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -18,16 +18,16 @@ const BlockPreviewPanel = ( { name, variation = '' } ) => {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
21
|
+
const example = {
|
|
22
|
+
...blockExample,
|
|
23
|
+
attributes: {
|
|
24
|
+
...blockExample.attributes,
|
|
25
|
+
style: undefined,
|
|
26
|
+
className: variation
|
|
27
|
+
? getVariationClassName( variation )
|
|
28
|
+
: blockExample.attributes?.className,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
31
|
|
|
32
32
|
return getBlockFromExample( name, example );
|
|
33
33
|
}, [ name, blockExample, variation ] );
|
|
@@ -102,20 +102,23 @@ function ScreenBlock( { name, variation } ) {
|
|
|
102
102
|
} );
|
|
103
103
|
const [ userSettings ] = useGlobalSetting( '', name, 'user' );
|
|
104
104
|
const [ rawSettings, setSettings ] = useGlobalSetting( '', name );
|
|
105
|
-
const
|
|
105
|
+
const settingsForBlockElement = useSettingsForBlockElement(
|
|
106
|
+
rawSettings,
|
|
107
|
+
name
|
|
108
|
+
);
|
|
106
109
|
const blockType = getBlockType( name );
|
|
107
110
|
|
|
108
111
|
// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
|
|
112
|
+
let disableBlockGap = false;
|
|
109
113
|
if (
|
|
110
|
-
|
|
114
|
+
settingsForBlockElement?.spacing?.blockGap &&
|
|
111
115
|
blockType?.supports?.spacing?.blockGap &&
|
|
112
|
-
( blockType?.supports?.spacing?.
|
|
113
|
-
|
|
114
|
-
blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
|
|
116
|
+
( blockType?.supports?.spacing?.skipSerialization === true ||
|
|
117
|
+
blockType?.supports?.spacing?.skipSerialization?.some?.(
|
|
115
118
|
( spacingType ) => spacingType === 'blockGap'
|
|
116
119
|
) )
|
|
117
120
|
) {
|
|
118
|
-
|
|
121
|
+
disableBlockGap = true;
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
// Only allow `aspectRatio` support if the block is not the grouping block.
|
|
@@ -124,10 +127,25 @@ function ScreenBlock( { name, variation } ) {
|
|
|
124
127
|
// for all three at once. Until there is the ability to set a different aspect
|
|
125
128
|
// ratio for each variation, we disable the aspect ratio controls for the
|
|
126
129
|
// grouping block in global styles.
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
let disableAspectRatio = false;
|
|
131
|
+
if (
|
|
132
|
+
settingsForBlockElement?.dimensions?.aspectRatio &&
|
|
133
|
+
name === 'core/group'
|
|
134
|
+
) {
|
|
135
|
+
disableAspectRatio = true;
|
|
129
136
|
}
|
|
130
137
|
|
|
138
|
+
const settings = useMemo( () => {
|
|
139
|
+
const updatedSettings = structuredClone( settingsForBlockElement );
|
|
140
|
+
if ( disableBlockGap ) {
|
|
141
|
+
updatedSettings.spacing.blockGap = false;
|
|
142
|
+
}
|
|
143
|
+
if ( disableAspectRatio ) {
|
|
144
|
+
updatedSettings.dimensions.aspectRatio = false;
|
|
145
|
+
}
|
|
146
|
+
return updatedSettings;
|
|
147
|
+
}, [ settingsForBlockElement, disableBlockGap, disableAspectRatio ] );
|
|
148
|
+
|
|
131
149
|
const blockVariations = useBlockVariations( name );
|
|
132
150
|
const hasBackgroundPanel = useHasBackgroundPanel( settings );
|
|
133
151
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import {
|
|
5
|
+
privateApis as blockEditorPrivateApis,
|
|
6
|
+
store as blockEditorStore,
|
|
7
|
+
} from '@wordpress/block-editor';
|
|
4
8
|
import { Card, CardBody } from '@wordpress/components';
|
|
9
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
10
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
7
|
-
import { useDispatch } from '@wordpress/data';
|
|
8
11
|
import { store as editorStore } from '@wordpress/editor';
|
|
12
|
+
import { useEffect } from '@wordpress/element';
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Internal dependencies
|
|
@@ -18,11 +22,16 @@ const { useZoomOut } = unlock( blockEditorPrivateApis );
|
|
|
18
22
|
|
|
19
23
|
function ScreenStyleVariations() {
|
|
20
24
|
// Style Variations should only be previewed in with
|
|
21
|
-
// - a "zoomed out" editor
|
|
25
|
+
// - a "zoomed out" editor (but not when in preview mode)
|
|
22
26
|
// - "Desktop" device preview
|
|
27
|
+
const isPreviewMode = useSelect( ( select ) => {
|
|
28
|
+
return select( blockEditorStore ).getSettings().isPreviewMode;
|
|
29
|
+
}, [] );
|
|
23
30
|
const { setDeviceType } = useDispatch( editorStore );
|
|
24
|
-
useZoomOut();
|
|
25
|
-
|
|
31
|
+
useZoomOut( ! isPreviewMode );
|
|
32
|
+
useEffect( () => {
|
|
33
|
+
setDeviceType( 'desktop' );
|
|
34
|
+
}, [ setDeviceType ] );
|
|
26
35
|
|
|
27
36
|
return (
|
|
28
37
|
<>
|
|
@@ -19,7 +19,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
19
19
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
20
20
|
import { moreVertical } from '@wordpress/icons';
|
|
21
21
|
import { store as coreStore } from '@wordpress/core-data';
|
|
22
|
-
import { useEffect
|
|
22
|
+
import { useEffect } from '@wordpress/element';
|
|
23
23
|
import { usePrevious } from '@wordpress/compose';
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -5,7 +5,7 @@ import { FlexItem, Flex, Button } from '@wordpress/components';
|
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { styles, seen, backup } from '@wordpress/icons';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
-
import { useEffect } from '@wordpress/element';
|
|
8
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
9
9
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
10
|
import {
|
|
11
11
|
store as editorStore,
|
|
@@ -29,7 +29,7 @@ const { useLocation } = unlock( routerPrivateApis );
|
|
|
29
29
|
|
|
30
30
|
export default function GlobalStylesSidebar() {
|
|
31
31
|
const { params } = useLocation();
|
|
32
|
-
const { canvas = 'view' } = params;
|
|
32
|
+
const { canvas = 'view', path } = params;
|
|
33
33
|
const {
|
|
34
34
|
shouldClearCanvasContainerView,
|
|
35
35
|
isStyleBookOpened,
|
|
@@ -128,6 +128,20 @@ export default function GlobalStylesSidebar() {
|
|
|
128
128
|
);
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
const { getActiveComplementaryArea } = useSelect( interfaceStore );
|
|
132
|
+
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
133
|
+
const previousActiveAreaRef = useRef( null );
|
|
134
|
+
|
|
135
|
+
useEffect( () => {
|
|
136
|
+
if ( path?.startsWith( '/wp_global_styles' ) && canvas === 'edit' ) {
|
|
137
|
+
previousActiveAreaRef.current =
|
|
138
|
+
getActiveComplementaryArea( 'core' );
|
|
139
|
+
enableComplementaryArea( 'core', 'edit-site/global-styles' );
|
|
140
|
+
} else if ( previousActiveAreaRef.current ) {
|
|
141
|
+
enableComplementaryArea( 'core', previousActiveAreaRef.current );
|
|
142
|
+
}
|
|
143
|
+
}, [ path, enableComplementaryArea, canvas, getActiveComplementaryArea ] );
|
|
144
|
+
|
|
131
145
|
return (
|
|
132
146
|
<DefaultSidebar
|
|
133
147
|
className="edit-site-global-styles-sidebar"
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
__experimentalText as Text,
|
|
10
10
|
__experimentalVStack as VStack,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
|
-
import { store as
|
|
12
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
15
15
|
import { moreVertical } from '@wordpress/icons';
|
|
@@ -32,7 +32,8 @@ export default function PatternsHeader( {
|
|
|
32
32
|
const { patternCategories } = usePatternCategories();
|
|
33
33
|
const templatePartAreas = useSelect(
|
|
34
34
|
( select ) =>
|
|
35
|
-
select(
|
|
35
|
+
select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
36
|
+
?.default_template_part_areas || [],
|
|
36
37
|
[]
|
|
37
38
|
);
|
|
38
39
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { parse } from '@wordpress/blocks';
|
|
5
5
|
import { useSelect, createSelector } from '@wordpress/data';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
7
|
import { useMemo } from '@wordpress/element';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -28,8 +27,7 @@ const selectTemplateParts = createSelector(
|
|
|
28
27
|
( select, categoryId, search = '' ) => {
|
|
29
28
|
const { getEntityRecords, isResolving: isResolvingSelector } =
|
|
30
29
|
select( coreStore );
|
|
31
|
-
|
|
32
|
-
select( editorStore );
|
|
30
|
+
|
|
33
31
|
const query = { per_page: -1 };
|
|
34
32
|
const templateParts =
|
|
35
33
|
getEntityRecords( 'postType', TEMPLATE_PART_POST_TYPE, query ) ??
|
|
@@ -38,7 +36,10 @@ const selectTemplateParts = createSelector(
|
|
|
38
36
|
// In the case where a custom template part area has been removed we need
|
|
39
37
|
// the current list of areas to cross check against so orphaned template
|
|
40
38
|
// parts can be treated as uncategorized.
|
|
41
|
-
const knownAreas =
|
|
39
|
+
const knownAreas =
|
|
40
|
+
select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
41
|
+
?.default_template_part_areas || [];
|
|
42
|
+
|
|
42
43
|
const templatePartAreas = knownAreas.map( ( area ) => area.area );
|
|
43
44
|
|
|
44
45
|
const templatePartHasCategory = ( item, category ) => {
|
|
@@ -78,7 +79,8 @@ const selectTemplateParts = createSelector(
|
|
|
78
79
|
TEMPLATE_PART_POST_TYPE,
|
|
79
80
|
{ per_page: -1 },
|
|
80
81
|
] ),
|
|
81
|
-
select(
|
|
82
|
+
select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
83
|
+
?.default_template_part_areas,
|
|
82
84
|
]
|
|
83
85
|
);
|
|
84
86
|
|
|
@@ -156,7 +158,7 @@ const selectPatterns = createSelector(
|
|
|
156
158
|
categoryId,
|
|
157
159
|
hasCategory: ( item, currentCategory ) => {
|
|
158
160
|
if ( item.type === PATTERN_TYPES.user ) {
|
|
159
|
-
return item.wp_pattern_category
|
|
161
|
+
return item.wp_pattern_category?.some(
|
|
160
162
|
( catId ) =>
|
|
161
163
|
userPatternCategories.find(
|
|
162
164
|
( cat ) => cat.id === catId
|
|
@@ -173,7 +175,7 @@ const selectPatterns = createSelector(
|
|
|
173
175
|
return (
|
|
174
176
|
userPatternCategories?.length &&
|
|
175
177
|
( ! item.wp_pattern_category?.length ||
|
|
176
|
-
! item.wp_pattern_category
|
|
178
|
+
! item.wp_pattern_category?.some( ( catId ) =>
|
|
177
179
|
userPatternCategories.find(
|
|
178
180
|
( cat ) => cat.id === catId
|
|
179
181
|
)
|
|
@@ -18,10 +18,9 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
20
|
import Page from '../page';
|
|
21
|
-
import usePostFields from '../post-fields';
|
|
22
21
|
import { unlock } from '../../lock-unlock';
|
|
23
22
|
|
|
24
|
-
const { PostCardPanel } = unlock( editorPrivateApis );
|
|
23
|
+
const { PostCardPanel, usePostFields } = unlock( editorPrivateApis );
|
|
25
24
|
|
|
26
25
|
const fieldsWithBulkEditSupport = [
|
|
27
26
|
'title',
|
|
@@ -71,9 +70,16 @@ function PostEditForm( { postType, postId } ) {
|
|
|
71
70
|
() => ( {
|
|
72
71
|
type: 'panel',
|
|
73
72
|
fields: [
|
|
74
|
-
|
|
73
|
+
{
|
|
74
|
+
id: 'featured_media',
|
|
75
|
+
layout: 'regular',
|
|
76
|
+
},
|
|
75
77
|
'title',
|
|
76
|
-
|
|
78
|
+
{
|
|
79
|
+
id: 'status',
|
|
80
|
+
label: __( 'Status & Visibility' ),
|
|
81
|
+
children: [ 'status', 'password' ],
|
|
82
|
+
},
|
|
77
83
|
'author',
|
|
78
84
|
'date',
|
|
79
85
|
'slug',
|
|
@@ -84,15 +90,6 @@ function PostEditForm( { postType, postId } ) {
|
|
|
84
90
|
ids.length === 1 ||
|
|
85
91
|
fieldsWithBulkEditSupport.includes( field )
|
|
86
92
|
),
|
|
87
|
-
combinedFields: [
|
|
88
|
-
{
|
|
89
|
-
id: 'status_and_visibility',
|
|
90
|
-
label: __( 'Status & Visibility' ),
|
|
91
|
-
children: [ 'status', 'password' ],
|
|
92
|
-
direction: 'vertical',
|
|
93
|
-
render: ( { item } ) => item.status,
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
93
|
} ),
|
|
97
94
|
[ ids ]
|
|
98
95
|
);
|
|
@@ -32,9 +32,8 @@ import AddNewPostModal from '../add-new-post';
|
|
|
32
32
|
import { unlock } from '../../lock-unlock';
|
|
33
33
|
import { useEditPostAction } from '../dataviews-actions';
|
|
34
34
|
import { usePrevious } from '@wordpress/compose';
|
|
35
|
-
import usePostFields from '../post-fields';
|
|
36
35
|
|
|
37
|
-
const { usePostActions } = unlock( editorPrivateApis );
|
|
36
|
+
const { usePostActions, usePostFields } = unlock( editorPrivateApis );
|
|
38
37
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
39
38
|
const { useEntityRecordsWithPermissions } = unlock( coreDataPrivateApis );
|
|
40
39
|
const EMPTY_ARRAY = [];
|
|
@@ -10,17 +10,16 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
14
13
|
import Layout from '../layout';
|
|
15
|
-
import
|
|
14
|
+
import { useRegisterPostsAppRoutes } from '../posts-app-routes';
|
|
16
15
|
import { unlock } from '../../lock-unlock';
|
|
16
|
+
import useActiveRoute from '../layout/router';
|
|
17
17
|
|
|
18
18
|
const { RouterProvider } = unlock( routerPrivateApis );
|
|
19
19
|
const { GlobalStylesProvider } = unlock( editorPrivateApis );
|
|
20
20
|
|
|
21
21
|
function PostsLayout() {
|
|
22
|
-
|
|
23
|
-
useInitEditedEntityFromURL();
|
|
22
|
+
useRegisterPostsAppRoutes();
|
|
24
23
|
const route = useActiveRoute();
|
|
25
24
|
return <Layout route={ route } />;
|
|
26
25
|
}
|