@wordpress/edit-site 5.28.1 → 5.28.2
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/global-styles/font-library-modal/context.js +1 -1
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +14 -1
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +64 -8
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/media/index.js +3 -3
- package/build/components/media/index.js.map +1 -1
- package/build/components/sidebar/index.js +7 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +1 -1
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +8 -8
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +2 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +63 -8
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/media/index.js +3 -3
- package/build-module/components/media/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +7 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +2 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +8 -8
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-style/style-rtl.css +9 -8
- package/build-style/style.css +9 -8
- package/package.json +42 -42
- package/src/components/global-styles/font-library-modal/context.js +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +2 -2
- package/src/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +72 -15
- package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +60 -5
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +7 -5
- package/src/components/global-styles/screen-revisions/style.scss +11 -6
- package/src/components/media/index.js +7 -9
- package/src/components/sidebar/index.js +7 -2
- package/src/components/sidebar-dataviews/default-views.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -1
- package/src/hooks/commands/use-edit-mode-commands.js +14 -14
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -92
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -84
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -103
|
@@ -77,9 +77,9 @@ function usePageContentFocusCommands() {
|
|
|
77
77
|
if ( currentPostType !== 'wp_template' ) {
|
|
78
78
|
commands.push( {
|
|
79
79
|
name: 'core/switch-to-template-focus',
|
|
80
|
-
/* translators: %1$s: template title */
|
|
81
80
|
label: sprintf(
|
|
82
|
-
|
|
81
|
+
/* translators: %s: template title */
|
|
82
|
+
__( 'Edit template: %s' ),
|
|
83
83
|
decodeEntities( template.title )
|
|
84
84
|
),
|
|
85
85
|
icon: layout,
|
|
@@ -154,14 +154,14 @@ function useManipulateDocumentCommands() {
|
|
|
154
154
|
if ( isTemplateRevertable( template ) && ! isEditingPage ) {
|
|
155
155
|
const label =
|
|
156
156
|
template.type === TEMPLATE_POST_TYPE
|
|
157
|
-
?
|
|
158
|
-
|
|
159
|
-
'Reset template: %s',
|
|
157
|
+
? sprintf(
|
|
158
|
+
/* translators: %s: template title */
|
|
159
|
+
__( 'Reset template: %s' ),
|
|
160
160
|
decodeEntities( template.title )
|
|
161
161
|
)
|
|
162
|
-
:
|
|
163
|
-
|
|
164
|
-
'Reset template part: %s',
|
|
162
|
+
: sprintf(
|
|
163
|
+
/* translators: %s: template part title */
|
|
164
|
+
__( 'Reset template part: %s' ),
|
|
165
165
|
decodeEntities( template.title )
|
|
166
166
|
);
|
|
167
167
|
commands.push( {
|
|
@@ -178,14 +178,14 @@ function useManipulateDocumentCommands() {
|
|
|
178
178
|
if ( isTemplateRemovable( template ) && ! isEditingPage ) {
|
|
179
179
|
const label =
|
|
180
180
|
template.type === TEMPLATE_POST_TYPE
|
|
181
|
-
?
|
|
182
|
-
|
|
183
|
-
'Delete template: %s',
|
|
181
|
+
? sprintf(
|
|
182
|
+
/* translators: %s: template title */
|
|
183
|
+
__( 'Delete template: %s' ),
|
|
184
184
|
decodeEntities( template.title )
|
|
185
185
|
)
|
|
186
|
-
:
|
|
187
|
-
|
|
188
|
-
'Delete template part: %s',
|
|
186
|
+
: sprintf(
|
|
187
|
+
/* translators: %s: template part title */
|
|
188
|
+
__( 'Delete template part: %s' ),
|
|
189
189
|
decodeEntities( template.title )
|
|
190
190
|
);
|
|
191
191
|
const path =
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = SidebarNavigationScreenPagesDataViews;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
var _element = require("@wordpress/element");
|
|
12
|
-
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
var _data = require("@wordpress/data");
|
|
16
|
-
var _link = require("../routes/link");
|
|
17
|
-
var _constants = require("../../utils/constants");
|
|
18
|
-
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
19
|
-
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
20
|
-
var _sidebarDataviews = _interopRequireDefault(require("../sidebar-dataviews"));
|
|
21
|
-
/**
|
|
22
|
-
* WordPress dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const PageItem = ({
|
|
30
|
-
postType = 'page',
|
|
31
|
-
postId,
|
|
32
|
-
...props
|
|
33
|
-
}) => {
|
|
34
|
-
const linkInfo = (0, _link.useLink)({
|
|
35
|
-
postType,
|
|
36
|
-
postId
|
|
37
|
-
}, {
|
|
38
|
-
backPath: '/page'
|
|
39
|
-
});
|
|
40
|
-
return (0, _react.createElement)(_sidebarNavigationItem.default, {
|
|
41
|
-
...linkInfo,
|
|
42
|
-
...props
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
function SidebarNavigationScreenPagesDataViews() {
|
|
46
|
-
const {
|
|
47
|
-
records: templateRecords
|
|
48
|
-
} = (0, _coreData.useEntityRecords)('postType', _constants.TEMPLATE_POST_TYPE, {
|
|
49
|
-
per_page: -1
|
|
50
|
-
});
|
|
51
|
-
const {
|
|
52
|
-
frontPage,
|
|
53
|
-
postsPage
|
|
54
|
-
} = (0, _data.useSelect)(select => {
|
|
55
|
-
const {
|
|
56
|
-
getEntityRecord
|
|
57
|
-
} = select(_coreData.store);
|
|
58
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
59
|
-
return {
|
|
60
|
-
frontPage: siteSettings?.page_on_front,
|
|
61
|
-
postsPage: siteSettings?.page_for_posts
|
|
62
|
-
};
|
|
63
|
-
}, []);
|
|
64
|
-
const templates = (0, _element.useMemo)(() => {
|
|
65
|
-
if (!templateRecords) {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
const isHomePageBlog = frontPage === postsPage;
|
|
69
|
-
const homeTemplate = templateRecords?.find(template => template.slug === 'front-page') || templateRecords?.find(template => template.slug === 'home') || templateRecords?.find(template => template.slug === 'index');
|
|
70
|
-
return [isHomePageBlog ? homeTemplate : null, ...templateRecords?.filter(({
|
|
71
|
-
slug
|
|
72
|
-
}) => ['404', 'search'].includes(slug))].filter(Boolean);
|
|
73
|
-
}, [templateRecords, frontPage, postsPage]);
|
|
74
|
-
return (0, _react.createElement)(_sidebarNavigationScreen.default, {
|
|
75
|
-
title: (0, _i18n.__)('Pages'),
|
|
76
|
-
description: (0, _i18n.__)('Browse and manage pages.'),
|
|
77
|
-
content: (0, _react.createElement)(_sidebarDataviews.default, null),
|
|
78
|
-
backPath: "/page",
|
|
79
|
-
footer: (0, _react.createElement)(_components.__experimentalVStack, {
|
|
80
|
-
spacing: 0
|
|
81
|
-
}, templates?.map(item => (0, _react.createElement)(PageItem, {
|
|
82
|
-
postType: _constants.TEMPLATE_POST_TYPE,
|
|
83
|
-
postId: item.id,
|
|
84
|
-
key: item.id,
|
|
85
|
-
icon: _icons.layout,
|
|
86
|
-
withChevron: true
|
|
87
|
-
}, (0, _react.createElement)(_components.__experimentalTruncate, {
|
|
88
|
-
numberOfLines: 1
|
|
89
|
-
}, (0, _htmlEntities.decodeEntities)(item.title?.rendered || (0, _i18n.__)('(no title)'))))))
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_icons","_element","_coreData","_htmlEntities","_i18n","_data","_link","_constants","_sidebarNavigationItem","_interopRequireDefault","_sidebarNavigationScreen","_sidebarDataviews","PageItem","postType","postId","props","linkInfo","useLink","backPath","_react","createElement","default","SidebarNavigationScreenPagesDataViews","records","templateRecords","useEntityRecords","TEMPLATE_POST_TYPE","per_page","frontPage","postsPage","useSelect","select","getEntityRecord","coreStore","siteSettings","page_on_front","page_for_posts","templates","useMemo","isHomePageBlog","homeTemplate","find","template","slug","filter","includes","Boolean","title","__","description","content","footer","__experimentalVStack","spacing","map","item","id","key","icon","layout","withChevron","__experimentalTruncate","numberOfLines","decodeEntities","rendered"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t},\n\t\t{\n\t\t\tbackPath: '/page',\n\t\t}\n\t);\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPagesDataViews() {\n\tconst { records: templateRecords } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst templates = useMemo( () => {\n\t\tif ( ! templateRecords ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst isHomePageBlog = frontPage === postsPage;\n\t\tconst homeTemplate =\n\t\t\ttemplateRecords?.find(\n\t\t\t\t( template ) => template.slug === 'front-page'\n\t\t\t) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'home' ) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'index' );\n\n\t\treturn [\n\t\t\tisHomePageBlog ? homeTemplate : null,\n\t\t\t...templateRecords?.filter( ( { slug } ) =>\n\t\t\t\t[ '404', 'search' ].includes( slug )\n\t\t\t),\n\t\t].filter( Boolean );\n\t}, [ templateRecords, frontPage, postsPage ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Pages' ) }\n\t\t\tdescription={ __( 'Browse and manage pages.' ) }\n\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\tbackPath=\"/page\"\n\t\t\tfooter={\n\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t{ templates?.map( ( item ) => (\n\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t{ decodeEntities(\n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AAA/B,MAAA,CAAAC,aAAA,EAACT,iBAAA,CAAAU,OAAuB,MAAE,CAAG;IACvCH,QAAQ,EAAC,OAAO;IAChBiC,MAAM,EACL,IAAAhC,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAAsD,oBAAM;MAACC,OAAO,EAAG;IAAG,GAClBhB,SAAS,EAAEiB,GAAG,CAAIC,IAAI,IACvB,IAAApC,MAAA,CAAAC,aAAA,EAACR,QAAQ;MACRC,QAAQ,EAAGa,6BAAoB;MAC/BZ,MAAM,EAAGyC,IAAI,CAACC,EAAI;MAClBC,GAAG,EAAGF,IAAI,CAACC,EAAI;MACfE,IAAI,EAAGC,aAAQ;MACfC,WAAW;IAAA,GAEX,IAAAzC,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAA+D,sBAAQ;MAACC,aAAa,EAAG;IAAG,GAC1B,IAAAC,4BAAc,EACfR,IAAI,CAACR,KAAK,EAAEiB,QAAQ,IAAI,IAAAhB,QAAE,EAAE,YAAa,CAC1C,CACS,CACD,CACT,CACK;EACR,CACD,CAAC;AAEJ"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __experimentalTruncate as Truncate, __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
-
import { layout } from '@wordpress/icons';
|
|
7
|
-
import { useMemo } from '@wordpress/element';
|
|
8
|
-
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { useSelect } from '@wordpress/data';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { useLink } from '../routes/link';
|
|
17
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
18
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
-
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
20
|
-
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
21
|
-
const PageItem = ({
|
|
22
|
-
postType = 'page',
|
|
23
|
-
postId,
|
|
24
|
-
...props
|
|
25
|
-
}) => {
|
|
26
|
-
const linkInfo = useLink({
|
|
27
|
-
postType,
|
|
28
|
-
postId
|
|
29
|
-
}, {
|
|
30
|
-
backPath: '/page'
|
|
31
|
-
});
|
|
32
|
-
return createElement(SidebarNavigationItem, {
|
|
33
|
-
...linkInfo,
|
|
34
|
-
...props
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
export default function SidebarNavigationScreenPagesDataViews() {
|
|
38
|
-
const {
|
|
39
|
-
records: templateRecords
|
|
40
|
-
} = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
|
|
41
|
-
per_page: -1
|
|
42
|
-
});
|
|
43
|
-
const {
|
|
44
|
-
frontPage,
|
|
45
|
-
postsPage
|
|
46
|
-
} = useSelect(select => {
|
|
47
|
-
const {
|
|
48
|
-
getEntityRecord
|
|
49
|
-
} = select(coreStore);
|
|
50
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
51
|
-
return {
|
|
52
|
-
frontPage: siteSettings?.page_on_front,
|
|
53
|
-
postsPage: siteSettings?.page_for_posts
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
56
|
-
const templates = useMemo(() => {
|
|
57
|
-
if (!templateRecords) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
const isHomePageBlog = frontPage === postsPage;
|
|
61
|
-
const homeTemplate = templateRecords?.find(template => template.slug === 'front-page') || templateRecords?.find(template => template.slug === 'home') || templateRecords?.find(template => template.slug === 'index');
|
|
62
|
-
return [isHomePageBlog ? homeTemplate : null, ...templateRecords?.filter(({
|
|
63
|
-
slug
|
|
64
|
-
}) => ['404', 'search'].includes(slug))].filter(Boolean);
|
|
65
|
-
}, [templateRecords, frontPage, postsPage]);
|
|
66
|
-
return createElement(SidebarNavigationScreen, {
|
|
67
|
-
title: __('Pages'),
|
|
68
|
-
description: __('Browse and manage pages.'),
|
|
69
|
-
content: createElement(DataViewsSidebarContent, null),
|
|
70
|
-
backPath: "/page",
|
|
71
|
-
footer: createElement(VStack, {
|
|
72
|
-
spacing: 0
|
|
73
|
-
}, templates?.map(item => createElement(PageItem, {
|
|
74
|
-
postType: TEMPLATE_POST_TYPE,
|
|
75
|
-
postId: item.id,
|
|
76
|
-
key: item.id,
|
|
77
|
-
icon: layout,
|
|
78
|
-
withChevron: true
|
|
79
|
-
}, createElement(Truncate, {
|
|
80
|
-
numberOfLines: 1
|
|
81
|
-
}, decodeEntities(item.title?.rendered || __('(no title)'))))))
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalTruncate","Truncate","__experimentalVStack","VStack","layout","useMemo","useEntityRecords","store","coreStore","decodeEntities","__","useSelect","useLink","TEMPLATE_POST_TYPE","SidebarNavigationItem","SidebarNavigationScreen","DataViewsSidebarContent","PageItem","postType","postId","props","linkInfo","backPath","createElement","SidebarNavigationScreenPagesDataViews","records","templateRecords","per_page","frontPage","postsPage","select","getEntityRecord","siteSettings","page_on_front","page_for_posts","templates","isHomePageBlog","homeTemplate","find","template","slug","filter","includes","Boolean","title","description","content","footer","spacing","map","item","id","key","icon","withChevron","numberOfLines","rendered"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t},\n\t\t{\n\t\t\tbackPath: '/page',\n\t\t}\n\t);\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPagesDataViews() {\n\tconst { records: templateRecords } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst templates = useMemo( () => {\n\t\tif ( ! templateRecords ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst isHomePageBlog = frontPage === postsPage;\n\t\tconst homeTemplate =\n\t\t\ttemplateRecords?.find(\n\t\t\t\t( template ) => template.slug === 'front-page'\n\t\t\t) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'home' ) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'index' );\n\n\t\treturn [\n\t\t\tisHomePageBlog ? homeTemplate : null,\n\t\t\t...templateRecords?.filter( ( { slug } ) =>\n\t\t\t\t[ '404', 'search' ].includes( slug )\n\t\t\t),\n\t\t].filter( Boolean );\n\t}, [ templateRecords, frontPage, postsPage ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Pages' ) }\n\t\t\tdescription={ __( 'Browse and manage pages.' ) }\n\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\tbackPath=\"/page\"\n\t\t\tfooter={\n\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t{ templates?.map( ( item ) => (\n\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\titem.title?.rendered || __( '(no title)' )\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t) ) }\n\t\t\t\t</VStack>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,sBAAsB,IAAIC,QAAQ,EAClCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,gBAAgB,EAAEC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAC3E,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,uBAAuB,MAAM,sBAAsB;AAE1D,MAAMC,QAAQ,GAAGA,CAAE;EAAEC,QAAQ,GAAG,MAAM;EA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,IAAI,EACpC,GAAGX,eAAe,EAAEe,MAAM,CAAE,CAAE;MAAED;IAAK,CAAC,KACrC,CAAE,KAAK,EAAE,QAAQ,CAAE,CAACE,QAAQ,CAAEF,IAAK,CACpC,CAAC,CACD,CAACC,MAAM,CAAEE,OAAQ,CAAC;EACpB,CAAC,EAAE,CAAEjB,eAAe,EAAEE,SAAS,EAAEC,SAAS,CAAG,CAAC;EAE9C,OACCN,aAAA,CAACR,uBAAuB;IACvB6B,KAAK,EAAGlC,EAAE,CAAE,OAAQ,CAAG;IACvBmC,WAAW,EAAGnC,EAAE,CAAE,0BAA2B,CAAG;IAChDoC,OAAO,EAAGvB,aAAA,CAACP,uBAAuB,MAAE,CAAG;IACvCM,QAAQ,EAAC,OAAO;IAChByB,MAAM,EACLxB,aAAA,CAACpB,MAAM;MAAC6C,OAAO,EAAG;IAAG,GAClBb,SAAS,EAAEc,GAAG,CAAIC,IAAI,IACvB3B,aAAA,CAACN,QAAQ;MACRC,QAAQ,EAAGL,kBAAoB;MAC/BM,MAAM,EAAG+B,IAAI,CAACC,EAAI;MAClBC,GAAG,EAAGF,IAAI,CAACC,EAAI;MACfE,IAAI,EAAGjD,MAAQ;MACfkD,WAAW;IAAA,GAEX/B,aAAA,CAACtB,QAAQ;MAACsD,aAAa,EAAG;IAAG,GAC1B9C,cAAc,CACfyC,IAAI,CAACN,KAAK,EAAEY,QAAQ,IAAI9C,EAAE,CAAE,YAAa,CAC1C,CACS,CACD,CACT,CACK;EACR,CACD,CAAC;AAEJ"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalTruncate as Truncate,
|
|
6
|
-
__experimentalVStack as VStack,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { layout } from '@wordpress/icons';
|
|
9
|
-
import { useMemo } from '@wordpress/element';
|
|
10
|
-
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { useLink } from '../routes/link';
|
|
19
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
20
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
21
|
-
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
22
|
-
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
23
|
-
|
|
24
|
-
const PageItem = ( { postType = 'page', postId, ...props } ) => {
|
|
25
|
-
const linkInfo = useLink(
|
|
26
|
-
{
|
|
27
|
-
postType,
|
|
28
|
-
postId,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
backPath: '/page',
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
return <SidebarNavigationItem { ...linkInfo } { ...props } />;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default function SidebarNavigationScreenPagesDataViews() {
|
|
38
|
-
const { records: templateRecords } = useEntityRecords(
|
|
39
|
-
'postType',
|
|
40
|
-
TEMPLATE_POST_TYPE,
|
|
41
|
-
{
|
|
42
|
-
per_page: -1,
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const { frontPage, postsPage } = useSelect( ( select ) => {
|
|
47
|
-
const { getEntityRecord } = select( coreStore );
|
|
48
|
-
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
49
|
-
return {
|
|
50
|
-
frontPage: siteSettings?.page_on_front,
|
|
51
|
-
postsPage: siteSettings?.page_for_posts,
|
|
52
|
-
};
|
|
53
|
-
}, [] );
|
|
54
|
-
|
|
55
|
-
const templates = useMemo( () => {
|
|
56
|
-
if ( ! templateRecords ) {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const isHomePageBlog = frontPage === postsPage;
|
|
61
|
-
const homeTemplate =
|
|
62
|
-
templateRecords?.find(
|
|
63
|
-
( template ) => template.slug === 'front-page'
|
|
64
|
-
) ||
|
|
65
|
-
templateRecords?.find( ( template ) => template.slug === 'home' ) ||
|
|
66
|
-
templateRecords?.find( ( template ) => template.slug === 'index' );
|
|
67
|
-
|
|
68
|
-
return [
|
|
69
|
-
isHomePageBlog ? homeTemplate : null,
|
|
70
|
-
...templateRecords?.filter( ( { slug } ) =>
|
|
71
|
-
[ '404', 'search' ].includes( slug )
|
|
72
|
-
),
|
|
73
|
-
].filter( Boolean );
|
|
74
|
-
}, [ templateRecords, frontPage, postsPage ] );
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<SidebarNavigationScreen
|
|
78
|
-
title={ __( 'Pages' ) }
|
|
79
|
-
description={ __( 'Browse and manage pages.' ) }
|
|
80
|
-
content={ <DataViewsSidebarContent /> }
|
|
81
|
-
backPath="/page"
|
|
82
|
-
footer={
|
|
83
|
-
<VStack spacing={ 0 }>
|
|
84
|
-
{ templates?.map( ( item ) => (
|
|
85
|
-
<PageItem
|
|
86
|
-
postType={ TEMPLATE_POST_TYPE }
|
|
87
|
-
postId={ item.id }
|
|
88
|
-
key={ item.id }
|
|
89
|
-
icon={ layout }
|
|
90
|
-
withChevron
|
|
91
|
-
>
|
|
92
|
-
<Truncate numberOfLines={ 1 }>
|
|
93
|
-
{ decodeEntities(
|
|
94
|
-
item.title?.rendered || __( '(no title)' )
|
|
95
|
-
) }
|
|
96
|
-
</Truncate>
|
|
97
|
-
</PageItem>
|
|
98
|
-
) ) }
|
|
99
|
-
</VStack>
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
}
|