@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","PostList","DataViewsSidebarContent","SidebarNavigationScreen","Editor","jsx","_jsx","postsListViewRoute","name","match","params","_params$layout","isCustom","layout","quickEdit","postType","canvas","areas","sidebar","title","isRoot","content","preview","isPostsList","mobile","widths"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/posts-list-view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostList from '../post-list';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport Editor from '../editor';\n\nexport const postsListViewRoute = {\n\tname: 'posts-list-view',\n\tmatch: ( params ) => {\n\t\treturn (\n\t\t\tparams.isCustom !== 'true' &&\n\t\t\t( params.layout ?? 'list' ) === 'list' &&\n\t\t\t! params.quickEdit &&\n\t\t\tparams.postType === 'post' &&\n\t\t\tparams.canvas !== 'edit'\n\t\t);\n\t},\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t/>\n\t\t),\n\t\tcontent: <PostList postType=\"post\" />,\n\t\tpreview: <Editor isPostsList />,\n\t\tmobile: <PostList postType=\"post\" />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
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PostList from '../post-list';
|
|
11
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
12
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { PostEdit } from '../post-edit';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
const {
|
|
17
|
+
useLocation
|
|
18
|
+
} = unlock(routerPrivateApis);
|
|
19
|
+
function PostQuickEdit() {
|
|
20
|
+
const {
|
|
21
|
+
params
|
|
22
|
+
} = useLocation();
|
|
23
|
+
return /*#__PURE__*/_jsx(PostEdit, {
|
|
24
|
+
postType: "post",
|
|
25
|
+
postId: params.postId
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export const postsViewQuickEditRoute = {
|
|
29
|
+
name: 'posts-view-quick-edit',
|
|
30
|
+
match: params => {
|
|
31
|
+
var _params$layout;
|
|
32
|
+
return (params.isCustom === 'true' || ((_params$layout = params.layout) !== null && _params$layout !== void 0 ? _params$layout : 'list') !== 'list') && !!params.quickEdit && params.postType === 'post' && params.canvas !== 'edit';
|
|
33
|
+
},
|
|
34
|
+
areas: {
|
|
35
|
+
sidebar: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
|
|
36
|
+
title: __('Posts'),
|
|
37
|
+
isRoot: true,
|
|
38
|
+
content: /*#__PURE__*/_jsx(DataViewsSidebarContent, {})
|
|
39
|
+
}),
|
|
40
|
+
content: /*#__PURE__*/_jsx(PostList, {
|
|
41
|
+
postType: "post"
|
|
42
|
+
}),
|
|
43
|
+
mobile: /*#__PURE__*/_jsx(PostList, {
|
|
44
|
+
postType: "post"
|
|
45
|
+
}),
|
|
46
|
+
edit: /*#__PURE__*/_jsx(PostQuickEdit, {})
|
|
47
|
+
},
|
|
48
|
+
widths: {
|
|
49
|
+
edit: 380
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=posts-view-quick-edit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","privateApis","routerPrivateApis","PostList","DataViewsSidebarContent","SidebarNavigationScreen","unlock","PostEdit","jsx","_jsx","useLocation","PostQuickEdit","params","postType","postId","postsViewQuickEditRoute","name","match","_params$layout","isCustom","layout","quickEdit","canvas","areas","sidebar","title","isRoot","content","mobile","edit","widths"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/posts-view-quick-edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport PostList from '../post-list';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { PostEdit } from '../post-edit';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction PostQuickEdit() {\n\tconst { params } = useLocation();\n\treturn <PostEdit postType=\"post\" postId={ params.postId } />;\n}\n\nexport const postsViewQuickEditRoute = {\n\tname: 'posts-view-quick-edit',\n\tmatch: ( params ) => {\n\t\treturn (\n\t\t\t( params.isCustom === 'true' ||\n\t\t\t\t( params.layout ?? 'list' ) !== 'list' ) &&\n\t\t\t!! params.quickEdit &&\n\t\t\tparams.postType === 'post' &&\n\t\t\tparams.canvas !== 'edit'\n\t\t);\n\t},\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t/>\n\t\t),\n\t\tcontent: <PostList postType=\"post\" />,\n\t\tmobile: <PostList postType=\"post\" />,\n\t\tedit: <P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DuB,OAAO,eAAElB,IAAA,CAACN,QAAQ;MAACU,QAAQ,EAAC;IAAM,CAAE,CAAC;IACrCe,MAAM,eAAEnB,IAAA,CAACN,QAAQ;MAACU,QAAQ,EAAC;IAAM,CAAE,CAAC;IACpCgB,IAAI,eAAEpB,IAAA,CAACE,aAAa,IAAE;EACvB,CAAC;EACDmB,MAAM,EAAE;IACPD,IAAI,EAAE;EACP;AACD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export const postsViewRoute = {
|
|
14
|
+
name: 'posts-view',
|
|
15
|
+
match: params => {
|
|
16
|
+
var _params$layout;
|
|
17
|
+
return (params.isCustom === 'true' || ((_params$layout = params.layout) !== null && _params$layout !== void 0 ? _params$layout : 'list') !== 'list') && !params.quickEdit && params.postType === 'post' && params.canvas !== 'edit';
|
|
18
|
+
},
|
|
19
|
+
areas: {
|
|
20
|
+
sidebar: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
|
|
21
|
+
title: __('Posts'),
|
|
22
|
+
isRoot: true,
|
|
23
|
+
content: /*#__PURE__*/_jsx(DataViewsSidebarContent, {})
|
|
24
|
+
}),
|
|
25
|
+
content: /*#__PURE__*/_jsx(PostList, {
|
|
26
|
+
postType: "post"
|
|
27
|
+
}),
|
|
28
|
+
mobile: /*#__PURE__*/_jsx(PostList, {
|
|
29
|
+
postType: "post"
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=posts-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","PostList","DataViewsSidebarContent","SidebarNavigationScreen","jsx","_jsx","postsViewRoute","name","match","params","_params$layout","isCustom","layout","quickEdit","postType","canvas","areas","sidebar","title","isRoot","content","mobile"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/posts-view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PostList from '../post-list';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nexport const postsViewRoute = {\n\tname: 'posts-view',\n\tmatch: ( params ) => {\n\t\treturn (\n\t\t\t( params.isCustom === 'true' ||\n\t\t\t\t( params.layout ?? 'list' ) !== 'list' ) &&\n\t\t\t! params.quickEdit &&\n\t\t\tparams.postType === 'post' &&\n\t\t\tparams.canvas !== 'edit'\n\t\t);\n\t},\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t/>\n\t\t),\n\t\tcontent: <PostList postType=\"post\" />,\n\t\tmobile: <PostList postType=\"post\" />,\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AACnC,OAAOC,uBAAuB,MAAM,sBAAsB;AAC1D,OAAOC,uBAAuB,MAAM,8BAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnE,OAAO,MAAMC,cAAc,GAAG;EAC7BC,IAAI,EAAE,YAAY;EAClBC,KAAK,EAAIC,MAAM,IAAM;IAAA,IAAAC,cAAA;IACpB,OACC,CAAED,MAAM,CAACE,QAAQ,KAAK,MAAM,IAC3B,EAAAD,cAAA,GAAED,MAAM,CAACG,MAAM,cAAAF,cAAA,cAAAA,cAAA,GAAI,MAAM,MAAO,MAAM,KACvC,CAAED,MAAM,CAACI,SAAS,IAClBJ,MAAM,CAACK,QAAQ,KAAK,MAAM,IAC1BL,MAAM,CAACM,MAAM,KAAK,MAAM;EAE1B,CAAC;EACDC,KAAK,EAAE;IACNC,OAAO,eACNZ,IAAA,CAACF,uBAAuB;MACvBe,KAAK,EAAGlB,EAAE,CAAE,OAAQ,CAAG;MACvBmB,MAAM;MACNC,OAAO,eAAGf,IAAA,CAACH,uBAAuB,IAAE;IAAG,CACvC,CACD;IACDkB,OAAO,eAAEf,IAAA,CAACJ,QAAQ;MAACa,QAAQ,EAAC;IAAM,CAAE,CAAC;IACrCO,MAAM,eAAEhB,IAAA,CAACJ,QAAQ;MAACa,QAAQ,EAAC;IAAM,CAAE;EACpC;AACD,CAAC","ignoreList":[]}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
6
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
4
|
+
import { _n, sprintf } from '@wordpress/i18n';
|
|
7
5
|
import { addQueryArgs } from '@wordpress/url';
|
|
8
|
-
import {
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
9
7
|
import { backup } from '@wordpress/icons';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Internal dependencies
|
|
13
11
|
*/
|
|
14
|
-
import { SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
|
|
15
12
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
16
|
-
import { jsx as _jsx
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
14
|
export default function SidebarNavigationScreenDetailsFooter({
|
|
18
15
|
record,
|
|
16
|
+
revisionsCount,
|
|
19
17
|
...otherProps
|
|
20
18
|
}) {
|
|
21
|
-
var _record$_links$predec
|
|
19
|
+
var _record$_links$predec;
|
|
22
20
|
/*
|
|
23
21
|
* There might be other items in the future,
|
|
24
22
|
* but for now it's just modified date.
|
|
@@ -27,8 +25,17 @@ export default function SidebarNavigationScreenDetailsFooter({
|
|
|
27
25
|
*/
|
|
28
26
|
const hrefProps = {};
|
|
29
27
|
const lastRevisionId = (_record$_links$predec = record?._links?.['predecessor-version']?.[0]?.id) !== null && _record$_links$predec !== void 0 ? _record$_links$predec : null;
|
|
30
|
-
|
|
31
|
-
//
|
|
28
|
+
|
|
29
|
+
// Use incoming prop first, then the record's version history, if available.
|
|
30
|
+
revisionsCount = revisionsCount || record?._links?.['version-history']?.[0]?.count || 0;
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Enable the revisions link if there is a last revision and there is more than one revision.
|
|
34
|
+
* This link is used for theme assets, e.g., templates, which have no database record until they're edited.
|
|
35
|
+
* For these files there's only a "revision" after they're edited twice,
|
|
36
|
+
* which means the revision.php page won't display a proper diff.
|
|
37
|
+
* See: https://github.com/WordPress/gutenberg/issues/49164.
|
|
38
|
+
*/
|
|
32
39
|
if (lastRevisionId && revisionsCount > 1) {
|
|
33
40
|
hrefProps.href = addQueryArgs('revision.php', {
|
|
34
41
|
revision: record?._links['predecessor-version'][0].id
|
|
@@ -36,27 +43,14 @@ export default function SidebarNavigationScreenDetailsFooter({
|
|
|
36
43
|
hrefProps.as = 'a';
|
|
37
44
|
}
|
|
38
45
|
return /*#__PURE__*/_jsx(ItemGroup, {
|
|
46
|
+
size: "large",
|
|
39
47
|
className: "edit-site-sidebar-navigation-screen-details-footer",
|
|
40
48
|
children: /*#__PURE__*/_jsx(SidebarNavigationItem, {
|
|
41
|
-
|
|
49
|
+
icon: backup,
|
|
42
50
|
...hrefProps,
|
|
43
51
|
...otherProps,
|
|
44
|
-
children:
|
|
45
|
-
|
|
46
|
-
children: [/*#__PURE__*/_jsx(SidebarNavigationScreenDetailsPanelLabel, {
|
|
47
|
-
children: __('Last modified')
|
|
48
|
-
}), /*#__PURE__*/_jsx(SidebarNavigationScreenDetailsPanelValue, {
|
|
49
|
-
children: createInterpolateElement(sprintf(/* translators: %s: is the relative time when the post was last modified. */
|
|
50
|
-
__('<time>%s</time>'), humanTimeDiff(record.modified)), {
|
|
51
|
-
time: /*#__PURE__*/_jsx("time", {
|
|
52
|
-
dateTime: record.modified
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
}), /*#__PURE__*/_jsx(Icon, {
|
|
56
|
-
className: "edit-site-sidebar-navigation-screen-details-footer__icon",
|
|
57
|
-
icon: backup
|
|
58
|
-
})]
|
|
59
|
-
})
|
|
52
|
+
children: sprintf(/* translators: %d: Number of Styles revisions. */
|
|
53
|
+
_n('%d Revision', '%d Revisions', revisionsCount), revisionsCount)
|
|
60
54
|
})
|
|
61
55
|
});
|
|
62
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_n","sprintf","addQueryArgs","__experimentalItemGroup","ItemGroup","backup","SidebarNavigationItem","jsx","_jsx","SidebarNavigationScreenDetailsFooter","record","revisionsCount","otherProps","_record$_links$predec","hrefProps","lastRevisionId","_links","id","count","href","revision","as","size","className","children","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenDetailsFooter( {\n\trecord,\n\trevisionsCount,\n\t...otherProps\n} ) {\n\t/*\n\t * There might be other items in the future,\n\t * but for now it's just modified date.\n\t * Later we might render a list of items and isolate\n\t * the following logic.\n\t */\n\tconst hrefProps = {};\n\tconst lastRevisionId =\n\t\trecord?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\n\t// Use incoming prop first, then the record's version history, if available.\n\trevisionsCount =\n\t\trevisionsCount ||\n\t\trecord?._links?.[ 'version-history' ]?.[ 0 ]?.count ||\n\t\t0;\n\n\t/*\n\t * Enable the revisions link if there is a last revision and there is more than one revision.\n\t * This link is used for theme assets, e.g., templates, which have no database record until they're edited.\n\t * For these files there's only a \"revision\" after they're edited twice,\n\t * which means the revision.php page won't display a proper diff.\n\t * See: https://github.com/WordPress/gutenberg/issues/49164.\n\t */\n\tif ( lastRevisionId && revisionsCount > 1 ) {\n\t\threfProps.href = addQueryArgs( 'revision.php', {\n\t\t\trevision: record?._links[ 'predecessor-version' ][ 0 ].id,\n\t\t} );\n\t\threfProps.as = 'a';\n\t}\n\treturn (\n\t\t<ItemGroup\n\t\t\tsize=\"large\"\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen-details-footer\"\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ backup }\n\t\t\t\t{ ...hrefProps }\n\t\t\t\t{ ...otherProps }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: %d: Number of Styles revisions. */\n\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,MAAM,QAAQ,kBAAkB;;AAEzC;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/D,eAAe,SAASC,oCAAoCA,CAAE;EAC7DC,MAAM;EACNC,cAAc;EACd,GAAGC;AACJ,CAAC,EAAG;EAAA,IAAAC,qBAAA;EACH;AACD;AACA;AACA;AACA;AACA;EACC,MAAMC,SAAS,GAAG,CAAC,CAAC;EACpB,MAAMC,cAAc,IAAAF,qBAAA,GACnBH,MAAM,EAAEM,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEC,EAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,IAAI;;EAE7D;EACAF,cAAc,GACbA,cAAc,IACdD,MAAM,EAAEM,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEE,KAAK,IACnD,CAAC;;EAEF;AACD;AACA;AACA;AACA;AACA;AACA;EACC,IAAKH,cAAc,IAAIJ,cAAc,GAAG,CAAC,EAAG;IAC3CG,SAAS,CAACK,IAAI,GAAGjB,YAAY,CAAE,cAAc,EAAE;MAC9CkB,QAAQ,EAAEV,MAAM,EAAEM,MAAM,CAAE,qBAAqB,CAAE,CAAE,CAAC,CAAE,CAACC;IACxD,CAAE,CAAC;IACHH,SAAS,CAACO,EAAE,GAAG,GAAG;EACnB;EACA,oBACCb,IAAA,CAACJ,SAAS;IACTkB,IAAI,EAAC,OAAO;IACZC,SAAS,EAAC,oDAAoD;IAAAC,QAAA,eAE9DhB,IAAA,CAACF,qBAAqB;MACrBmB,IAAI,EAAGpB,MAAQ;MAAA,GACVS,SAAS;MAAA,GACTF,UAAU;MAAAY,QAAA,EAEbvB,OAAO,CACR;MACAD,EAAE,CAAE,aAAa,EAAE,cAAc,EAAEW,cAAe,CAAC,EACnDA,cACD;IAAC,CACqB;EAAC,CACd,CAAC;AAEd","ignoreList":[]}
|
|
@@ -49,7 +49,8 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
49
49
|
} = useLocation();
|
|
50
50
|
const {
|
|
51
51
|
revisions,
|
|
52
|
-
isLoading: isLoadingRevisions
|
|
52
|
+
isLoading: isLoadingRevisions,
|
|
53
|
+
revisionsCount
|
|
53
54
|
} = useGlobalStylesRevisions();
|
|
54
55
|
const {
|
|
55
56
|
openGeneralSidebar
|
|
@@ -57,20 +58,6 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
57
58
|
const {
|
|
58
59
|
setEditorCanvasContainerView
|
|
59
60
|
} = unlock(useDispatch(editSiteStore));
|
|
60
|
-
const {
|
|
61
|
-
revisionsCount
|
|
62
|
-
} = useSelect(select => {
|
|
63
|
-
var _globalStyles$_links$;
|
|
64
|
-
const {
|
|
65
|
-
getEntityRecord,
|
|
66
|
-
__experimentalGetCurrentGlobalStylesId
|
|
67
|
-
} = select(coreStore);
|
|
68
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
69
|
-
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
70
|
-
return {
|
|
71
|
-
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
|
|
72
|
-
};
|
|
73
|
-
}, []);
|
|
74
61
|
const {
|
|
75
62
|
set: setPreference
|
|
76
63
|
} = useDispatch(preferencesStore);
|
|
@@ -93,9 +80,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
93
80
|
}, [openGlobalStyles, setEditorCanvasContainerView]);
|
|
94
81
|
|
|
95
82
|
// If there are no revisions, do not render a footer.
|
|
96
|
-
const
|
|
97
|
-
const modifiedDateTime = revisions?.[0]?.modified;
|
|
98
|
-
const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
|
|
83
|
+
const shouldShowGlobalStylesFooter = !!revisionsCount && !isLoadingRevisions;
|
|
99
84
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
100
85
|
children: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
|
|
101
86
|
title: __('Design'),
|
|
@@ -106,6 +91,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
106
91
|
}),
|
|
107
92
|
footer: shouldShowGlobalStylesFooter && /*#__PURE__*/_jsx(SidebarNavigationScreenDetailsFooter, {
|
|
108
93
|
record: revisions?.[0],
|
|
94
|
+
revisionsCount: revisionsCount,
|
|
109
95
|
onClick: openRevisions
|
|
110
96
|
})
|
|
111
97
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useSelect","useDispatch","store","coreStore","useCallback","preferencesStore","privateApis","routerPrivateApis","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationItem","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","MainSidebarNavigationContent","jsx","_jsx","Fragment","_Fragment","useLocation","useHistory","SidebarNavigationItemGlobalStyles","props","params","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","path","uid","startsWith","SidebarNavigationScreenGlobalStyles","history","revisions","isLoading","isLoadingRevisions","
|
|
1
|
+
{"version":3,"names":["__","useSelect","useDispatch","store","coreStore","useCallback","preferencesStore","privateApis","routerPrivateApis","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationItem","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","MainSidebarNavigationContent","jsx","_jsx","Fragment","_Fragment","useLocation","useHistory","SidebarNavigationItemGlobalStyles","props","params","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","path","uid","startsWith","SidebarNavigationScreenGlobalStyles","history","revisions","isLoading","isLoadingRevisions","revisionsCount","openGeneralSidebar","setEditorCanvasContainerView","set","setPreference","openGlobalStyles","push","canvas","undefined","transition","Promise","all","openRevisions","shouldShowGlobalStylesFooter","children","title","isRoot","description","content","activeItem","footer","record","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCallback } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { params } = useLocation();\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<SidebarNavigationItem\n\t\t\t\t{ ...props }\n\t\t\t\tparams={ { path: '/wp_global_styles' } }\n\t\t\t\tuid=\"global-styles-navigation-item\"\n\t\t\t\taria-current={\n\t\t\t\t\tparams.path && params.path.startsWith( '/wp_global_styles' )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\treturn <SidebarNavigationItem { ...props } />;\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst {\n\t\trevisions,\n\t\tisLoading: isLoadingRevisions,\n\t\trevisionsCount,\n\t} = useGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.push(\n\t\t\t{\n\t\t\t\t...params,\n\t\t\t\tcanvas: 'edit',\n\t\t\t},\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t}\n\t\t);\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ history, params, openGeneralSidebar, setPreference ] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst shouldShowGlobalStylesFooter =\n\t\t!! revisionsCount && ! isLoadingRevisions;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Design' ) }\n\t\t\t\tisRoot\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t\t) }\n\t\t\t\tcontent={\n\t\t\t\t\t<MainSidebarNavigationContent activeItem=\"styles-navigation-item\" />\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\trevisionsCount={ revisionsCount }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,EAA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MACvB2C,KAAK,EAAGpD,EAAE,CAAE,QAAS,CAAG;MACxBqD,MAAM;MACNC,WAAW,EAAGtD,EAAE,CACf,kEACD,CAAG;MACHuD,OAAO,eACNtC,IAAA,CAACF,4BAA4B;QAACyC,UAAU,EAAC;MAAwB,CAAE,CACnE;MACDC,MAAM,EACLP,4BAA4B,iBAC3BjC,IAAA,CAACH,oCAAoC;QACpC4C,MAAM,EAAGxB,SAAS,GAAI,CAAC,CAAI;QAC3BG,cAAc,EAAGA,cAAgB;QACjCsB,OAAO,EAAGV;MAAe,CACzB;IAEF,CACD;EAAC,CACD,CAAC;AAEL","ignoreList":[]}
|
package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js
CHANGED
|
@@ -66,7 +66,7 @@ export default function usePatternCategories() {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
// If the pattern has no categories, add it to uncategorized.
|
|
69
|
-
if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category
|
|
69
|
+
if (!pattern.wp_pattern_category?.length || !pattern.wp_pattern_category?.some(catId => userPatternCategories.find(cat => cat.id === catId))) {
|
|
70
70
|
categoryMap.uncategorized.count += 1;
|
|
71
71
|
}
|
|
72
72
|
});
|
package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","__","useDefaultPatternCategories","useThemePatterns","usePatterns","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","usePatternCategories","defaultCategories","push","name","label","themePatterns","patterns","userPatterns","categories","userPatternCategories","user","patternCategories","categoryMap","categoriesWithCounts","forEach","category","count","pattern","length","uncategorized","wp_pattern_category","catId","find","cat","id","some","sortedCategories","sort","a","b","localeCompare","unshift","description","hasPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\nimport usePatterns from '../page-patterns/use-patterns';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\tconst { patterns: userPatterns, categories: userPatternCategories } =\n\t\tusePatterns( PATTERN_TYPES.user );\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect user registered patterns.\n\t\tuserPatterns.forEach( ( pattern ) => {\n\t\t\tpattern.wp_pattern_category?.forEach( ( catId ) => {\n\t\t\t\tconst category = userPatternCategories.find(\n\t\t\t\t\t( cat ) => cat.id === catId\n\t\t\t\t)?.name;\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif (\n\t\t\t\t! pattern.wp_pattern_category?.length ||\n\t\t\t\t! pattern.wp_pattern_category
|
|
1
|
+
{"version":3,"names":["useMemo","__","useDefaultPatternCategories","useThemePatterns","usePatterns","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","usePatternCategories","defaultCategories","push","name","label","themePatterns","patterns","userPatterns","categories","userPatternCategories","user","patternCategories","categoryMap","categoriesWithCounts","forEach","category","count","pattern","length","uncategorized","wp_pattern_category","catId","find","cat","id","some","sortedCategories","sort","a","b","localeCompare","unshift","description","hasPatterns"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\nimport usePatterns from '../page-patterns/use-patterns';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n} from '../../utils/constants';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tdefaultCategories.push( {\n\t\tname: TEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\t\tlabel: __( 'Uncategorized' ),\n\t} );\n\tconst themePatterns = useThemePatterns();\n\tconst { patterns: userPatterns, categories: userPatternCategories } =\n\t\tusePatterns( PATTERN_TYPES.user );\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\t\tuserPatternCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif ( ! pattern.categories?.length ) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect user registered patterns.\n\t\tuserPatterns.forEach( ( pattern ) => {\n\t\t\tpattern.wp_pattern_category?.forEach( ( catId ) => {\n\t\t\t\tconst category = userPatternCategories.find(\n\t\t\t\t\t( cat ) => cat.id === catId\n\t\t\t\t)?.name;\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t\t// If the pattern has no categories, add it to uncategorized.\n\t\t\tif (\n\t\t\t\t! pattern.wp_pattern_category?.length ||\n\t\t\t\t! pattern.wp_pattern_category?.some( ( catId ) =>\n\t\t\t\t\tuserPatternCategories.find( ( cat ) => cat.id === catId )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcategoryMap.uncategorized.count += 1;\n\t\t\t}\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\t[ ...defaultCategories, ...userPatternCategories ].forEach(\n\t\t\t( category ) => {\n\t\t\t\tif (\n\t\t\t\t\tcategoryMap[ category.name ].count &&\n\t\t\t\t\t! categoriesWithCounts.find(\n\t\t\t\t\t\t( cat ) => cat.name === category.name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tconst sortedCategories = categoriesWithCounts.sort( ( a, b ) =>\n\t\t\ta.label.localeCompare( b.label )\n\t\t);\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_USER_CATEGORY,\n\t\t\tlabel: __( 'My patterns' ),\n\t\t\tcount: userPatterns.length,\n\t\t} );\n\n\t\tsortedCategories.unshift( {\n\t\t\tname: PATTERN_DEFAULT_CATEGORY,\n\t\t\tlabel: __( 'All patterns' ),\n\t\t\tdescription: __( 'A list of all patterns from all sources.' ),\n\t\t\tcount: themePatterns.length + userPatterns.length,\n\t\t} );\n\n\t\treturn sortedCategories;\n\t}, [\n\t\tdefaultCategories,\n\t\tthemePatterns,\n\t\tuserPatternCategories,\n\t\tuserPatterns,\n\t] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,kCAAkC;AAC1E,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,WAAW,MAAM,+BAA+B;AACvD,SACCC,aAAa,EACbC,wBAAwB,EACxBC,qBAAqB,EACrBC,mCAAmC,QAC7B,uBAAuB;AAE9B,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGR,2BAA2B,CAAC,CAAC;EACvDQ,iBAAi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MACzB5B,IAAI,EAAEL,qBAAqB;MAC3BM,KAAK,EAAEZ,EAAE,CAAE,aAAc,CAAC;MAC1BwB,KAAK,EAAET,YAAY,CAACW;IACrB,CAAE,CAAC;IAEHQ,gBAAgB,CAACK,OAAO,CAAE;MACzB5B,IAAI,EAAEN,wBAAwB;MAC9BO,KAAK,EAAEZ,EAAE,CAAE,cAAe,CAAC;MAC3BwC,WAAW,EAAExC,EAAE,CAAE,0CAA2C,CAAC;MAC7DwB,KAAK,EAAEX,aAAa,CAACa,MAAM,GAAGX,YAAY,CAACW;IAC5C,CAAE,CAAC;IAEH,OAAOQ,gBAAgB;EACxB,CAAC,EAAE,CACFzB,iBAAiB,EACjBI,aAAa,EACbI,qBAAqB,EACrBF,YAAY,CACX,CAAC;EAEH,OAAO;IAAEI,iBAAiB;IAAEsB,WAAW,EAAE,CAAC,CAAEtB,iBAAiB,CAACO;EAAO,CAAC;AACvE","ignoreList":[]}
|
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useEntityRecords } from '@wordpress/core-data';
|
|
4
|
+
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
@@ -11,7 +10,7 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
11
10
|
import { TEMPLATE_PART_AREA_DEFAULT_CATEGORY, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
12
11
|
const useTemplatePartsGroupedByArea = items => {
|
|
13
12
|
const allItems = items || [];
|
|
14
|
-
const templatePartAreas = useSelect(select => select(
|
|
13
|
+
const templatePartAreas = useSelect(select => select(coreStore).getEntityRecord('root', '__unstableBase')?.default_template_part_areas || [], []);
|
|
15
14
|
|
|
16
15
|
// Create map of template areas ensuring that default areas are displayed before
|
|
17
16
|
// any custom registered template part areas.
|
|
@@ -27,7 +26,7 @@ const useTemplatePartsGroupedByArea = items => {
|
|
|
27
26
|
});
|
|
28
27
|
const groupedByArea = allItems.reduce((accumulator, item) => {
|
|
29
28
|
const key = accumulator[item.area] ? item.area : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
|
|
30
|
-
accumulator[key]
|
|
29
|
+
accumulator[key]?.templateParts?.push(item);
|
|
31
30
|
return accumulator;
|
|
32
31
|
}, knownAreas);
|
|
33
32
|
return groupedByArea;
|
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityRecords","
|
|
1
|
+
{"version":3,"names":["useEntityRecords","store","coreStore","useSelect","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","getEntityRecord","default_template_part_areas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","push","useTemplatePartAreas","records","isResolving","isLoading","per_page","hasTemplateParts","length"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_AREA_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ]\n\t\t\t? item.area\n\t\t\t: TEMPLATE_PART_AREA_DEFAULT_CATEGORY;\n\t\taccumulator[ key ]?.templateParts?.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_PART_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC3E,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SACCC,mCAAmC,EACnCC,uBAAuB,QACjB,uBAAuB;AAE9B,MAAMC,6BAA6B,GAAKC,KAAK,IAAM;EAClD,MAAMC,QAAQ,GAAGD,KAAK,IAAI,EAAE;EAE5B,MAAME,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IACPA,MAAM,CAAER,SAAU,CAAC,CAACS,eAAe,CAAE,MAAM,EAAE,gBAAiB,CAAC,EAC5DC,2BAA2B,IAAI,EAAE,EACrC,EACD,CAAC;;EAED;EACA;EACA,MAAMC,UAAU,GAAG;IAClBC,MAAM,EAAE,CAAC,CAAC;IACVC,MAAM,EAAE,CAAC,CAAC;IACVC,OAAO,EAAE,CAAC,CAAC;IACXC,aAAa,EAAE,CAAC;EACjB,CAAC;EAEDR,iBAAiB,CAACS,OAAO,CACtBC,gBAAgB,IACfN,UAAU,CAAEM,gBAAgB,CAACC,IAAI,CAAE,GAAG;IACvC,GAAGD,gBAAgB;IACnBE,aAAa,EAAE;EAChB,CACF,CAAC;EAED,MAAMC,aAAa,GAAGd,QAAQ,CAACe,MAAM,CAAE,CAAEC,WAAW,EAAEC,IAAI,KAAM;IAC/D,MAAMC,GAAG,GAAGF,WAAW,CAAEC,IAAI,CAACL,IAAI,CAAE,GACjCK,IAAI,CAACL,IAAI,GACThB,mCAAmC;IACtCoB,WAAW,CAAEE,GAAG,CAAE,EAAEL,aAAa,EAAEM,IAAI,CAAEF,IAAK,CAAC;IAC/C,OAAOD,WAAW;EACnB,CAAC,EAAEX,UAAW,CAAC;EAEf,OAAOS,aAAa;AACrB,CAAC;AAED,eAAe,SAASM,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,OAAO,EAAER,aAAa;IAAES,WAAW,EAAEC;EAAU,CAAC,GAAG/B,gBAAgB,CAC1E,UAAU,EACVK,uBAAuB,EACvB;IAAE2B,QAAQ,EAAE,CAAC;EAAE,CAChB,CAAC;EAED,OAAO;IACNC,gBAAgB,EAAEZ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACa,MAAM,GAAG,KAAK;IACjEH,SAAS;IACTtB,iBAAiB,EAAEH,6BAA6B,CAAEe,aAAc;EACjE,CAAC;AACF","ignoreList":[]}
|
|
@@ -15,7 +15,6 @@ import { navigationViewRoute } from './navigation-view';
|
|
|
15
15
|
import { navigationEditRoute } from './navigation-edit';
|
|
16
16
|
import { navigationItemEditRoute } from './navigation-item-edit';
|
|
17
17
|
import { navigationItemViewRoute } from './navigation-item-view';
|
|
18
|
-
import { stylesEditRoute } from './styles-edit';
|
|
19
18
|
import { stylesViewRoute } from './styles-view';
|
|
20
19
|
import { patternsEditRoute } from './patterns-edit';
|
|
21
20
|
import { patternsViewRoute } from './patterns-view';
|
|
@@ -27,7 +26,7 @@ import { pagesEditRoute } from './pages-edit';
|
|
|
27
26
|
import { pagesListViewRoute } from './pages-list-view';
|
|
28
27
|
import { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';
|
|
29
28
|
import { pagesViewQuickEditRoute } from './pages-view-quick-edit';
|
|
30
|
-
const routes = [pagesListViewQuickEditRoute, pagesListViewRoute, pagesViewQuickEditRoute, pagesViewRoute, pagesEditRoute, templatesEditRoute, templatesListViewRoute, templatesViewRoute, patternsViewRoute, patternsEditRoute, stylesViewRoute,
|
|
29
|
+
const routes = [pagesListViewQuickEditRoute, pagesListViewRoute, pagesViewQuickEditRoute, pagesViewRoute, pagesEditRoute, templatesEditRoute, templatesListViewRoute, templatesViewRoute, patternsViewRoute, patternsEditRoute, stylesViewRoute, navigationItemViewRoute, navigationItemEditRoute, navigationViewRoute, navigationEditRoute, homeViewRoute, homeEditRoute];
|
|
31
30
|
export function useRegisterSiteEditorRoutes() {
|
|
32
31
|
const registry = useRegistry();
|
|
33
32
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegistry","useDispatch","useEffect","unlock","store","siteEditorStore","homeViewRoute","homeEditRoute","navigationViewRoute","navigationEditRoute","navigationItemEditRoute","navigationItemViewRoute","
|
|
1
|
+
{"version":3,"names":["useRegistry","useDispatch","useEffect","unlock","store","siteEditorStore","homeViewRoute","homeEditRoute","navigationViewRoute","navigationEditRoute","navigationItemEditRoute","navigationItemViewRoute","stylesViewRoute","patternsEditRoute","patternsViewRoute","templatesEditRoute","templatesListViewRoute","templatesViewRoute","pagesViewRoute","pagesEditRoute","pagesListViewRoute","pagesListViewQuickEditRoute","pagesViewQuickEditRoute","routes","useRegisterSiteEditorRoutes","registry","registerRoute","batch","forEach"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeViewRoute } from './home-view';\nimport { homeEditRoute } from './home-edit';\nimport { navigationViewRoute } from './navigation-view';\nimport { navigationEditRoute } from './navigation-edit';\nimport { navigationItemEditRoute } from './navigation-item-edit';\nimport { navigationItemViewRoute } from './navigation-item-view';\nimport { stylesViewRoute } from './styles-view';\nimport { patternsEditRoute } from './patterns-edit';\nimport { patternsViewRoute } from './patterns-view';\nimport { templatesEditRoute } from './templates-edit';\nimport { templatesListViewRoute } from './templates-list-view';\nimport { templatesViewRoute } from './templates-view';\nimport { pagesViewRoute } from './pages-view';\nimport { pagesEditRoute } from './pages-edit';\nimport { pagesListViewRoute } from './pages-list-view';\nimport { pagesListViewQuickEditRoute } from './pages-list-view-quick-edit';\nimport { pagesViewQuickEditRoute } from './pages-view-quick-edit';\n\nconst routes = [\n\tpagesListViewQuickEditRoute,\n\tpagesListViewRoute,\n\tpagesViewQuickEditRoute,\n\tpagesViewRoute,\n\tpagesEditRoute,\n\ttemplatesEditRoute,\n\ttemplatesListViewRoute,\n\ttemplatesViewRoute,\n\tpatternsViewRoute,\n\tpatternsEditRoute,\n\tstylesViewRoute,\n\tnavigationItemViewRoute,\n\tnavigationItemEditRoute,\n\tnavigationViewRoute,\n\tnavigationEditRoute,\n\thomeViewRoute,\n\thomeEditRoute,\n];\n\nexport function useRegisterSiteEditorRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;;AAE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,OAAO,CAAEF,aAAc,CAAC;IAChC,CAAE,CAAC;EACJ,CAAC,EAAE,CAAED,QAAQ,EAAEC,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
|
|
@@ -111,7 +111,18 @@ function getOverviewBlockExamples(colors) {
|
|
|
111
111
|
name: blockName,
|
|
112
112
|
title: blockType.title,
|
|
113
113
|
category: 'overview',
|
|
114
|
-
|
|
114
|
+
/*
|
|
115
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
116
|
+
* so remove the style attribute from the example to ensure the example
|
|
117
|
+
* demonstrates changes to global styles.
|
|
118
|
+
*/
|
|
119
|
+
blocks: getBlockFromExample(blockName, {
|
|
120
|
+
...blockType.example,
|
|
121
|
+
attributes: {
|
|
122
|
+
...blockType.example.attributes,
|
|
123
|
+
style: undefined
|
|
124
|
+
}
|
|
125
|
+
})
|
|
115
126
|
};
|
|
116
127
|
examples.push(blockExample);
|
|
117
128
|
}
|
|
@@ -137,7 +148,18 @@ export function getExamples(colors) {
|
|
|
137
148
|
name: blockType.name,
|
|
138
149
|
title: blockType.title,
|
|
139
150
|
category: blockType.category,
|
|
140
|
-
|
|
151
|
+
/*
|
|
152
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
153
|
+
* so remove the style attribute from the example to ensure the example
|
|
154
|
+
* demonstrates changes to global styles.
|
|
155
|
+
*/
|
|
156
|
+
blocks: getBlockFromExample(blockType.name, {
|
|
157
|
+
...blockType.example,
|
|
158
|
+
attributes: {
|
|
159
|
+
...blockType.example.attributes,
|
|
160
|
+
style: undefined
|
|
161
|
+
}
|
|
162
|
+
})
|
|
141
163
|
}));
|
|
142
164
|
const isHeadingBlockRegistered = !!getBlockType('core/heading');
|
|
143
165
|
if (!isHeadingBlockRegistered) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","getBlockType","getBlockTypes","getBlockFromExample","createBlock","ColorExamples","DuotoneExamples","STYLE_BOOK_COLOR_GROUPS","jsx","_jsx","getColorExamples","colors","examples","forEach","group","palette","type","find","origin","slug","example","name","title","category","content","duotones","push","getOverviewBlockExamples","themePalette","themeColorexample","headingBlock","level","firstParagraphBlock","secondParagraphBlock","textExample","blocks","layout","columnCount","minimumColumnWidth","style","spacing","blockGap","otherBlockExamples","blockName","blockType","blockExample","getExamples","nonHeadingBlockExamples","filter","supports","inserter","map","isHeadingBlockRegistered","headingsExample","colorExamples","overviewBlockExamples"],"sources":["@wordpress/edit-site/src/components/style-book/examples.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { BlockExample, ColorOrigin, MultiOriginPalettes } from './types';\nimport ColorExamples from './color-examples';\nimport DuotoneExamples from './duotone-examples';\nimport { STYLE_BOOK_COLOR_GROUPS } from './constants';\n\n/**\n * Returns examples color examples for each origin\n * e.g. Core (Default), Theme, and User.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of color block examples.\n */\nfunction getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tif ( ! colors ) {\n\t\treturn [];\n\t}\n\n\tconst examples: BlockExample[] = [];\n\n\tSTYLE_BOOK_COLOR_GROUPS.forEach( ( group ) => {\n\t\tconst palette = colors[ group.type ].find(\n\t\t\t( origin: ColorOrigin ) => origin.slug === group.origin\n\t\t);\n\n\t\tif ( palette?.[ group.type ] ) {\n\t\t\tconst example: BlockExample = {\n\t\t\t\tname: group.slug,\n\t\t\t\ttitle: group.title,\n\t\t\t\tcategory: 'colors',\n\t\t\t};\n\t\t\tif ( group.type === 'duotones' ) {\n\t\t\t\texample.content = (\n\t\t\t\t\t<DuotoneExamples duotones={ palette[ group.type ] } />\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t} else {\n\t\t\t\texample.content = (\n\t\t\t\t\t<ColorExamples\n\t\t\t\t\t\tcolors={ palette[ group.type ] }\n\t\t\t\t\t\ttype={ group.type }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns examples for the overview page.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of block examples.\n */\nfunction getOverviewBlockExamples(\n\tcolors: MultiOriginPalettes\n): BlockExample[] {\n\tconst examples: BlockExample[] = [];\n\n\t// Get theme palette from colors.\n\tconst themePalette = colors.colors.find(\n\t\t( origin: ColorOrigin ) => origin.slug === 'theme'\n\t);\n\n\tif ( themePalette ) {\n\t\tconst themeColorexample: BlockExample = {\n\t\t\tname: 'theme-colors',\n\t\t\ttitle: __( 'Colors' ),\n\t\t\tcategory: 'overview',\n\t\t\tcontent: (\n\t\t\t\t<ColorExamples colors={ themePalette.colors } type={ colors } />\n\t\t\t),\n\t\t};\n\n\t\texamples.push( themeColorexample );\n\t}\n\n\tconst headingBlock = createBlock( 'core/heading', {\n\t\tcontent: __(\n\t\t\t`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`\n\t\t),\n\t\tlevel: 1,\n\t} );\n\tconst firstParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`\n\t\t),\n\t} );\n\tconst secondParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`\n\t\t),\n\t} );\n\n\tconst textExample = {\n\t\tname: 'typography',\n\t\ttitle: __( 'Typography' ),\n\t\tcategory: 'overview',\n\t\tblocks: [\n\t\t\theadingBlock,\n\t\t\tcreateBlock(\n\t\t\t\t'core/group',\n\t\t\t\t{\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t\tminimumColumnWidth: '12rem',\n\t\t\t\t\t},\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\tblockGap: '1.5rem',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t[ firstParagraphBlock, secondParagraphBlock ]\n\t\t\t),\n\t\t],\n\t};\n\texamples.push( textExample );\n\n\tconst otherBlockExamples = [\n\t\t'core/image',\n\t\t'core/separator',\n\t\t'core/buttons',\n\t\t'core/pullquote',\n\t\t'core/search',\n\t];\n\n\t// Get examples for other blocks and put them in order of above array.\n\totherBlockExamples.forEach( ( blockName ) => {\n\t\tconst blockType = getBlockType( blockName );\n\t\tif ( blockType && blockType.example ) {\n\t\t\tconst blockExample: BlockExample = {\n\t\t\t\tname: blockName,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\tcategory: 'overview',\n\t\t\t\tblocks: getBlockFromExample( blockName, blockType.example ),\n\t\t\t};\n\t\t\texamples.push( blockExample );\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns a list of examples for registered block types.\n *\n * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User.\n * @return {BlockExample[]} An array of block examples.\n */\nexport function getExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tconst nonHeadingBlockExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports?.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\tconst isHeadingBlockRegistered = !! getBlockType( 'core/heading' );\n\n\tif ( ! isHeadingBlockRegistered ) {\n\t\treturn nonHeadingBlockExamples;\n\t}\n\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => {\n\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t// translators: %d: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\tlevel\n\t\t\t\t),\n\t\t\t\tlevel,\n\t\t\t} );\n\t\t} ),\n\t};\n\tconst colorExamples = getColorExamples( colors );\n\n\tconst overviewBlockExamples = getOverviewBlockExamples( colors );\n\n\treturn [\n\t\theadingsExample,\n\t\t...colorExamples,\n\t\t...nonHeadingBlockExamples,\n\t\t...overviewBlockExamples,\n\t];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,YAAY,EACZC,aAAa,EACbC,mBAAmB,EACnBC,WAAW,QACL,mBAAmB;;AAE1B;AACA;AACA;;AAEA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,uBAAuB,QAAQ,aAAa;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,SAASC,gBAAgBA,CAAEC,MAA2B,EAAmB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ACA,MAAMM,eAAe,GAAG;IACvBhC,IAAI,EAAE,cAAc;IACpBC,KAAK,EAAEvB,EAAE,CAAE,UAAW,CAAC;IACvBwB,QAAQ,EAAE,MAAM;IAChBY,MAAM,EAAE,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAACgB,GAAG,CAAIpB,KAAK,IAAM;MAC9C,OAAO3B,WAAW,CAAE,cAAc,EAAE;QACnCoB,OAAO,EAAExB,OAAO;QACf;QACAD,EAAE,CAAE,YAAa,CAAC,EAClBgC,KACD,CAAC;QACDA;MACD,CAAE,CAAC;IACJ,CAAE;EACH,CAAC;EACD,MAAMuB,aAAa,GAAG5C,gBAAgB,CAAEC,MAAO,CAAC;EAEhD,MAAM4C,qBAAqB,GAAG5B,wBAAwB,CAAEhB,MAAO,CAAC;EAEhE,OAAO,CACN0C,eAAe,EACf,GAAGC,aAAa,EAChB,GAAGP,uBAAuB,EAC1B,GAAGQ,qBAAqB,CACxB;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","sprintf","getBlockType","getBlockTypes","getBlockFromExample","createBlock","ColorExamples","DuotoneExamples","STYLE_BOOK_COLOR_GROUPS","jsx","_jsx","getColorExamples","colors","examples","forEach","group","palette","type","find","origin","slug","example","name","title","category","content","duotones","push","getOverviewBlockExamples","themePalette","themeColorexample","headingBlock","level","firstParagraphBlock","secondParagraphBlock","textExample","blocks","layout","columnCount","minimumColumnWidth","style","spacing","blockGap","otherBlockExamples","blockName","blockType","blockExample","attributes","undefined","getExamples","nonHeadingBlockExamples","filter","supports","inserter","map","isHeadingBlockRegistered","headingsExample","colorExamples","overviewBlockExamples"],"sources":["@wordpress/edit-site/src/components/style-book/examples.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { BlockExample, ColorOrigin, MultiOriginPalettes } from './types';\nimport ColorExamples from './color-examples';\nimport DuotoneExamples from './duotone-examples';\nimport { STYLE_BOOK_COLOR_GROUPS } from './constants';\n\n/**\n * Returns examples color examples for each origin\n * e.g. Core (Default), Theme, and User.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of color block examples.\n */\nfunction getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tif ( ! colors ) {\n\t\treturn [];\n\t}\n\n\tconst examples: BlockExample[] = [];\n\n\tSTYLE_BOOK_COLOR_GROUPS.forEach( ( group ) => {\n\t\tconst palette = colors[ group.type ].find(\n\t\t\t( origin: ColorOrigin ) => origin.slug === group.origin\n\t\t);\n\n\t\tif ( palette?.[ group.type ] ) {\n\t\t\tconst example: BlockExample = {\n\t\t\t\tname: group.slug,\n\t\t\t\ttitle: group.title,\n\t\t\t\tcategory: 'colors',\n\t\t\t};\n\t\t\tif ( group.type === 'duotones' ) {\n\t\t\t\texample.content = (\n\t\t\t\t\t<DuotoneExamples duotones={ palette[ group.type ] } />\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t} else {\n\t\t\t\texample.content = (\n\t\t\t\t\t<ColorExamples\n\t\t\t\t\t\tcolors={ palette[ group.type ] }\n\t\t\t\t\t\ttype={ group.type }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns examples for the overview page.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of block examples.\n */\nfunction getOverviewBlockExamples(\n\tcolors: MultiOriginPalettes\n): BlockExample[] {\n\tconst examples: BlockExample[] = [];\n\n\t// Get theme palette from colors.\n\tconst themePalette = colors.colors.find(\n\t\t( origin: ColorOrigin ) => origin.slug === 'theme'\n\t);\n\n\tif ( themePalette ) {\n\t\tconst themeColorexample: BlockExample = {\n\t\t\tname: 'theme-colors',\n\t\t\ttitle: __( 'Colors' ),\n\t\t\tcategory: 'overview',\n\t\t\tcontent: (\n\t\t\t\t<ColorExamples colors={ themePalette.colors } type={ colors } />\n\t\t\t),\n\t\t};\n\n\t\texamples.push( themeColorexample );\n\t}\n\n\tconst headingBlock = createBlock( 'core/heading', {\n\t\tcontent: __(\n\t\t\t`AaBbCcDdEeFfGgHhiiJjKkLIMmNnOoPpQakRrssTtUuVVWwXxxYyZzOl23356789X{(…)},2!*&:/A@HELFO™`\n\t\t),\n\t\tlevel: 1,\n\t} );\n\tconst firstParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`A paragraph in a website refers to a distinct block of text that is used to present and organize information. It is a fundamental unit of content in web design and is typically composed of a group of related sentences or thoughts focused on a particular topic or idea. Paragraphs play a crucial role in improving the readability and user experience of a website. They break down the text into smaller, manageable chunks, allowing readers to scan the content more easily.`\n\t\t),\n\t} );\n\tconst secondParagraphBlock = createBlock( 'core/paragraph', {\n\t\tcontent: __(\n\t\t\t`Additionally, paragraphs help structure the flow of information and provide logical breaks between different concepts or pieces of information. In terms of formatting, paragraphs in websites are commonly denoted by a vertical gap or indentation between each block of text. This visual separation helps visually distinguish one paragraph from another, creating a clear and organized layout that guides the reader through the content smoothly.`\n\t\t),\n\t} );\n\n\tconst textExample = {\n\t\tname: 'typography',\n\t\ttitle: __( 'Typography' ),\n\t\tcategory: 'overview',\n\t\tblocks: [\n\t\t\theadingBlock,\n\t\t\tcreateBlock(\n\t\t\t\t'core/group',\n\t\t\t\t{\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\ttype: 'grid',\n\t\t\t\t\t\tcolumnCount: 2,\n\t\t\t\t\t\tminimumColumnWidth: '12rem',\n\t\t\t\t\t},\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tspacing: {\n\t\t\t\t\t\t\tblockGap: '1.5rem',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t[ firstParagraphBlock, secondParagraphBlock ]\n\t\t\t),\n\t\t],\n\t};\n\texamples.push( textExample );\n\n\tconst otherBlockExamples = [\n\t\t'core/image',\n\t\t'core/separator',\n\t\t'core/buttons',\n\t\t'core/pullquote',\n\t\t'core/search',\n\t];\n\n\t// Get examples for other blocks and put them in order of above array.\n\totherBlockExamples.forEach( ( blockName ) => {\n\t\tconst blockType = getBlockType( blockName );\n\t\tif ( blockType && blockType.example ) {\n\t\t\tconst blockExample: BlockExample = {\n\t\t\t\tname: blockName,\n\t\t\t\ttitle: blockType.title,\n\t\t\t\tcategory: 'overview',\n\t\t\t\t/*\n\t\t\t\t * CSS generated from style attributes will take precedence over global styles CSS,\n\t\t\t\t * so remove the style attribute from the example to ensure the example\n\t\t\t\t * demonstrates changes to global styles.\n\t\t\t\t */\n\t\t\t\tblocks: getBlockFromExample( blockName, {\n\t\t\t\t\t...blockType.example,\n\t\t\t\t\tattributes: {\n\t\t\t\t\t\t...blockType.example.attributes,\n\t\t\t\t\t\tstyle: undefined,\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t\t};\n\t\t\texamples.push( blockExample );\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns a list of examples for registered block types.\n *\n * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User.\n * @return {BlockExample[]} An array of block examples.\n */\nexport function getExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tconst nonHeadingBlockExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports?.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\t/*\n\t\t\t * CSS generated from style attributes will take precedence over global styles CSS,\n\t\t\t * so remove the style attribute from the example to ensure the example\n\t\t\t * demonstrates changes to global styles.\n\t\t\t */\n\t\t\tblocks: getBlockFromExample( blockType.name, {\n\t\t\t\t...blockType.example,\n\t\t\t\tattributes: {\n\t\t\t\t\t...blockType.example.attributes,\n\t\t\t\t\tstyle: undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} ) );\n\tconst isHeadingBlockRegistered = !! getBlockType( 'core/heading' );\n\n\tif ( ! isHeadingBlockRegistered ) {\n\t\treturn nonHeadingBlockExamples;\n\t}\n\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => {\n\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t// translators: %d: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\tlevel\n\t\t\t\t),\n\t\t\t\tlevel,\n\t\t\t} );\n\t\t} ),\n\t};\n\tconst colorExamples = getColorExamples( colors );\n\n\tconst overviewBlockExamples = getOverviewBlockExamples( colors );\n\n\treturn [\n\t\theadingsExample,\n\t\t...colorExamples,\n\t\t...nonHeadingBlockExamples,\n\t\t...overviewBlockExamples,\n\t];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,YAAY,EACZC,aAAa,EACbC,mBAAmB,EACnBC,WAAW,QACL,mBAAmB;;AAE1B;AACA;AACA;;AAEA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,uBAAuB,QAAQ,aAAa;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,SAASC,gB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AC5C,GAAGuB,SAAS,CAACxB,OAAO;MACpB0B,UAAU,EAAE;QACX,GAAGF,SAAS,CAACxB,OAAO,CAAC0B,UAAU;QAC/BP,KAAK,EAAEQ;MACR;IACD,CAAE;EACH,CAAC,CAAG,CAAC;EACN,MAAMO,wBAAwB,GAAG,CAAC,CAAErD,YAAY,CAAE,cAAe,CAAC;EAElE,IAAK,CAAEqD,wBAAwB,EAAG;IACjC,OAAOL,uBAAuB;EAC/B;;EAEA;EACA;EACA,MAAMM,eAAe,GAAG;IACvBlC,IAAI,EAAE,cAAc;IACpBC,KAAK,EAAEvB,EAAE,CAAE,UAAW,CAAC;IACvBwB,QAAQ,EAAE,MAAM;IAChBY,MAAM,EAAE,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAACkB,GAAG,CAAItB,KAAK,IAAM;MAC9C,OAAO3B,WAAW,CAAE,cAAc,EAAE;QACnCoB,OAAO,EAAExB,OAAO;QACf;QACAD,EAAE,CAAE,YAAa,CAAC,EAClBgC,KACD,CAAC;QACDA;MACD,CAAE,CAAC;IACJ,CAAE;EACH,CAAC;EACD,MAAMyB,aAAa,GAAG9C,gBAAgB,CAAEC,MAAO,CAAC;EAEhD,MAAM8C,qBAAqB,GAAG9B,wBAAwB,CAAEhB,MAAO,CAAC;EAEhE,OAAO,CACN4C,eAAe,EACf,GAAGC,aAAa,EAChB,GAAGP,uBAAuB,EAC1B,GAAGQ,qBAAqB,CACxB;AACF","ignoreList":[]}
|
package/build-module/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegister
|
|
|
6
6
|
import { dispatch } from '@wordpress/data';
|
|
7
7
|
import deprecated from '@wordpress/deprecated';
|
|
8
8
|
import { createRoot, StrictMode } from '@wordpress/element';
|
|
9
|
-
import {
|
|
9
|
+
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
10
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
11
|
import { registerLegacyWidgetBlock, registerWidgetGroupBlock } from '@wordpress/widgets';
|
|
12
12
|
|
|
@@ -80,15 +80,6 @@ export function initializeEditor(id, settings) {
|
|
|
80
80
|
}
|
|
81
81
|
dispatch(editSiteStore).updateSettings(settings);
|
|
82
82
|
|
|
83
|
-
// Keep the defaultTemplateTypes in the core/editor settings too,
|
|
84
|
-
// so that they can be selected with core/editor selectors in any editor.
|
|
85
|
-
// This is needed because edit-site doesn't initialize with EditorProvider,
|
|
86
|
-
// which internally uses updateEditorSettings as well.
|
|
87
|
-
dispatch(editorStore).updateEditorSettings({
|
|
88
|
-
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
89
|
-
defaultTemplatePartAreas: settings.defaultTemplatePartAreas
|
|
90
|
-
});
|
|
91
|
-
|
|
92
83
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
93
84
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
94
85
|
window.addEventListener('drop', e => e.preventDefault(), false);
|