@wordpress/edit-site 3.0.12 → 3.0.16
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/new-template-part.js +29 -18
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +30 -23
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +51 -0
- package/build/components/app/index.js.map +1 -0
- package/build/components/block-editor/back-button.js +8 -20
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/index.js +2 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +0 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +20 -8
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +11 -30
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +16 -1
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +2 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +2 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +2 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/document-actions/index.js +3 -6
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/list/actions/index.js +1 -1
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/index.js +17 -15
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +31 -27
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -13
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +26 -24
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/routes/index.js +60 -0
- package/build/components/routes/index.js.map +1 -0
- package/build/components/routes/link.js +65 -0
- package/build/components/routes/link.js.map +1 -0
- package/build/components/routes/use-title.js +57 -0
- package/build/components/routes/use-title.js.map +1 -0
- package/build/components/sidebar/global-styles-sidebar.js +10 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +7 -4
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/edit-template-title.js +33 -0
- package/build/components/template-details/edit-template-title.js.map +1 -0
- package/build/components/template-details/index.js +18 -12
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +28 -11
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/url-query-controller/index.js +41 -50
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -0
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +1 -28
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +18 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +29 -35
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +3 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/site-export.js +61 -0
- package/build/plugins/site-export.js.map +1 -0
- package/build/plugins/welcome-guide-menu-item.js +1 -7
- package/build/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build/store/actions.js +0 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -14
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +7 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -31
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +23 -0
- package/build/utils/get-is-list-page.js.map +1 -0
- package/build/utils/history.js +35 -0
- package/build/utils/history.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +27 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +28 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +35 -0
- package/build-module/components/app/index.js.map +1 -0
- package/build-module/components/block-editor/back-button.js +8 -19
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +0 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +17 -9
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -33
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +16 -2
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +2 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +2 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +2 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +3 -6
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +1 -1
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/index.js +15 -15
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +31 -27
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +13 -13
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +24 -24
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/routes/index.js +47 -0
- package/build-module/components/routes/index.js.map +1 -0
- package/build-module/components/routes/link.js +51 -0
- package/build-module/components/routes/link.js.map +1 -0
- package/build-module/components/routes/use-title.js +44 -0
- package/build-module/components/routes/use-title.js.map +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js +8 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +8 -4
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/edit-template-title.js +23 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -0
- package/build-module/components/template-details/index.js +15 -11
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +25 -10
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +40 -49
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +7 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -26
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +18 -2
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +28 -33
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -18
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/site-export.js +45 -0
- package/build-module/plugins/site-export.js.map +1 -0
- package/build-module/plugins/welcome-guide-menu-item.js +2 -7
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -11
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +7 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -27
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +16 -0
- package/build-module/utils/get-is-list-page.js.map +1 -0
- package/build-module/utils/history.js +25 -0
- package/build-module/utils/history.js.map +1 -0
- package/build-style/style-rtl.css +11 -10
- package/build-style/style.css +11 -10
- package/package.json +9 -8
- package/src/components/add-new-template/new-template-part.js +29 -11
- package/src/components/add-new-template/new-template.js +26 -12
- package/src/components/app/index.js +47 -0
- package/src/components/block-editor/back-button.js +6 -14
- package/src/components/block-editor/index.js +1 -0
- package/src/components/create-template-part-modal/index.js +0 -2
- package/src/components/edit-template-part-menu-button/index.js +16 -5
- package/src/components/editor/index.js +105 -131
- package/src/components/global-styles/gradients-palette-panel.js +20 -0
- package/src/components/global-styles/screen-background-color.js +1 -0
- package/src/components/global-styles/screen-link-color.js +1 -0
- package/src/components/global-styles/screen-text-color.js +1 -0
- package/src/components/global-styles/style.scss +12 -6
- package/src/components/global-styles/use-global-styles-output.js +0 -1
- package/src/components/header/document-actions/index.js +3 -9
- package/src/components/list/actions/index.js +1 -1
- package/src/components/list/index.js +11 -12
- package/src/components/list/style.scss +6 -11
- package/src/components/list/table.js +7 -6
- package/src/components/navigation-sidebar/index.js +18 -17
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -22
- package/src/components/routes/index.js +53 -0
- package/src/components/routes/link.js +44 -0
- package/src/components/routes/use-title.js +56 -0
- package/src/components/sidebar/global-styles-sidebar.js +8 -0
- package/src/components/sidebar/template-card/template-areas.js +16 -4
- package/src/components/template-details/edit-template-title.js +28 -0
- package/src/components/template-details/index.js +21 -14
- package/src/components/template-details/template-areas.js +32 -9
- package/src/components/template-part-converter/convert-to-template-part.js +4 -2
- package/src/components/url-query-controller/index.js +34 -45
- package/src/components/welcome-guide/editor.js +10 -1
- package/src/components/welcome-guide/index.js +6 -25
- package/src/components/welcome-guide/styles.js +20 -2
- package/src/index.js +33 -36
- package/src/plugins/index.js +2 -32
- package/src/plugins/site-export.js +48 -0
- package/src/plugins/welcome-guide-menu-item.js +2 -16
- package/src/store/actions.js +0 -23
- package/src/store/constants.js +0 -12
- package/src/store/reducer.js +12 -26
- package/src/store/selectors.js +1 -27
- package/src/store/test/reducer.js +22 -39
- package/src/store/test/selectors.js +3 -34
- package/src/utils/get-is-list-page.js +11 -0
- package/src/utils/history.js +35 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -11,24 +12,33 @@ import classnames from 'classnames';
|
|
|
11
12
|
import { __experimentalNavigation as Navigation, __experimentalNavigationBackButton as NavigationBackButton, __experimentalNavigationGroup as NavigationGroup, __experimentalNavigationItem as NavigationItem, __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
|
|
12
13
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
13
14
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
16
16
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
17
17
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
18
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
19
18
|
import { home as siteIcon, layout as templateIcon, symbolFilled as templatePartIcon } from '@wordpress/icons';
|
|
20
19
|
/**
|
|
21
20
|
* Internal dependencies
|
|
22
21
|
*/
|
|
23
22
|
|
|
23
|
+
import { useLink } from '../../routes/link';
|
|
24
24
|
import MainDashboardButton from '../../main-dashboard-button';
|
|
25
25
|
import { store as editSiteStore } from '../../../store';
|
|
26
26
|
const SITE_EDITOR_KEY = 'site-editor';
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
function NavLink(_ref) {
|
|
29
29
|
let {
|
|
30
|
-
|
|
30
|
+
params,
|
|
31
|
+
replace,
|
|
32
|
+
...props
|
|
31
33
|
} = _ref;
|
|
34
|
+
const linkProps = useLink(params, replace);
|
|
35
|
+
return createElement(NavigationItem, _extends({}, linkProps, props));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const NavigationPanel = _ref2 => {
|
|
39
|
+
let {
|
|
40
|
+
activeItem = SITE_EDITOR_KEY
|
|
41
|
+
} = _ref2;
|
|
32
42
|
const {
|
|
33
43
|
isNavigationOpen,
|
|
34
44
|
siteTitle
|
|
@@ -44,15 +54,7 @@ const NavigationPanel = _ref => {
|
|
|
44
54
|
}, []);
|
|
45
55
|
const {
|
|
46
56
|
setIsNavigationPanelOpened
|
|
47
|
-
} = useDispatch(editSiteStore);
|
|
48
|
-
// from a separate component (such as document actions in the header).
|
|
49
|
-
|
|
50
|
-
const panelRef = useRef();
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (isNavigationOpen) {
|
|
53
|
-
panelRef.current.focus();
|
|
54
|
-
}
|
|
55
|
-
}, [activeItem, isNavigationOpen]);
|
|
57
|
+
} = useDispatch(editSiteStore);
|
|
56
58
|
|
|
57
59
|
const closeOnEscape = event => {
|
|
58
60
|
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
@@ -66,8 +68,6 @@ const NavigationPanel = _ref => {
|
|
|
66
68
|
className: classnames(`edit-site-navigation-panel`, {
|
|
67
69
|
'is-open': isNavigationOpen
|
|
68
70
|
}),
|
|
69
|
-
ref: panelRef,
|
|
70
|
-
tabIndex: "-1",
|
|
71
71
|
onKeyDown: closeOnEscape
|
|
72
72
|
}, createElement("div", {
|
|
73
73
|
className: "edit-site-navigation-panel__inner"
|
|
@@ -85,30 +85,30 @@ const NavigationPanel = _ref => {
|
|
|
85
85
|
href: "index.php"
|
|
86
86
|
})), createElement(NavigationMenu, null, createElement(NavigationGroup, {
|
|
87
87
|
title: __('Editor')
|
|
88
|
-
}, createElement(
|
|
88
|
+
}, createElement(NavLink, {
|
|
89
89
|
icon: siteIcon,
|
|
90
90
|
title: __('Site'),
|
|
91
91
|
item: SITE_EDITOR_KEY,
|
|
92
|
-
|
|
92
|
+
params: {
|
|
93
93
|
postId: undefined,
|
|
94
94
|
postType: undefined
|
|
95
|
-
}
|
|
96
|
-
}), createElement(
|
|
95
|
+
}
|
|
96
|
+
}), createElement(NavLink, {
|
|
97
97
|
icon: templateIcon,
|
|
98
98
|
title: __('Templates'),
|
|
99
99
|
item: "wp_template",
|
|
100
|
-
|
|
100
|
+
params: {
|
|
101
101
|
postId: undefined,
|
|
102
102
|
postType: 'wp_template'
|
|
103
|
-
}
|
|
104
|
-
}), createElement(
|
|
103
|
+
}
|
|
104
|
+
}), createElement(NavLink, {
|
|
105
105
|
icon: templatePartIcon,
|
|
106
106
|
title: __('Template Parts'),
|
|
107
107
|
item: "wp_template_part",
|
|
108
|
-
|
|
108
|
+
params: {
|
|
109
109
|
postId: undefined,
|
|
110
110
|
postType: 'wp_template_part'
|
|
111
|
-
}
|
|
111
|
+
}
|
|
112
112
|
})))))))
|
|
113
113
|
);
|
|
114
114
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["classnames","__experimentalNavigation","Navigation","__experimentalNavigationBackButton","NavigationBackButton","__experimentalNavigationGroup","NavigationGroup","__experimentalNavigationItem","NavigationItem","__experimentalNavigationMenu","NavigationMenu","store","coreDataStore","useSelect","useDispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["classnames","__experimentalNavigation","Navigation","__experimentalNavigationBackButton","NavigationBackButton","__experimentalNavigationGroup","NavigationGroup","__experimentalNavigationItem","NavigationItem","__experimentalNavigationMenu","NavigationMenu","store","coreDataStore","useSelect","useDispatch","__","ESCAPE","decodeEntities","home","siteIcon","layout","templateIcon","symbolFilled","templatePartIcon","useLink","MainDashboardButton","editSiteStore","SITE_EDITOR_KEY","NavLink","params","replace","props","linkProps","NavigationPanel","activeItem","isNavigationOpen","siteTitle","select","getEntityRecord","siteData","undefined","name","isNavigationOpened","setIsNavigationPanelOpened","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","postId","postType"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,4BAA4B,IAAIC,cAJjC,EAKCC,4BAA4B,IAAIC,cALjC,QAMO,uBANP;AAOA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SACCC,IAAI,IAAIC,QADT,EAECC,MAAM,IAAIC,YAFX,EAGCC,YAAY,IAAIC,gBAHjB,QAIO,kBAJP;AAMA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,mBAAxB;AACA,OAAOC,mBAAP,MAAgC,6BAAhC;AACA,SAASd,KAAK,IAAIe,aAAlB,QAAuC,gBAAvC;AAEA,MAAMC,eAAe,GAAG,aAAxB;;AAEA,SAASC,OAAT,OAAkD;AAAA,MAAhC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmB,OAAGC;AAAtB,GAAgC;AACjD,QAAMC,SAAS,GAAGR,OAAO,CAAEK,MAAF,EAAUC,OAAV,CAAzB;AAEA,SAAO,cAAC,cAAD,eAAqBE,SAArB,EAAsCD,KAAtC,EAAP;AACA;;AAED,MAAME,eAAe,GAAG,SAAwC;AAAA,MAAtC;AAAEC,IAAAA,UAAU,GAAGP;AAAf,GAAsC;AAC/D,QAAM;AAAEQ,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAkCvB,SAAS,CAAIwB,MAAF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EAAGA,EAAE,CAAE,QAAF;AAA3B,OACC,cAAC,OAAD;AACC,MAAA,IAAI,EAAGI,QADR;AAEC,MAAA,KAAK,EAAGJ,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGY,eAHR;AAIC,MAAA,MAAM,EAAG;AACRsB,QAAAA,MAAM,EAAET,SADA;AAERU,QAAAA,QAAQ,EAAEV;AAFF;AAJV,MADD,EAUC,cAAC,OAAD;AACC,MAAA,IAAI,EAAGnB,YADR;AAEC,MAAA,KAAK,EAAGN,EAAE,CAAE,WAAF,CAFX;AAGC,MAAA,IAAI,EAAC,aAHN;AAIC,MAAA,MAAM,EAAG;AACRkC,QAAAA,MAAM,EAAET,SADA;AAERU,QAAAA,QAAQ,EAAE;AAFF;AAJV,MAVD,EAmBC,cAAC,OAAD;AACC,MAAA,IAAI,EAAG3B,gBADR;AAEC,MAAA,KAAK,EAAGR,EAAE,CAAE,gBAAF,CAFX;AAGC,MAAA,IAAI,EAAC,kBAHN;AAIC,MAAA,MAAM,EAAG;AACRkC,QAAAA,MAAM,EAAET,SADA;AAERU,QAAAA,QAAQ,EAAE;AAFF;AAJV,MAnBD,CADD,CATD,CADD,CAND,CAND;AAFD;AA4DA,CAjFD;;AAmFA,eAAejB,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigation as Navigation,\n\t__experimentalNavigationBackButton as NavigationBackButton,\n\t__experimentalNavigationGroup as NavigationGroup,\n\t__experimentalNavigationItem as NavigationItem,\n\t__experimentalNavigationMenu as NavigationMenu,\n} from '@wordpress/components';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\thome as siteIcon,\n\tlayout as templateIcon,\n\tsymbolFilled as templatePartIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../../routes/link';\nimport MainDashboardButton from '../../main-dashboard-button';\nimport { store as editSiteStore } from '../../../store';\n\nconst SITE_EDITOR_KEY = 'site-editor';\n\nfunction NavLink( { params, replace, ...props } ) {\n\tconst linkProps = useLink( params, replace );\n\n\treturn <NavigationItem { ...linkProps } { ...props } />;\n}\n\nconst NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {\n\tconst { isNavigationOpen, siteTitle } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tsiteTitle: siteData.name,\n\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst closeOnEscape = ( event ) => {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName={ classnames( `edit-site-navigation-panel`, {\n\t\t\t\t'is-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-site-navigation-panel__inner\">\n\t\t\t\t<div className=\"edit-site-navigation-panel__site-title-container\">\n\t\t\t\t\t<div className=\"edit-site-navigation-panel__site-title\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-navigation-panel__scroll-container\">\n\t\t\t\t\t<Navigation activeItem={ activeItem }>\n\t\t\t\t\t\t<MainDashboardButton.Slot>\n\t\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\t\tbackButtonLabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-navigation-panel__back-to-dashboard\"\n\t\t\t\t\t\t\t\thref=\"index.php\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MainDashboardButton.Slot>\n\n\t\t\t\t\t\t<NavigationMenu>\n\t\t\t\t\t\t\t<NavigationGroup title={ __( 'Editor' ) }>\n\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ siteIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Site' ) }\n\t\t\t\t\t\t\t\t\titem={ SITE_EDITOR_KEY }\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: undefined,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ templateIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Templates' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template\"\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NavLink\n\t\t\t\t\t\t\t\t\ticon={ templatePartIcon }\n\t\t\t\t\t\t\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\t\t\t\t\t\t\titem=\"wp_template_part\"\n\t\t\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</NavigationGroup>\n\t\t\t\t\t\t</NavigationMenu>\n\t\t\t\t\t</Navigation>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default NavigationPanel;\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { createContext, useState, useEffect, useContext } from '@wordpress/element';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import history from '../../utils/history';
|
|
12
|
+
const RoutesContext = createContext();
|
|
13
|
+
const HistoryContext = createContext();
|
|
14
|
+
export function useLocation() {
|
|
15
|
+
return useContext(RoutesContext);
|
|
16
|
+
}
|
|
17
|
+
export function useHistory() {
|
|
18
|
+
return useContext(HistoryContext);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getLocationWithParams(location) {
|
|
22
|
+
const searchParams = new URLSearchParams(location.search);
|
|
23
|
+
return { ...location,
|
|
24
|
+
params: Object.fromEntries(searchParams.entries())
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function Routes(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
children
|
|
31
|
+
} = _ref;
|
|
32
|
+
const [location, setLocation] = useState(() => getLocationWithParams(history.location));
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
return history.listen(_ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
location: updatedLocation
|
|
37
|
+
} = _ref2;
|
|
38
|
+
setLocation(getLocationWithParams(updatedLocation));
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
return createElement(HistoryContext.Provider, {
|
|
42
|
+
value: history
|
|
43
|
+
}, createElement(RoutesContext.Provider, {
|
|
44
|
+
value: location
|
|
45
|
+
}, children(location)));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/index.js"],"names":["createContext","useState","useEffect","useContext","history","RoutesContext","HistoryContext","useLocation","useHistory","getLocationWithParams","location","searchParams","URLSearchParams","search","params","Object","fromEntries","entries","Routes","children","setLocation","listen","updatedLocation"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,QAFD,EAGCC,SAHD,EAICC,UAJD,QAKO,oBALP;AAOA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,qBAApB;AAEA,MAAMC,aAAa,GAAGL,aAAa,EAAnC;AACA,MAAMM,cAAc,GAAGN,aAAa,EAApC;AAEA,OAAO,SAASO,WAAT,GAAuB;AAC7B,SAAOJ,UAAU,CAAEE,aAAF,CAAjB;AACA;AAED,OAAO,SAASG,UAAT,GAAsB;AAC5B,SAAOL,UAAU,CAAEG,cAAF,CAAjB;AACA;;AAED,SAASG,qBAAT,CAAgCC,QAAhC,EAA2C;AAC1C,QAAMC,YAAY,GAAG,IAAIC,eAAJ,CAAqBF,QAAQ,CAACG,MAA9B,CAArB;AACA,SAAO,EACN,GAAGH,QADG;AAENI,IAAAA,MAAM,EAAEC,MAAM,CAACC,WAAP,CAAoBL,YAAY,CAACM,OAAb,EAApB;AAFF,GAAP;AAIA;;AAED,OAAO,SAASC,MAAT,OAAgC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACtC,QAAM,CAAET,QAAF,EAAYU,WAAZ,IAA4BnB,QAAQ,CAAE,MAC3CQ,qBAAqB,CAAEL,OAAO,CAACM,QAAV,CADoB,CAA1C;AAIAR,EAAAA,SAAS,CAAE,MAAM;AAChB,WAAOE,OAAO,CAACiB,MAAR,CAAgB,SAAqC;AAAA,UAAnC;AAAEX,QAAAA,QAAQ,EAAEY;AAAZ,OAAmC;AAC3DF,MAAAA,WAAW,CAAEX,qBAAqB,CAAEa,eAAF,CAAvB,CAAX;AACA,KAFM,CAAP;AAGA,GAJQ,EAIN,EAJM,CAAT;AAMA,SACC,cAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAGlB;AAAjC,KACC,cAAC,aAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAGM;AAAhC,KACGS,QAAQ,CAAET,QAAF,CADX,CADD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport history from '../../utils/history';\n\nconst RoutesContext = createContext();\nconst HistoryContext = createContext();\n\nexport function useLocation() {\n\treturn useContext( RoutesContext );\n}\n\nexport function useHistory() {\n\treturn useContext( HistoryContext );\n}\n\nfunction getLocationWithParams( location ) {\n\tconst searchParams = new URLSearchParams( location.search );\n\treturn {\n\t\t...location,\n\t\tparams: Object.fromEntries( searchParams.entries() ),\n\t};\n}\n\nexport function Routes( { children } ) {\n\tconst [ location, setLocation ] = useState( () =>\n\t\tgetLocationWithParams( history.location )\n\t);\n\n\tuseEffect( () => {\n\t\treturn history.listen( ( { location: updatedLocation } ) => {\n\t\t\tsetLocation( getLocationWithParams( updatedLocation ) );\n\t\t} );\n\t}, [] );\n\n\treturn (\n\t\t<HistoryContext.Provider value={ history }>\n\t\t\t<RoutesContext.Provider value={ location }>\n\t\t\t\t{ children( location ) }\n\t\t\t</RoutesContext.Provider>\n\t\t</HistoryContext.Provider>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WordPress dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { useHistory } from './index';
|
|
13
|
+
export function useLink() {
|
|
14
|
+
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15
|
+
let state = arguments.length > 1 ? arguments[1] : undefined;
|
|
16
|
+
let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
17
|
+
const history = useHistory();
|
|
18
|
+
|
|
19
|
+
function onClick(event) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
|
|
22
|
+
if (shouldReplace) {
|
|
23
|
+
history.replace(params, state);
|
|
24
|
+
} else {
|
|
25
|
+
history.push(params, state);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
href: addQueryArgs(window.location.href, params),
|
|
31
|
+
onClick
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export default function Link(_ref) {
|
|
35
|
+
let {
|
|
36
|
+
params = {},
|
|
37
|
+
state,
|
|
38
|
+
replace: shouldReplace = false,
|
|
39
|
+
children,
|
|
40
|
+
...props
|
|
41
|
+
} = _ref;
|
|
42
|
+
const {
|
|
43
|
+
href,
|
|
44
|
+
onClick
|
|
45
|
+
} = useLink(params, state, shouldReplace);
|
|
46
|
+
return createElement("a", _extends({
|
|
47
|
+
href: href,
|
|
48
|
+
onClick: onClick
|
|
49
|
+
}, props), children);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/link.js"],"names":["addQueryArgs","useHistory","useLink","params","state","shouldReplace","history","onClick","event","preventDefault","replace","push","href","window","location","Link","children","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,SAA3B;AAEA,OAAO,SAASC,OAAT,GAA8D;AAAA,MAA5CC,MAA4C,uEAAnC,EAAmC;AAAA,MAA/BC,KAA+B;AAAA,MAAxBC,aAAwB,uEAAR,KAAQ;AACpE,QAAMC,OAAO,GAAGL,UAAU,EAA1B;;AAEA,WAASM,OAAT,CAAkBC,KAAlB,EAA0B;AACzBA,IAAAA,KAAK,CAACC,cAAN;;AAEA,QAAKJ,aAAL,EAAqB;AACpBC,MAAAA,OAAO,CAACI,OAAR,CAAiBP,MAAjB,EAAyBC,KAAzB;AACA,KAFD,MAEO;AACNE,MAAAA,OAAO,CAACK,IAAR,CAAcR,MAAd,EAAsBC,KAAtB;AACA;AACD;;AAED,SAAO;AACNQ,IAAAA,IAAI,EAAEZ,YAAY,CAAEa,MAAM,CAACC,QAAP,CAAgBF,IAAlB,EAAwBT,MAAxB,CADZ;AAENI,IAAAA;AAFM,GAAP;AAIA;AAED,eAAe,SAASQ,IAAT,OAMX;AAAA,MAN0B;AAC7BZ,IAAAA,MAAM,GAAG,EADoB;AAE7BC,IAAAA,KAF6B;AAG7BM,IAAAA,OAAO,EAAEL,aAAa,GAAG,KAHI;AAI7BW,IAAAA,QAJ6B;AAK7B,OAAGC;AAL0B,GAM1B;AACH,QAAM;AAAEL,IAAAA,IAAF;AAAQL,IAAAA;AAAR,MAAoBL,OAAO,CAAEC,MAAF,EAAUC,KAAV,EAAiBC,aAAjB,CAAjC;AAEA,SACC;AAAG,IAAA,IAAI,EAAGO,IAAV;AAAiB,IAAA,OAAO,EAAGL;AAA3B,KAA0CU,KAA1C,GACGD,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from './index';\n\nexport function useLink( params = {}, state, shouldReplace = false ) {\n\tconst history = useHistory();\n\n\tfunction onClick( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( shouldReplace ) {\n\t\t\thistory.replace( params, state );\n\t\t} else {\n\t\t\thistory.push( params, state );\n\t\t}\n\t}\n\n\treturn {\n\t\thref: addQueryArgs( window.location.href, params ),\n\t\tonClick,\n\t};\n}\n\nexport default function Link( {\n\tparams = {},\n\tstate,\n\treplace: shouldReplace = false,\n\tchildren,\n\t...props\n} ) {\n\tconst { href, onClick } = useLink( params, state, shouldReplace );\n\n\treturn (\n\t\t<a href={ href } onClick={ onClick } { ...props }>\n\t\t\t{ children }\n\t\t</a>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
+
import { speak } from '@wordpress/a11y';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useLocation } from './index';
|
|
14
|
+
export default function useTitle(title) {
|
|
15
|
+
const location = useLocation();
|
|
16
|
+
const siteTitle = useSelect(select => {
|
|
17
|
+
var _select$getEntityReco;
|
|
18
|
+
|
|
19
|
+
return (_select$getEntityReco = select(coreStore).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title;
|
|
20
|
+
}, []);
|
|
21
|
+
const isInitialLocationRef = useRef(true);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
isInitialLocationRef.current = false;
|
|
24
|
+
}, [location]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
// Don't update or announce the title for initial page load.
|
|
27
|
+
if (isInitialLocationRef.current) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (title && siteTitle) {
|
|
32
|
+
// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68
|
|
33
|
+
const formattedTitle = sprintf(
|
|
34
|
+
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
|
|
35
|
+
__('%1$s ‹ %2$s — WordPress'), title, siteTitle);
|
|
36
|
+
document.title = formattedTitle; // Announce title on route change for screen readers.
|
|
37
|
+
|
|
38
|
+
speak(sprintf(
|
|
39
|
+
/* translators: The page title that is currently displaying. */
|
|
40
|
+
__('Now displaying: %s'), document.title), 'assertive');
|
|
41
|
+
}
|
|
42
|
+
}, [title, siteTitle, location]);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=use-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/routes/use-title.js"],"names":["useEffect","useRef","useSelect","store","coreStore","__","sprintf","speak","useLocation","useTitle","title","location","siteTitle","select","getEntityRecord","isInitialLocationRef","current","formattedTitle","document"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,SAA5B;AAEA,eAAe,SAASC,QAAT,CAAmBC,KAAnB,EAA2B;AACzC,QAAMC,QAAQ,GAAGH,WAAW,EAA5B;AACA,QAAMI,SAAS,GAAGV,SAAS,CACxBW,MAAF;AAAA;;AAAA,oCACCA,MAAM,CAAET,SAAF,CAAN,CAAoBU,eAApB,CAAqC,MAArC,EAA6C,MAA7C,CADD,0DACC,sBAAuDJ,KADxD;AAAA,GAD0B,EAG1B,EAH0B,CAA3B;AAKA,QAAMK,oBAAoB,GAAGd,MAAM,CAAE,IAAF,CAAnC;AAEAD,EAAAA,SAAS,CAAE,MAAM;AAChBe,IAAAA,oBAAoB,CAACC,OAArB,GAA+B,KAA/B;AACA,GAFQ,EAEN,CAAEL,QAAF,CAFM,CAAT;AAIAX,EAAAA,SAAS,CAAE,MAAM;AAChB;AACA,QAAKe,oBAAoB,CAACC,OAA1B,EAAoC;AACnC;AACA;;AAED,QAAKN,KAAK,IAAIE,SAAd,EAA0B;AACzB;AACA,YAAMK,cAAc,GAAGX,OAAO;AAC7B;AACAD,MAAAA,EAAE,CAAE,yBAAF,CAF2B,EAG7BK,KAH6B,EAI7BE,SAJ6B,CAA9B;AAOAM,MAAAA,QAAQ,CAACR,KAAT,GAAiBO,cAAjB,CATyB,CAWzB;;AACAV,MAAAA,KAAK,CACJD,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,oBAAF,CAFI,EAGNa,QAAQ,CAACR,KAHH,CADH,EAMJ,WANI,CAAL;AAQA;AACD,GA3BQ,EA2BN,CAAEA,KAAF,EAASE,SAAT,EAAoBD,QAApB,CA3BM,CAAT;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from './index';\n\nexport default function useTitle( title ) {\n\tconst location = useLocation();\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( title && siteTitle ) {\n\t\t\t// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */\n\t\t\t\t__( '%1$s ‹ %2$s — WordPress' ),\n\t\t\t\ttitle,\n\t\t\t\tsiteTitle\n\t\t\t);\n\n\t\t\tdocument.title = formattedTitle;\n\n\t\t\t// Announce title on route change for screen readers.\n\t\t\tspeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The page title that is currently displaying. */\n\t\t\t\t\t__( 'Now displaying: %s' ),\n\t\t\t\t\tdocument.title\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t}\n\t}, [ title, siteTitle, location ] );\n}\n"]}
|
|
@@ -6,14 +6,19 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
import { styles, moreVertical } from '@wordpress/icons';
|
|
9
|
+
import { useDispatch } from '@wordpress/data';
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import DefaultSidebar from './default-sidebar';
|
|
14
15
|
import { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';
|
|
16
|
+
import { store as editSiteStore } from '../../store';
|
|
15
17
|
export default function GlobalStylesSidebar() {
|
|
16
18
|
const [canReset, onReset] = useGlobalStylesReset();
|
|
19
|
+
const {
|
|
20
|
+
toggleFeature
|
|
21
|
+
} = useDispatch(editSiteStore);
|
|
17
22
|
return createElement(DefaultSidebar, {
|
|
18
23
|
className: "edit-site-global-styles-sidebar",
|
|
19
24
|
identifier: "edit-site/global-styles",
|
|
@@ -31,6 +36,9 @@ export default function GlobalStylesSidebar() {
|
|
|
31
36
|
controls: [{
|
|
32
37
|
title: __('Reset to defaults'),
|
|
33
38
|
onClick: onReset
|
|
39
|
+
}, {
|
|
40
|
+
title: __('Welcome Guide'),
|
|
41
|
+
onClick: () => toggleFeature('welcomeGuideStyles')
|
|
34
42
|
}]
|
|
35
43
|
})))
|
|
36
44
|
}, createElement(GlobalStylesUI, null));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["DropdownMenu","FlexItem","FlexBlock","Flex","__","styles","moreVertical","DefaultSidebar","GlobalStylesUI","useGlobalStylesReset","GlobalStylesSidebar","canReset","onReset","disabled","title","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,EAA4CC,IAA5C,QAAwD,uBAAxD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,kBAArC;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,cAAT,EAAyBC,oBAAzB,QAAqD,kBAArD;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["DropdownMenu","FlexItem","FlexBlock","Flex","__","styles","moreVertical","useDispatch","DefaultSidebar","GlobalStylesUI","useGlobalStylesReset","store","editSiteStore","GlobalStylesSidebar","canReset","onReset","toggleFeature","disabled","title","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,EAA4CC,IAA5C,QAAwD,uBAAxD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,QAAqC,kBAArC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,cAAT,EAAyBC,oBAAzB,QAAqD,kBAArD;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,QAAF,EAAYC,OAAZ,IAAwBL,oBAAoB,EAAlD;AACA,QAAM;AAAEM,IAAAA;AAAF,MAAoBT,WAAW,CAAEK,aAAF,CAArC;AAEA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAGR,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,MAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,6BAAF,CALhB;AAMC,IAAA,MAAM,EACL,cAAC,IAAD,QACC,cAAC,SAAD,QACC,8BAAUA,EAAE,CAAE,QAAF,CAAZ,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,EAAE,CAAE,MAAF,CADL,CAFD,CADD,EAOC,cAAC,QAAD,QACC,cAAC,YAAD;AACC,MAAA,IAAI,EAAGE,YADR;AAEC,MAAA,KAAK,EAAGF,EAAE,CAAE,4BAAF,CAFX;AAGC,MAAA,WAAW,EAAG;AAAEa,QAAAA,QAAQ,EAAE,CAAEH;AAAd,OAHf;AAIC,MAAA,QAAQ,EAAG,CACV;AACCI,QAAAA,KAAK,EAAEd,EAAE,CAAE,mBAAF,CADV;AAECe,QAAAA,OAAO,EAAEJ;AAFV,OADU,EAKV;AACCG,QAAAA,KAAK,EAAEd,EAAE,CAAE,eAAF,CADV;AAECe,QAAAA,OAAO,EAAE,MACRH,aAAa,CAAE,oBAAF;AAHf,OALU;AAJZ,MADD,CAPD;AAPF,KAmCC,cAAC,cAAD,OAnCD,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, FlexItem, FlexBlock, Flex } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, moreVertical } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI, useGlobalStylesReset } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close global styles sidebar' ) }\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t\t<span className=\"edit-site-global-styles-sidebar__beta\">\n\t\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'More Global Styles Actions' ) }\n\t\t\t\t\t\t\ttoggleProps={ { disabled: ! canReset } }\n\t\t\t\t\t\t\tcontrols={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\t\t\t\tonClick: onReset,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\ttoggleFeature( 'welcomeGuideStyles' ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { Button, __experimentalHeading as Heading } from '@wordpress/components';
|
|
8
|
-
import {
|
|
8
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
9
9
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
/**
|
|
@@ -13,7 +13,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { store as editSiteStore } from '../../../store';
|
|
16
|
-
import { TEMPLATE_PART_AREA_TO_NAME } from '../../../store/constants';
|
|
17
16
|
|
|
18
17
|
function TemplateAreaItem(_ref) {
|
|
19
18
|
let {
|
|
@@ -24,6 +23,11 @@ function TemplateAreaItem(_ref) {
|
|
|
24
23
|
selectBlock,
|
|
25
24
|
toggleBlockHighlight
|
|
26
25
|
} = useDispatch(blockEditorStore);
|
|
26
|
+
const templatePartArea = useSelect(select => {
|
|
27
|
+
const defaultAreas = select(editorStore).__experimentalGetDefaultTemplatePartAreas();
|
|
28
|
+
|
|
29
|
+
return defaultAreas.find(defaultArea => defaultArea.area === area);
|
|
30
|
+
}, [area]);
|
|
27
31
|
|
|
28
32
|
const highlightBlock = () => toggleBlockHighlight(clientId, true);
|
|
29
33
|
|
|
@@ -31,7 +35,7 @@ function TemplateAreaItem(_ref) {
|
|
|
31
35
|
|
|
32
36
|
return createElement(Button, {
|
|
33
37
|
className: "edit-site-template-card__template-areas-item",
|
|
34
|
-
icon:
|
|
38
|
+
icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
|
|
35
39
|
onMouseOver: highlightBlock,
|
|
36
40
|
onMouseLeave: cancelHighlightBlock,
|
|
37
41
|
onFocus: highlightBlock,
|
|
@@ -39,7 +43,7 @@ function TemplateAreaItem(_ref) {
|
|
|
39
43
|
onClick: () => {
|
|
40
44
|
selectBlock(clientId);
|
|
41
45
|
}
|
|
42
|
-
},
|
|
46
|
+
}, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label);
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
export default function TemplateAreas() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/template-areas.js"],"names":["useSelect","useDispatch","Button","__experimentalHeading","Heading","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/template-areas.js"],"names":["useSelect","useDispatch","Button","__experimentalHeading","Heading","store","editorStore","blockEditorStore","__","editSiteStore","TemplateAreaItem","area","clientId","selectBlock","toggleBlockHighlight","templatePartArea","select","defaultAreas","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","highlightBlock","cancelHighlightBlock","icon","label","TemplateAreas","templateParts","getCurrentTemplateTemplateParts","length","map","templatePart","block","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,qBAAqB,IAAIC,OAF1B,QAGO,uBAHP;AAIA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,gBAAvC;;AAEA,SAASC,gBAAT,OAAgD;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AAC/C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAwCb,WAAW,CACxDM,gBADwD,CAAzD;AAGA,QAAMQ,gBAAgB,GAAGf,SAAS,CAC/BgB,MAAF,IAAc;AACb,UAAMC,YAAY,GAAGD,MAAM,CAC1BV,WAD0B,CAAN,CAEnBY,yCAFmB,EAArB;;AAIA,WAAOD,YAAY,CAACE,IAAb,CACJC,WAAF,IAAmBA,WAAW,CAACT,IAAZ,KAAqBA,IADlC,CAAP;AAGA,GATgC,EAUjC,CAAEA,IAAF,CAViC,CAAlC;;AAaA,QAAMU,cAAc,GAAG,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,CADH,CARD,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nfunction TemplateAreaItem( { area, clientId } ) {\n\tconst { selectBlock, toggleBlockHighlight } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas = select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === area\n\t\t\t);\n\t\t},\n\t\t[ area ]\n\t);\n\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-site-template-card__template-areas-item\"\n\t\t\ticon={ templatePartArea?.icon }\n\t\t\tonMouseOver={ highlightBlock }\n\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\tonFocus={ highlightBlock }\n\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\tonClick={ () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t} }\n\t\t>\n\t\t\t{ templatePartArea?.label }\n\t\t</Button>\n\t);\n}\n\nexport default function TemplateAreas() {\n\tconst templateParts = useSelect(\n\t\t( select ) => select( editSiteStore ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<section className=\"edit-site-template-card__template-areas\">\n\t\t\t<Heading\n\t\t\t\tlevel={ 3 }\n\t\t\t\tclassName=\"edit-site-template-card__template-areas-title\"\n\t\t\t>\n\t\t\t\t{ __( 'Areas' ) }\n\t\t\t</Heading>\n\n\t\t\t<ul className=\"edit-site-template-card__template-areas-list\">\n\t\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t\t<li key={ templatePart.slug }>\n\t\t\t\t\t\t<TemplateAreaItem\n\t\t\t\t\t\t\tarea={ templatePart.area }\n\t\t\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</section>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { TextControl } from '@wordpress/components';
|
|
8
|
+
import { useEntityProp } from '@wordpress/core-data';
|
|
9
|
+
export default function EditTemplateTitle(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
template
|
|
12
|
+
} = _ref;
|
|
13
|
+
const [title, setTitle] = useEntityProp('postType', template.type, 'title', template.id);
|
|
14
|
+
return createElement(TextControl, {
|
|
15
|
+
label: __('Title'),
|
|
16
|
+
value: title,
|
|
17
|
+
help: __('Give the template a title that indicates its purpose, e.g. "Full Width".'),
|
|
18
|
+
onChange: newTitle => {
|
|
19
|
+
setTitle(newTitle || template.slug);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=edit-template-title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["__","TextControl","useEntityProp","EditTemplateTitle","template","title","setTitle","type","id","newTitle","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AAEA,eAAe,SAASC,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBJ,aAAa,CACxC,UADwC,EAExCE,QAAQ,CAACG,IAF+B,EAGxC,OAHwC,EAIxCH,QAAQ,CAACI,EAJ+B,CAAzC;AAOA,SACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGR,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,KAAK,EAAGK,KAFT;AAGC,IAAA,IAAI,EAAGL,EAAE,CACR,0EADQ,CAHV;AAMC,IAAA,QAAQ,EAAKS,QAAF,IAAgB;AAC1BH,MAAAA,QAAQ,CAAEG,QAAQ,IAAIL,QAAQ,CAACM,IAAvB,CAAR;AACA;AARF,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\n\nexport default function EditTemplateTitle( { template } ) {\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\ttemplate.type,\n\t\t'title',\n\t\ttemplate.id\n\t);\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ title }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tsetTitle( newTitle || template.slug );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import { createElement } from "@wordpress/element";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -8,7 +9,6 @@ import { sprintf, __ } from '@wordpress/i18n';
|
|
|
8
9
|
import { Button, MenuGroup, MenuItem, __experimentalHeading as Heading, __experimentalText as Text } from '@wordpress/components';
|
|
9
10
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
11
|
import { store as editorStore } from '@wordpress/editor';
|
|
11
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
@@ -17,6 +17,8 @@ import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
|
17
17
|
import { MENU_TEMPLATES, TEMPLATE_PARTS_SUB_MENUS } from '../navigation-sidebar/navigation-panel/constants';
|
|
18
18
|
import { store as editSiteStore } from '../../store';
|
|
19
19
|
import TemplateAreas from './template-areas';
|
|
20
|
+
import EditTemplateTitle from './edit-template-title';
|
|
21
|
+
import { useLink } from '../routes/link';
|
|
20
22
|
export default function TemplateDetails(_ref) {
|
|
21
23
|
let {
|
|
22
24
|
template,
|
|
@@ -44,6 +46,11 @@ export default function TemplateDetails(_ref) {
|
|
|
44
46
|
return area === (template === null || template === void 0 ? void 0 : template.area);
|
|
45
47
|
});
|
|
46
48
|
}, [template]);
|
|
49
|
+
const browseAllLinkProps = useLink({
|
|
50
|
+
// TODO: We should update this to filter by template part's areas as well.
|
|
51
|
+
postType: template.type,
|
|
52
|
+
postId: undefined
|
|
53
|
+
});
|
|
47
54
|
|
|
48
55
|
if (!template) {
|
|
49
56
|
return null;
|
|
@@ -58,7 +65,9 @@ export default function TemplateDetails(_ref) {
|
|
|
58
65
|
className: "edit-site-template-details"
|
|
59
66
|
}, createElement("div", {
|
|
60
67
|
className: "edit-site-template-details__group"
|
|
61
|
-
}, createElement(
|
|
68
|
+
}, template.is_custom ? createElement(EditTemplateTitle, {
|
|
69
|
+
template: template
|
|
70
|
+
}) : createElement(Heading, {
|
|
62
71
|
level: 4,
|
|
63
72
|
weight: 600,
|
|
64
73
|
className: "edit-site-template-details__title"
|
|
@@ -72,16 +81,11 @@ export default function TemplateDetails(_ref) {
|
|
|
72
81
|
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
73
82
|
}, createElement(MenuItem, {
|
|
74
83
|
className: "edit-site-template-details__revert-button",
|
|
75
|
-
info: __('Restore template to
|
|
84
|
+
info: __('Restore template to default state'),
|
|
76
85
|
onClick: revert
|
|
77
|
-
}, __('Clear customizations'))), createElement(Button, {
|
|
78
|
-
className: "edit-site-template-details__show-all-button"
|
|
79
|
-
|
|
80
|
-
// TODO: We should update this to filter by template part's areas as well.
|
|
81
|
-
postId: undefined,
|
|
82
|
-
postType: template.type
|
|
83
|
-
})
|
|
84
|
-
}, sprintf(
|
|
86
|
+
}, __('Clear customizations'))), createElement(Button, _extends({
|
|
87
|
+
className: "edit-site-template-details__show-all-button"
|
|
88
|
+
}, browseAllLinkProps), sprintf(
|
|
85
89
|
/* translators: the template part's area name ("Headers", "Sidebars") or "templates". */
|
|
86
90
|
__('Browse all %s'), templateSubMenu.title)));
|
|
87
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["useMemo","sprintf","__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["useMemo","sprintf","__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","isTemplateRevertable","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","editSiteStore","TemplateAreas","EditTemplateTitle","useLink","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","templateSubMenu","type","menu","find","area","browseAllLinkProps","postType","postId","undefined","revert","is_custom"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAM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 } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport {\n\tMENU_TEMPLATES,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../navigation-sidebar/navigation-panel/constants';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst templateSubMenu = useMemo( () => {\n\t\tif ( template?.type === 'wp_template' ) {\n\t\t\treturn { title: __( 'templates' ), menu: MENU_TEMPLATES };\n\t\t}\n\n\t\treturn TEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t( { area } ) => area === template?.area\n\t\t);\n\t}, [ template ] );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t{ template.is_custom ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Heading>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: the template part's area name (\"Headers\", \"Sidebars\") or \"templates\". */\n\t\t\t\t\t__( 'Browse all %s' ),\n\t\t\t\t\ttemplateSubMenu.title\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|