@wordpress/edit-site 3.0.10 → 3.0.14
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 +34 -18
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +41 -23
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +3 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +12 -6
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +29 -6
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +5 -43
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +71 -0
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +5 -5
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -5
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +3 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +23 -3
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +3 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +3 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +54 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +74 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +28 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +12 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +26 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js +104 -0
- package/build/components/list/actions/index.js.map +1 -0
- package/build/components/list/actions/rename-menu-item.js +112 -0
- package/build/components/list/actions/rename-menu-item.js.map +1 -0
- package/build/components/list/added-by.js +180 -0
- package/build/components/list/added-by.js.map +1 -0
- package/build/components/list/index.js +54 -7
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +58 -68
- package/build/components/list/table.js.map +1 -1
- package/build/components/list/use-register-shortcuts.js +52 -0
- package/build/components/list/use-register-shortcuts.js.map +1 -0
- package/build/components/navigation-sidebar/index.js +24 -9
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +35 -17
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +14 -5
- package/build/components/navigation-sidebar/navigation-toggle/index.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 +8 -4
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +1 -1
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/store/actions.js +47 -18
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +25 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +30 -17
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +40 -24
- package/build-module/components/add-new-template/new-template.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/editor/index.js +13 -7
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +29 -7
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +6 -39
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +60 -0
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +5 -5
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +12 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +22 -3
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +41 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +70 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +28 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +11 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +26 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +85 -0
- package/build-module/components/list/actions/index.js.map +1 -0
- package/build-module/components/list/actions/rename-menu-item.js +101 -0
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -0
- package/build-module/components/list/added-by.js +166 -0
- package/build-module/components/list/added-by.js.map +1 -0
- package/build-module/components/list/index.js +49 -8
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +60 -70
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/list/use-register-shortcuts.js +41 -0
- package/build-module/components/list/use-register-shortcuts.js.map +1 -0
- package/build-module/components/navigation-sidebar/index.js +22 -10
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +33 -18
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +14 -6
- package/build-module/components/navigation-sidebar/navigation-toggle/index.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 +7 -4
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +1 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/index.js +8 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +48 -19
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +146 -21
- package/build-style/style.css +146 -21
- package/package.json +10 -8
- package/src/components/add-new-template/new-template-part.js +32 -18
- package/src/components/add-new-template/new-template.js +39 -20
- package/src/components/block-editor/index.js +2 -0
- package/src/components/editor/index.js +17 -6
- package/src/components/global-styles/color-palette-panel.js +64 -7
- package/src/components/global-styles/global-styles-provider.js +3 -33
- package/src/components/global-styles/gradients-palette-panel.js +99 -0
- package/src/components/global-styles/hooks.js +4 -4
- package/src/components/global-styles/palette.js +30 -10
- package/src/components/global-styles/screen-background-color.js +2 -0
- package/src/components/global-styles/screen-color-palette.js +30 -3
- package/src/components/global-styles/screen-link-color.js +2 -0
- package/src/components/global-styles/screen-text-color.js +2 -0
- package/src/components/global-styles/screen-typography-element.js +39 -0
- package/src/components/global-styles/screen-typography.js +84 -3
- package/src/components/global-styles/style.scss +45 -6
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/test/utils.js +1 -1
- package/src/components/global-styles/typography-panel.js +37 -7
- package/src/components/global-styles/ui.js +9 -0
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +32 -0
- package/src/components/list/actions/index.js +95 -0
- package/src/components/list/actions/rename-menu-item.js +134 -0
- package/src/components/list/added-by.js +179 -0
- package/src/components/list/index.js +63 -5
- package/src/components/list/style.scss +106 -11
- package/src/components/list/table.js +65 -76
- package/src/components/list/use-register-shortcuts.js +45 -0
- package/src/components/navigation-sidebar/index.js +21 -12
- package/src/components/navigation-sidebar/navigation-panel/index.js +32 -15
- package/src/components/navigation-sidebar/navigation-toggle/index.js +29 -17
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +2 -0
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/template-details/edit-template-title.js +28 -0
- package/src/components/template-details/index.js +15 -10
- package/src/components/template-details/template-areas.js +1 -1
- package/src/index.js +10 -2
- package/src/store/actions.js +82 -34
- package/src/store/selectors.js +22 -4
- package/src/store/test/actions.js +0 -24
- package/src/store/test/selectors.js +24 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["Table","templateType","templates","isLoading","postType","select","getEntityRecords","hasFinishedResolution","getPostType","coreStore","per_page","length","labels","name","toLowerCase","map","template","id","window","location","href","postId","type","title","rendered","slug","description"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,KAAT,OAAmC;AAAA,MAAnB;AAAEC,I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C;AAFN,OAIG,cAAI,UAAJ,CAJH,CAPD,EAaC;AACC,MAAA,SAAS,EAAC,6BADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIC,4BAAC,0BAAD,QAAkB,cAAI,SAAJ,CAAlB,CAJD,CAbD,CADD,CADD,EAwBC,2CACGZ,SAAS,CAACa,GAAV,CAAiBC,QAAF;AAAA;;AAAA,aAChB;AACC,QAAA,GAAG,EAAGA,QAAQ,CAACC,EADhB;AAEC,QAAA,SAAS,EAAC,0BAFX;AAGC,QAAA,IAAI,EAAC;AAHN,SAKC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,4BAAC,iCAAD;AAAS,QAAA,KAAK,EAAG;AAAjB,SACC;AACC,QAAA,IAAI,EAAG,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,EAAoC;AAC1CC,UAAAA,MAAM,EAAEL,QAAQ,CAACC,EADyB;AAE1Cb,UAAAA,QAAQ,EAAEY,QAAQ,CAACM;AAFuB,SAApC;AADR,SAMG,oBAAAN,QAAQ,CAACO,KAAT,oEAAgBC,QAAhB,KACDR,QAAQ,CAACS,IAPX,CADD,CADD,EAYGT,QAAQ,CAACU,WAZZ,CALD,EAoBC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,4BAAC,gBAAD;AACC,QAAA,YAAY,EAAGzB,YADhB;AAEC,QAAA,QAAQ,EAAGe;AAFZ,QADD,CApBD,EA0BC;AAAI,QAAA,SAAS,EAAC,6BAAd;AAA4C,QAAA,IAAI,EAAC;AAAjD,SACC,4BAAC,gBAAD;AAAS,QAAA,QAAQ,EAAGA;AAApB,QADD,CA1BD,CADgB;AAAA,KAAf,CADH,CAxBD;AAHD;AA+DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport Actions from './actions';\nimport AddedBy from './added-by';\n\nexport default function Table( { templateType } ) {\n\tconst { templates, isLoading, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEntityRecords,\n\t\t\t\thasFinishedResolution,\n\t\t\t\tgetPostType,\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\ttemplates: getEntityRecords( 'postType', templateType, {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} ),\n\t\t\t\tisLoading: ! hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\t{ per_page: -1 },\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( templateType ),\n\t\t\t};\n\t\t},\n\t\t[ templateType ]\n\t);\n\n\tif ( ! templates || isLoading ) {\n\t\treturn null;\n\t}\n\n\tif ( ! templates.length ) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: The template type name, should be either \"templates\" or \"template parts\".\n\t\t\t\t\t__( 'No %s found.' ),\n\t\t\t\t\tpostType?.labels?.name?.toLowerCase()\n\t\t\t\t) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t// These explicit aria roles are needed for Safari.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables\n\t\t<table className=\"edit-site-list-table\" role=\"table\">\n\t\t\t<thead>\n\t\t\t\t<tr className=\"edit-site-list-table-head\" role=\"row\">\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Added by' ) }\n\t\t\t\t\t</th>\n\t\t\t\t\t<th\n\t\t\t\t\t\tclassName=\"edit-site-list-table-column\"\n\t\t\t\t\t\trole=\"columnheader\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\n\t\t\t<tbody>\n\t\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t\t<tr\n\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\tclassName=\"edit-site-list-table-row\"\n\t\t\t\t\t\trole=\"row\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Heading level={ 4 }>\n\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: template.type,\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\t{ template.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\ttemplate.slug }\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t{ template.description }\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<AddedBy\n\t\t\t\t\t\t\t\ttemplateType={ templateType }\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td className=\"edit-site-list-table-column\" role=\"cell\">\n\t\t\t\t\t\t\t<Actions template={ template } />\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t) ) }\n\t\t\t</tbody>\n\t\t</table>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useRegisterShortcuts;
|
|
7
|
+
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
function useRegisterShortcuts() {
|
|
20
|
+
const {
|
|
21
|
+
registerShortcut
|
|
22
|
+
} = (0, _data.useDispatch)(_keyboardShortcuts.store);
|
|
23
|
+
(0, _element.useEffect)(() => {
|
|
24
|
+
registerShortcut({
|
|
25
|
+
name: 'core/edit-site/next-region',
|
|
26
|
+
category: 'global',
|
|
27
|
+
description: (0, _i18n.__)('Navigate to the next part of the editor.'),
|
|
28
|
+
keyCombination: {
|
|
29
|
+
modifier: 'ctrl',
|
|
30
|
+
character: '`'
|
|
31
|
+
},
|
|
32
|
+
aliases: [{
|
|
33
|
+
modifier: 'access',
|
|
34
|
+
character: 'n'
|
|
35
|
+
}]
|
|
36
|
+
});
|
|
37
|
+
registerShortcut({
|
|
38
|
+
name: 'core/edit-site/previous-region',
|
|
39
|
+
category: 'global',
|
|
40
|
+
description: (0, _i18n.__)('Navigate to the previous part of the editor.'),
|
|
41
|
+
keyCombination: {
|
|
42
|
+
modifier: 'ctrlShift',
|
|
43
|
+
character: '`'
|
|
44
|
+
},
|
|
45
|
+
aliases: [{
|
|
46
|
+
modifier: 'access',
|
|
47
|
+
character: 'p'
|
|
48
|
+
}]
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=use-register-shortcuts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/use-register-shortcuts.js"],"names":["useRegisterShortcuts","registerShortcut","keyboardShortcutsStore","name","category","description","keyCombination","modifier","character","aliases"],"mappings":";;;;;;;AAIA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOe,SAASA,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,wBAAb,CAA7B;AACA,0BAAW,MAAM;AAChBD,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,4BADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,0CAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,MADK;AAEfC,QAAAA,SAAS,EAAE;AAFI,OAJC;AAQjBC,MAAAA,OAAO,EAAE,CACR;AACCF,QAAAA,QAAQ,EAAE,QADX;AAECC,QAAAA,SAAS,EAAE;AAFZ,OADQ;AARQ,KAAF,CAAhB;AAgBAP,IAAAA,gBAAgB,CAAE;AACjBE,MAAAA,IAAI,EAAE,gCADW;AAEjBC,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAE,cAAI,8CAAJ,CAHI;AAIjBC,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,WADK;AAEfC,QAAAA,SAAS,EAAE;AAFI,OAJC;AAQjBC,MAAAA,OAAO,EAAE,CACR;AACCF,QAAAA,QAAQ,EAAE,QADX;AAECC,QAAAA,SAAS,EAAE;AAFZ,OADQ;AARQ,KAAF,CAAhB;AAeA,GAhCD,EAgCG,EAhCH;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\nexport default function useRegisterShortcuts() {\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\t}, [] );\n}\n"]}
|
|
@@ -12,6 +12,12 @@ var _element = require("@wordpress/element");
|
|
|
12
12
|
|
|
13
13
|
var _components = require("@wordpress/components");
|
|
14
14
|
|
|
15
|
+
var _compose = require("@wordpress/compose");
|
|
16
|
+
|
|
17
|
+
var _data = require("@wordpress/data");
|
|
18
|
+
|
|
19
|
+
var _store = require("../../store");
|
|
20
|
+
|
|
15
21
|
var _navigationPanel = _interopRequireDefault(require("./navigation-panel"));
|
|
16
22
|
|
|
17
23
|
var _navigationToggle = _interopRequireDefault(require("./navigation-toggle"));
|
|
@@ -32,17 +38,26 @@ exports.NavigationPanelPreviewFill = NavigationPanelPreviewFill;
|
|
|
32
38
|
|
|
33
39
|
function NavigationSidebar(_ref) {
|
|
34
40
|
let {
|
|
35
|
-
|
|
41
|
+
isDefaultOpen = false,
|
|
36
42
|
activeTemplateType
|
|
37
43
|
} = _ref;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const isDesktopViewport = (0, _compose.useViewportMatch)('medium');
|
|
45
|
+
const {
|
|
46
|
+
setIsNavigationPanelOpened
|
|
47
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
48
|
+
(0, _element.useEffect)(() => {
|
|
49
|
+
// When transitioning to desktop open the navigation if `isDefaultOpen` is true.
|
|
50
|
+
if (isDefaultOpen && isDesktopViewport) {
|
|
51
|
+
setIsNavigationPanelOpened(true);
|
|
52
|
+
} // When transitioning to mobile/tablet, close the navigation.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if (!isDesktopViewport) {
|
|
56
|
+
setIsNavigationPanelOpened(false);
|
|
57
|
+
}
|
|
58
|
+
}, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]);
|
|
59
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_navigationToggle.default, null), (0, _element.createElement)(_navigationPanel.default, {
|
|
60
|
+
activeItem: activeTemplateType
|
|
46
61
|
}), (0, _element.createElement)(NavigationPanelPreviewSlot, null));
|
|
47
62
|
}
|
|
48
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/index.js"],"names":["Fill","NavigationPanelPreviewFill","Slot","NavigationPanelPreviewSlot","NavigationSidebar","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/index.js"],"names":["Fill","NavigationPanelPreviewFill","Slot","NavigationPanelPreviewSlot","NavigationSidebar","isDefaultOpen","activeTemplateType","isDesktopViewport","setIsNavigationPanelOpened","editSiteStore"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAbA;AACA;AACA;;AAMA;AACA;AACA;AAKO,MAAM;AACZA,EAAAA,IAAI,EAAEC,0BADM;AAEZC,EAAAA,IAAI,EAAEC;AAFM,IAGT,gCAAgB,gCAAhB,CAHG;;;;AAKQ,SAASC,iBAAT,OAGX;AAAA,MAHuC;AAC1CC,IAAAA,aAAa,GAAG,KAD0B;AAE1CC,IAAAA;AAF0C,GAGvC;AACH,QAAMC,iBAAiB,GAAG,+BAAkB,QAAlB,CAA1B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiC,uBAAaC,YAAb,CAAvC;AAEA,0BAAW,MAAM;AAChB;AACA,QAAKJ,aAAa,IAAIE,iBAAtB,EAA0C;AACzCC,MAAAA,0BAA0B,CAAE,IAAF,CAA1B;AACA,KAJe,CAMhB;;;AACA,QAAK,CAAED,iBAAP,EAA2B;AAC1BC,MAAAA,0BAA0B,CAAE,KAAF,CAA1B;AACA;AACD,GAVD,EAUG,CAAEH,aAAF,EAAiBE,iBAAjB,EAAoCC,0BAApC,CAVH;AAYA,SACC,qDACC,4BAAC,yBAAD,OADD,EAEC,4BAAC,wBAAD;AAAiB,IAAA,UAAU,EAAGF;AAA9B,IAFD,EAGC,4BAAC,0BAAD,OAHD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { createSlotFill } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport NavigationPanel from './navigation-panel';\nimport NavigationToggle from './navigation-toggle';\n\nexport const {\n\tFill: NavigationPanelPreviewFill,\n\tSlot: NavigationPanelPreviewSlot,\n} = createSlotFill( 'EditSiteNavigationPanelPreview' );\n\nexport default function NavigationSidebar( {\n\tisDefaultOpen = false,\n\tactiveTemplateType,\n} ) {\n\tconst isDesktopViewport = useViewportMatch( 'medium' );\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\t// When transitioning to desktop open the navigation if `isDefaultOpen` is true.\n\t\tif ( isDefaultOpen && isDesktopViewport ) {\n\t\t\tsetIsNavigationPanelOpened( true );\n\t\t}\n\n\t\t// When transitioning to mobile/tablet, close the navigation.\n\t\tif ( ! isDesktopViewport ) {\n\t\t\tsetIsNavigationPanelOpened( false );\n\t\t}\n\t}, [ isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened ] );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigationToggle />\n\t\t\t<NavigationPanel activeItem={ activeTemplateType } />\n\t\t\t<NavigationPanelPreviewSlot />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -25,8 +25,12 @@ var _htmlEntities = require("@wordpress/html-entities");
|
|
|
25
25
|
|
|
26
26
|
var _url = require("@wordpress/url");
|
|
27
27
|
|
|
28
|
+
var _icons = require("@wordpress/icons");
|
|
29
|
+
|
|
28
30
|
var _mainDashboardButton = _interopRequireDefault(require("../../main-dashboard-button"));
|
|
29
31
|
|
|
32
|
+
var _store = require("../../../store");
|
|
33
|
+
|
|
30
34
|
/**
|
|
31
35
|
* External dependencies
|
|
32
36
|
*/
|
|
@@ -38,39 +42,48 @@ var _mainDashboardButton = _interopRequireDefault(require("../../main-dashboard-
|
|
|
38
42
|
/**
|
|
39
43
|
* Internal dependencies
|
|
40
44
|
*/
|
|
45
|
+
const SITE_EDITOR_KEY = 'site-editor';
|
|
46
|
+
|
|
41
47
|
const NavigationPanel = _ref => {
|
|
42
48
|
let {
|
|
43
|
-
|
|
44
|
-
setIsOpen,
|
|
45
|
-
activeTemplateType
|
|
49
|
+
activeItem = SITE_EDITOR_KEY
|
|
46
50
|
} = _ref;
|
|
47
|
-
const
|
|
51
|
+
const {
|
|
52
|
+
isNavigationOpen,
|
|
53
|
+
siteTitle
|
|
54
|
+
} = (0, _data.useSelect)(select => {
|
|
48
55
|
const {
|
|
49
56
|
getEntityRecord
|
|
50
57
|
} = select(_coreData.store);
|
|
51
58
|
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
|
|
52
|
-
return
|
|
53
|
-
|
|
59
|
+
return {
|
|
60
|
+
siteTitle: siteData.name,
|
|
61
|
+
isNavigationOpen: select(_store.store).isNavigationOpened()
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
const {
|
|
65
|
+
setIsNavigationPanelOpened
|
|
66
|
+
} = (0, _data.useDispatch)(_store.store); // Ensures focus is moved to the panel area when it is activated
|
|
54
67
|
// from a separate component (such as document actions in the header).
|
|
55
68
|
|
|
56
69
|
const panelRef = (0, _element.useRef)();
|
|
57
70
|
(0, _element.useEffect)(() => {
|
|
58
|
-
if (
|
|
71
|
+
if (isNavigationOpen) {
|
|
59
72
|
panelRef.current.focus();
|
|
60
73
|
}
|
|
61
|
-
}, [
|
|
74
|
+
}, [activeItem, isNavigationOpen]);
|
|
62
75
|
|
|
63
76
|
const closeOnEscape = event => {
|
|
64
77
|
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
65
78
|
event.preventDefault();
|
|
66
|
-
|
|
79
|
+
setIsNavigationPanelOpened(false);
|
|
67
80
|
}
|
|
68
81
|
};
|
|
69
82
|
|
|
70
83
|
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
71
84
|
(0, _element.createElement)("div", {
|
|
72
85
|
className: (0, _classnames.default)(`edit-site-navigation-panel`, {
|
|
73
|
-
'is-open':
|
|
86
|
+
'is-open': isNavigationOpen
|
|
74
87
|
}),
|
|
75
88
|
ref: panelRef,
|
|
76
89
|
tabIndex: "-1",
|
|
@@ -84,7 +97,7 @@ const NavigationPanel = _ref => {
|
|
|
84
97
|
}, (0, _htmlEntities.decodeEntities)(siteTitle))), (0, _element.createElement)("div", {
|
|
85
98
|
className: "edit-site-navigation-panel__scroll-container"
|
|
86
99
|
}, (0, _element.createElement)(_components.__experimentalNavigation, {
|
|
87
|
-
activeItem:
|
|
100
|
+
activeItem: activeItem
|
|
88
101
|
}, (0, _element.createElement)(_mainDashboardButton.default.Slot, null, (0, _element.createElement)(_components.__experimentalNavigationBackButton, {
|
|
89
102
|
backButtonLabel: (0, _i18n.__)('Dashboard'),
|
|
90
103
|
className: "edit-site-navigation-panel__back-to-dashboard",
|
|
@@ -92,22 +105,27 @@ const NavigationPanel = _ref => {
|
|
|
92
105
|
})), (0, _element.createElement)(_components.__experimentalNavigationMenu, null, (0, _element.createElement)(_components.__experimentalNavigationGroup, {
|
|
93
106
|
title: (0, _i18n.__)('Editor')
|
|
94
107
|
}, (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
108
|
+
icon: _icons.home,
|
|
95
109
|
title: (0, _i18n.__)('Site'),
|
|
96
|
-
|
|
97
|
-
|
|
110
|
+
item: SITE_EDITOR_KEY,
|
|
111
|
+
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
112
|
+
postId: undefined,
|
|
113
|
+
postType: undefined
|
|
98
114
|
})
|
|
99
115
|
}), (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
116
|
+
icon: _icons.layout,
|
|
100
117
|
title: (0, _i18n.__)('Templates'),
|
|
101
118
|
item: "wp_template",
|
|
102
|
-
href: (0, _url.addQueryArgs)(
|
|
103
|
-
|
|
119
|
+
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
120
|
+
postId: undefined,
|
|
104
121
|
postType: 'wp_template'
|
|
105
122
|
})
|
|
106
123
|
}), (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
124
|
+
icon: _icons.symbolFilled,
|
|
107
125
|
title: (0, _i18n.__)('Template Parts'),
|
|
108
126
|
item: "wp_template_part",
|
|
109
|
-
href: (0, _url.addQueryArgs)(
|
|
110
|
-
|
|
127
|
+
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
128
|
+
postId: undefined,
|
|
111
129
|
postType: 'wp_template_part'
|
|
112
130
|
})
|
|
113
131
|
})))))))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/index.js"],"names":["SITE_EDITOR_KEY","NavigationPanel","activeItem","isNavigationOpen","siteTitle","select","getEntityRecord","coreDataStore","siteData","undefined","name","editSiteStore","isNavigationOpened","setIsNavigationPanelOpened","panelRef","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","siteIcon","window","location","href","postId","postType","templateIcon","templatePartIcon"],"mappings":";;;;;;;;;AAiBA;;AAdA;;AAKA;;AAOA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AASA;;AACA;;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAqBA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG,aAAxB;;AAEA,MAAMC,eAAe,GAAG,QAAwC;AAAA,MAAtC;AAAEC,IAAAA,UAAU,GAAGF;AAAf,GAAsC;AAC/D,QAAM;AAAEG,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAkC,qBAAaC,MAAF,IAAc;AAChE,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC;AAEA,UAAMC,QAAQ,GACbF,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BG,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNL,MAAAA,SAAS,EAAEI,QAAQ,CAACE,IADd;AAENP,MAAAA,gBAAgB,EAAEE,MAAM,CAAEM,YAAF,CAAN,CAAwBC,kBAAxB;AAFZ,KAAP;AAIA,GAVuC,EAUrC,EAVqC,CAAxC;AAWA,QAAM;AAAEC,IAAAA;AAAF,MAAiC,uBAAaF,YAAb,CAAvC,CAZ+D,CAc/D;AACA;;AACA,QAAMG,QAAQ,GAAG,sBAAjB;AACA,0BAAW,MAAM;AAChB,QAAKX,gBAAL,EAAwB;AACvBW,MAAAA,QAAQ,CAACC,OAAT,CAAiBC,KAAjB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EAUC,4BAAC,wCAAD;AACC,MAAA,IAAI,EAAGoB,aADR;AAEC,MAAA,KAAK,EAAG,cAAI,WAAJ,CAFT;AAGC,MAAA,IAAI,EAAC,aAHN;AAIC,MAAA,IAAI,EAAG,uBAAcL,MAAM,CAACC,QAAP,CAAgBC,IAA9B,EAAoC;AAC1CC,QAAAA,MAAM,EAAElB,SADkC;AAE1CmB,QAAAA,QAAQ,EAAE;AAFgC,OAApC;AAJR,MAVD,EAmBC,4BAAC,wCAAD;AACC,MAAA,IAAI,EAAGE,mBADR;AAEC,MAAA,KAAK,EAAG,cAAI,gBAAJ,CAFT;AAGC,MAAA,IAAI,EAAC,kBAHN;AAIC,MAAA,IAAI,EAAG,uBAAcN,MAAM,CAACC,QAAP,CAAgBC,IAA9B,EAAoC;AAC1CC,QAAAA,MAAM,EAAElB,SADkC;AAE1CmB,QAAAA,QAAQ,EAAE;AAFgC,OAApC;AAJR,MAnBD,CADD,CATD,CADD,CAND,CARD;AAFD;AA8DA,CA5FD;;eA8Fe3B,e","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 { useEffect, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { addQueryArgs } from '@wordpress/url';\nimport {\n\thome as siteIcon,\n\tlayout as templateIcon,\n\tsymbolFilled as templatePartIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MainDashboardButton from '../../main-dashboard-button';\nimport { store as editSiteStore } from '../../../store';\n\nconst SITE_EDITOR_KEY = 'site-editor';\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\t// Ensures focus is moved to the panel area when it is activated\n\t// from a separate component (such as document actions in the header).\n\tconst panelRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isNavigationOpen ) {\n\t\t\tpanelRef.current.focus();\n\t\t}\n\t}, [ activeItem, isNavigationOpen ] );\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\tref={ panelRef }\n\t\t\ttabIndex=\"-1\"\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<NavigationItem\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\thref={ addQueryArgs( window.location.href, {\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<NavigationItem\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\thref={ addQueryArgs( window.location.href, {\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<NavigationItem\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\thref={ addQueryArgs( window.location.href, {\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"]}
|
|
@@ -19,16 +19,21 @@ var _coreData = require("@wordpress/core-data");
|
|
|
19
19
|
|
|
20
20
|
var _compose = require("@wordpress/compose");
|
|
21
21
|
|
|
22
|
+
var _store = require("../../../store");
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* WordPress dependencies
|
|
24
26
|
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
25
31
|
function NavigationToggle(_ref) {
|
|
26
32
|
let {
|
|
27
|
-
icon
|
|
28
|
-
isOpen,
|
|
29
|
-
setIsOpen
|
|
33
|
+
icon
|
|
30
34
|
} = _ref;
|
|
31
35
|
const {
|
|
36
|
+
isNavigationOpen,
|
|
32
37
|
isRequestingSiteIcon,
|
|
33
38
|
siteIconUrl
|
|
34
39
|
} = (0, _data.useSelect)(select => {
|
|
@@ -38,13 +43,17 @@ function NavigationToggle(_ref) {
|
|
|
38
43
|
} = select(_coreData.store);
|
|
39
44
|
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
|
|
40
45
|
return {
|
|
46
|
+
isNavigationOpen: select(_store.store).isNavigationOpened(),
|
|
41
47
|
isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
|
|
42
48
|
siteIconUrl: siteData.site_icon_url
|
|
43
49
|
};
|
|
44
50
|
}, []);
|
|
51
|
+
const {
|
|
52
|
+
setIsNavigationPanelOpened
|
|
53
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
45
54
|
const disableMotion = (0, _compose.useReducedMotion)();
|
|
46
55
|
|
|
47
|
-
const toggleNavigationPanel = () =>
|
|
56
|
+
const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen);
|
|
48
57
|
|
|
49
58
|
let buttonIcon = (0, _element.createElement)(_components.Icon, {
|
|
50
59
|
size: "36px",
|
|
@@ -78,7 +87,7 @@ function NavigationToggle(_ref) {
|
|
|
78
87
|
}
|
|
79
88
|
|
|
80
89
|
return (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
81
|
-
className: 'edit-site-navigation-toggle' + (
|
|
90
|
+
className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''),
|
|
82
91
|
whileHover: "expand"
|
|
83
92
|
}, (0, _element.createElement)(_components.Button, {
|
|
84
93
|
className: "edit-site-navigation-toggle__button has-icon",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-toggle/index.js"],"names":["NavigationToggle","icon","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-toggle/index.js"],"names":["NavigationToggle","icon","isNavigationOpen","isRequestingSiteIcon","siteIconUrl","select","getEntityRecord","isResolving","coreDataStore","siteData","undefined","editSiteStore","isNavigationOpened","site_icon_url","setIsNavigationPanelOpened","disableMotion","toggleNavigationPanel","buttonIcon","wordpress","effect","expand","scale","borderRadius","transition","type","duration"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAYA;AACA;AACA;AAGA,SAASA,gBAAT,OAAsC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACrC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA,oBAApB;AAA0CC,IAAAA;AAA1C,MAA0D,qBAC7DC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEG,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNR,M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,IAAI,EAAGhB;AAAzB,MAAb;AACA;;AAED,SACC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EACR,iCACEC,gBAAgB,GAAG,UAAH,GAAgB,EADlC,CAFF;AAKC,IAAA,UAAU,EAAC;AALZ,KAOC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,KAAK,EAAG,cAAI,mBAAJ,CAFT;AAGC,IAAA,OAAO,EAAGc,qBAHX;AAIC,IAAA,WAAW;AAJZ,KAMGC,UANH,CAPD,CADD;AAkBA;;eAEcjB,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\nfunction NavigationToggle( { icon } ) {\n\tconst { isNavigationOpen, isRequestingSiteIcon, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\t\treturn {\n\t\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsNavigationPanelOpened } = useDispatch( editSiteStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tconst toggleNavigationPanel = () =>\n\t\tsetIsNavigationPanelOpened( ! isNavigationOpen );\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.7,\n\t\t\tborderRadius: 0,\n\t\t\ttransition: { type: 'tween', duration: '0.2' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-site-navigation-toggle__site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t} else if ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t} else if ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={\n\t\t\t\t'edit-site-navigation-toggle' +\n\t\t\t\t( isNavigationOpen ? ' is-open' : '' )\n\t\t\t}\n\t\t\twhileHover=\"expand\"\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-navigation-toggle__button has-icon\"\n\t\t\t\tlabel={ __( 'Toggle navigation' ) }\n\t\t\t\tonClick={ toggleNavigationPanel }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default NavigationToggle;\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = EditTemplateTitle;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
function EditTemplateTitle(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
template
|
|
22
|
+
} = _ref;
|
|
23
|
+
const [title, setTitle] = (0, _coreData.useEntityProp)('postType', template.type, 'title', template.id);
|
|
24
|
+
return (0, _element.createElement)(_components.TextControl, {
|
|
25
|
+
label: (0, _i18n.__)('Title'),
|
|
26
|
+
value: title,
|
|
27
|
+
help: (0, _i18n.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
|
|
28
|
+
onChange: newTitle => {
|
|
29
|
+
setTitle(newTitle || template.slug);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# 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":["EditTemplateTitle","template","title","setTitle","type","id","newTitle","slug"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKe,SAASA,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,6BAC3B,UAD2B,EAE3BF,QAAQ,CAACG,IAFkB,EAG3B,OAH2B,EAI3BH,QAAQ,CAACI,EAJkB,CAA5B;AAOA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGH,KAFT;AAGC,IAAA,IAAI,EAAG,cACN,0EADM,CAHR;AAMC,IAAA,QAAQ,EAAKI,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"]}
|
|
@@ -27,6 +27,8 @@ var _store = require("../../store");
|
|
|
27
27
|
|
|
28
28
|
var _templateAreas = _interopRequireDefault(require("./template-areas"));
|
|
29
29
|
|
|
30
|
+
var _editTemplateTitle = _interopRequireDefault(require("./edit-template-title"));
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
* WordPress dependencies
|
|
32
34
|
*/
|
|
@@ -75,7 +77,9 @@ function TemplateDetails(_ref) {
|
|
|
75
77
|
className: "edit-site-template-details"
|
|
76
78
|
}, (0, _element.createElement)("div", {
|
|
77
79
|
className: "edit-site-template-details__group"
|
|
78
|
-
}, (0, _element.createElement)(
|
|
80
|
+
}, template.is_custom ? (0, _element.createElement)(_editTemplateTitle.default, {
|
|
81
|
+
template: template
|
|
82
|
+
}) : (0, _element.createElement)(_components.__experimentalHeading, {
|
|
79
83
|
level: 4,
|
|
80
84
|
weight: 600,
|
|
81
85
|
className: "edit-site-template-details__title"
|
|
@@ -89,13 +93,13 @@ function TemplateDetails(_ref) {
|
|
|
89
93
|
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
90
94
|
}, (0, _element.createElement)(_components.MenuItem, {
|
|
91
95
|
className: "edit-site-template-details__revert-button",
|
|
92
|
-
info: (0, _i18n.__)('Restore template to
|
|
96
|
+
info: (0, _i18n.__)('Restore template to default state'),
|
|
93
97
|
onClick: revert
|
|
94
98
|
}, (0, _i18n.__)('Clear customizations'))), (0, _element.createElement)(_components.Button, {
|
|
95
99
|
className: "edit-site-template-details__show-all-button",
|
|
96
|
-
href: (0, _url.addQueryArgs)(
|
|
97
|
-
page: 'gutenberg-edit-site',
|
|
100
|
+
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
98
101
|
// TODO: We should update this to filter by template part's areas as well.
|
|
102
|
+
postId: undefined,
|
|
99
103
|
postType: template.type
|
|
100
104
|
})
|
|
101
105
|
}, (0, _i18n.sprintf)(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","templateSubMenu","type","menu","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","find","area","revert","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","templateSubMenu","type","menu","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","find","area","revert","is_custom","window","location","href","postId","undefined","postType"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAcA;AACA;AACA;AAUe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,6BAAtB,CAAqDN,QAArD,CAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AAEA,QAAMC,eAAe,GAAG,sBAAS,MAAM;AACtC,QAAK,CAAAT,QAAQ,SAAR,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O,EAAGgB;AAHX,KAKG,cAAI,sBAAJ,CALH,CADD,CA5BF,EAuCC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,IAAI,EAAG,uBAAcE,MAAM,CAACC,QAAP,CAAgBC,IAA9B,EAAoC;AAC1C;AACAC,MAAAA,MAAM,EAAEC,SAFkC;AAG1CC,MAAAA,QAAQ,EAAEvB,QAAQ,CAACU;AAHuB,KAApC;AAFR,KAQG;AACD;AACA,gBAAI,eAAJ,CAFC,EAGDD,eAAe,CAACP,KAHf,CARH,CAvCD,CADD;AAwDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { sprintf, __ } 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';\nimport { addQueryArgs } from '@wordpress/url';\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';\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\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\thref={ addQueryArgs( window.location.href, {\n\t\t\t\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\t\t\t\tpostId: undefined,\n\t\t\t\t\tpostType: template.type,\n\t\t\t\t} ) }\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"]}
|
|
@@ -64,7 +64,7 @@ function TemplatePartItemMore(_ref) {
|
|
|
64
64
|
}, (0, _i18n.sprintf)(
|
|
65
65
|
/* translators: %s: template part title */
|
|
66
66
|
(0, _i18n.__)('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), (0, _isTemplateRevertable.default)(templatePart) && (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
67
|
-
info: (0, _i18n.__)('Restore template to
|
|
67
|
+
info: (0, _i18n.__)('Restore template to default state'),
|
|
68
68
|
onClick: clearCustomizations
|
|
69
69
|
}, (0, _i18n.__)('Clear customizations'))));
|
|
70
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","pushTemplatePart","revertTemplate","editSiteStore","editTemplatePart","id","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","blockEditorStore","highlightBlock","cancelHighlightBlock","area","TEMPLATE_PART_AREA_TO_NAME","moreVertical","TemplateAreas","templateParts","select","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKA,SAASA,oBAAT,OAII;AAAA;;AAAA,MAJ2B;AAC9BC,IAAAA,OAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA;AAH8B,GAI3B;AACH,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAuC,uBAAaC,YAAb,CAA7C;;AAEA,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@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { pushTemplatePart, revertTemplate } = useDispatch( editSiteStore );\n\n\tfunction editTemplatePart() {\n\t\tpushTemplatePart( templatePart.id );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __( 'Restore template to
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","pushTemplatePart","revertTemplate","editSiteStore","editTemplatePart","id","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","blockEditorStore","highlightBlock","cancelHighlightBlock","area","TEMPLATE_PART_AREA_TO_NAME","moreVertical","TemplateAreas","templateParts","select","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAfA;AACA;AACA;;AAQA;AACA;AACA;AAKA,SAASA,oBAAT,OAII;AAAA;;AAAA,MAJ2B;AAC9BC,IAAAA,OAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA;AAH8B,GAI3B;AACH,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAuC,uBAAaC,YAAb,CAA7C;;AAEA,WAASC,gBAAT,GAA4B;AAC3BH,IAAAA,gBAAgB,CAAEF,YAAY,CAACM,EAAf,CAAhB;AACAP,IAAAA,OAAO;AACPE,IAAAA,4BAA4B;AAC5B;;AAED,WAASM,mBAAT,GAA+B;AAC9BJ,IAAAA,cAAc,CAAEH,YAAF,CAAd;AACAD,IAAAA,OAAO;AACPE,IAAAA,4BAA4B;AAC5B;;AAED,SACC,qDACC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAGI;AAApB,KACG;AACD;AACA,gBAAI,SAAJ,CAFC,yBAGDL,YAAY,CAACQ,KAHZ,wDAGD,oBAAoBC,QAHnB,CADH,CADD,CADD,EAUG,mCAAsBT,YAAtB,KACD,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,cAAI,mCAAJ,CADR;AAEC,IAAA,OAAO,EAAGO;AAFX,KAIG,cAAI,sBAAJ,CAJH,CADD,CAXF,CADD;AAuBA;;AAED,SAASG,gBAAT,QAII;AAAA,MAJuB;AAC1BV,IAAAA,YAD0B;AAE1BW,IAAAA,QAF0B;AAG1BV,IAAAA;AAH0B,GAIvB;AACH,QAAM;AAAEW,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAwC,uBAC7CC,kBAD6C,CAA9C;;AAGA,QAAMC,cAAc,GAAG,MAAMF,oBAAoB,CAAEF,QAAF,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AFX,KAIGH,aAAa,CAACI,GAAd,CAAmB;AAAA,QAAE;AAAEzB,MAAAA,YAAF;AAAgB0B,MAAAA;AAAhB,KAAF;AAAA,WACpB,4BAAC,gBAAD;AACC,MAAA,GAAG,EAAG1B,YAAY,CAAC2B,IADpB;AAEC,MAAA,QAAQ,EAAGD,KAAK,CAACf,QAFlB;AAGC,MAAA,YAAY,EAAGX,YAHhB;AAIC,MAAA,4BAA4B,EAC3BC;AALF,MADoB;AAAA,GAAnB,CAJH,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { TEMPLATE_PART_AREA_TO_NAME } from '../../store/constants';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { pushTemplatePart, revertTemplate } = useDispatch( editSiteStore );\n\n\tfunction editTemplatePart() {\n\t\tpushTemplatePart( templatePart.id );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ clearCustomizations }\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\t\t</>\n\t);\n}\n\nfunction TemplatePartItem( {\n\ttemplatePart,\n\tclientId,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { selectBlock, toggleBlockHighlight } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<div\n\t\t\trole=\"menuitem\"\n\t\t\tclassName=\"edit-site-template-details__template-areas-item\"\n\t\t>\n\t\t\t<MenuItem\n\t\t\t\trole=\"button\"\n\t\t\t\ticon={ getTemplatePartIcon( templatePart.area ) }\n\t\t\t\ticonPosition=\"left\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} }\n\t\t\t\tonMouseOver={ highlightBlock }\n\t\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\t\tonFocus={ highlightBlock }\n\t\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\t>\n\t\t\t\t{ TEMPLATE_PART_AREA_TO_NAME[ templatePart.area ] }\n\t\t\t</MenuItem>\n\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\tclassName=\"edit-site-template-details__template-areas-item-more\"\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<TemplatePartItemMore\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</div>\n\t);\n}\n\nexport default function TemplateAreas( { closeTemplateDetailsDropdown } ) {\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<MenuGroup\n\t\t\tlabel={ __( 'Areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t<TemplatePartItem\n\t\t\t\t\tkey={ templatePart.slug }\n\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -51,11 +51,13 @@ var _coreData = require("@wordpress/core-data");
|
|
|
51
51
|
|
|
52
52
|
var _editor = require("@wordpress/editor");
|
|
53
53
|
|
|
54
|
+
var _viewport = require("@wordpress/viewport");
|
|
55
|
+
|
|
54
56
|
require("./plugins");
|
|
55
57
|
|
|
56
58
|
require("./hooks");
|
|
57
59
|
|
|
58
|
-
require("./store");
|
|
60
|
+
var _store = require("./store");
|
|
59
61
|
|
|
60
62
|
var _editor2 = _interopRequireDefault(require("./components/editor"));
|
|
61
63
|
|
|
@@ -140,7 +142,11 @@ function initializeList(id, templateType, settings) {
|
|
|
140
142
|
(0, _data.dispatch)(_editor.store).updateEditorSettings({
|
|
141
143
|
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
142
144
|
defaultTemplatePartAreas: settings.defaultTemplatePartAreas
|
|
143
|
-
});
|
|
145
|
+
}); // Default the navigation panel to be opened when we're in a bigger screen.
|
|
146
|
+
// We update the store synchronously before rendering so that we won't
|
|
147
|
+
// trigger an unnecessary re-render with useEffect.
|
|
148
|
+
|
|
149
|
+
(0, _data.dispatch)(_store.store).setIsNavigationPanelOpened((0, _data.select)(_viewport.store).isViewportMatch('medium'));
|
|
144
150
|
(0, _element.render)((0, _element.createElement)(_list.default, {
|
|
145
151
|
templateType: templateType
|
|
146
152
|
}), target);
|