@wordpress/edit-site 3.0.11 → 3.0.15
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 -17
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +41 -22
- 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/global-styles/color-palette-panel.js +4 -4
- package/build/components/global-styles/color-palette-panel.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/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 +18 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +58 -67
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -11
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +28 -11
- 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 +6 -2
- 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 -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 +40 -23
- 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/global-styles/color-palette-panel.js +5 -5
- package/build-module/components/global-styles/color-palette-panel.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/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 +15 -3
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +60 -69
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +11 -12
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +26 -12
- 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 +5 -2
- 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 -17
- package/src/components/add-new-template/new-template.js +39 -19
- package/src/components/block-editor/index.js +2 -0
- package/src/components/global-styles/color-palette-panel.js +5 -5
- 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/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 +27 -11
- package/src/components/list/style.scss +106 -11
- package/src/components/list/table.js +65 -75
- package/src/components/navigation-sidebar/index.js +9 -16
- package/src/components/navigation-sidebar/navigation-panel/index.js +25 -9
- 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 +13 -8
- 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
|
@@ -9,6 +9,8 @@ exports.default = List;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
12
14
|
var _coreData = require("@wordpress/core-data");
|
|
13
15
|
|
|
14
16
|
var _data = require("@wordpress/data");
|
|
@@ -19,6 +21,8 @@ var _i18n = require("@wordpress/i18n");
|
|
|
19
21
|
|
|
20
22
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
21
23
|
|
|
24
|
+
var _editor = require("@wordpress/editor");
|
|
25
|
+
|
|
22
26
|
var _useRegisterShortcuts = _interopRequireDefault(require("./use-register-shortcuts"));
|
|
23
27
|
|
|
24
28
|
var _header = _interopRequireDefault(require("./header"));
|
|
@@ -27,6 +31,12 @@ var _navigationSidebar = _interopRequireDefault(require("../navigation-sidebar")
|
|
|
27
31
|
|
|
28
32
|
var _table = _interopRequireDefault(require("./table"));
|
|
29
33
|
|
|
34
|
+
var _store = require("../../store");
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* External dependencies
|
|
38
|
+
*/
|
|
39
|
+
|
|
30
40
|
/**
|
|
31
41
|
* WordPress dependencies
|
|
32
42
|
*/
|
|
@@ -43,11 +53,13 @@ function List(_ref) {
|
|
|
43
53
|
(0, _useRegisterShortcuts.default)();
|
|
44
54
|
const {
|
|
45
55
|
previousShortcut,
|
|
46
|
-
nextShortcut
|
|
56
|
+
nextShortcut,
|
|
57
|
+
isNavigationOpen
|
|
47
58
|
} = (0, _data.useSelect)(select => {
|
|
48
59
|
return {
|
|
49
60
|
previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
|
|
50
|
-
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-site/next-region')
|
|
61
|
+
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-site/next-region'),
|
|
62
|
+
isNavigationOpen: select(_store.store).isNavigationOpened()
|
|
51
63
|
};
|
|
52
64
|
}, []);
|
|
53
65
|
const postType = (0, _data.useSelect)(select => select(_coreData.store).getPostType(templateType), [templateType]); // `postType` could load in asynchronously. Only provide the detailed region labels if
|
|
@@ -61,7 +73,9 @@ function List(_ref) {
|
|
|
61
73
|
(0, _i18n.__)('%s - Content'), itemsListLabel)
|
|
62
74
|
} : undefined;
|
|
63
75
|
return (0, _element.createElement)(_interface.InterfaceSkeleton, {
|
|
64
|
-
className:
|
|
76
|
+
className: (0, _classnames.default)('edit-site-list', {
|
|
77
|
+
'is-navigation-open': isNavigationOpen
|
|
78
|
+
}),
|
|
65
79
|
labels: {
|
|
66
80
|
drawer: (0, _i18n.__)('Navigation Sidebar'),
|
|
67
81
|
...detailedRegionLabels
|
|
@@ -73,6 +87,7 @@ function List(_ref) {
|
|
|
73
87
|
activeTemplateType: templateType,
|
|
74
88
|
isDefaultOpen: true
|
|
75
89
|
}),
|
|
90
|
+
notices: (0, _element.createElement)(_editor.EditorSnackbars, null),
|
|
76
91
|
content: (0, _element.createElement)("main", {
|
|
77
92
|
className: "edit-site-list-main"
|
|
78
93
|
}, (0, _element.createElement)(_table.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/index.js"],"names":["List","templateType","previousShortcut","nextShortcut","select","keyboardShortcutsStore","getAllShortcutKeyCombinations","postType","coreStore","getPostType","itemsListLabel","labels","items_list","detailedRegionLabels","header","body","undefined","drawer","previous","next"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/index.js"],"names":["List","templateType","previousShortcut","nextShortcut","isNavigationOpen","select","keyboardShortcutsStore","getAllShortcutKeyCombinations","editSiteStore","isNavigationOpened","postType","coreStore","getPostType","itemsListLabel","labels","items_list","detailedRegionLabels","header","body","undefined","drawer","previous","next"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAOe,SAASA,IAAT,OAAkC;AAAA;;AAAA,MAAnB;AAAEC,IAAAA;AAAF,GAAmB;AAChD;AAEA,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA,YAApB;AAAkCC,IAAAA;AAAlC,MAAuD,qBAC1DC,MAAF,IAAc;AACb,WAAO;AACNH,MAAAA,gBAAgB,EAAEG,MAAM,CACvBC,wBADuB,CAAN,CAEhBC,6BAFgB,CAGjB,gCAHiB,CADZ;AAMNJ,MAAAA,YAAY,EAAEE,MAAM,CACnBC,wBADmB,CAAN,CAEZC,6BAFY,CAEmB,4BAFnB,CANR;AASNH,MAAAA,gBAAgB,EAAEC,MAAM,CAAEG,YAAF,CAAN,CAAwBC,kBAAxB;AATZ,KAAP;AAWA,GAb2D,EAc5D,EAd4D,CAA7D;AAiBA,QAAMC,QAAQ,GAAG,qBACdL,MAAF,IAAcA,MAAM,CAAEM,eAAF,CAAN,CAAoBC,WAApB,CAAiCX,YAAjC,CADE,EAEhB,CAAEA,YAAF,CAFgB,CAAjB,CApBgD,CAyBhD;AACA;;AACA,QAAMY,cAAc,GAAGH,QAAH,aAAGA,QAAH,2CAAGA,QAAQ,CAAEI,MAAb,qDAAG,iBAAkBC,UAAzC;AACA,QAAMC,oBAAoB,GAAGN,QAAQ,GAClC;AACAO,IAAAA,MAAM,EAAE,oBACP;AACA,kBAAI,aAAJ,CAFO,EAGPJ,cAHO,CADR;AAMAK,IAAAA,IAAI,EAAE,oBACL;AACA,kBAAI,cAAJ,CAFK,EAGLL,cAHK;AANN,GADkC,GAalCM,SAbH;AAeA,SACC,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAG,yBAAY,gBAAZ,EAA8B;AACzC,4BAAsBf;AADmB,KAA9B,CADb;AAIC,IAAA,MAAM,EAAG;AACRgB,MAAAA,MAAM,EAAE,cAAI,oBAAJ,CADA;AAER,SAAGJ;AAFK,KAJV;AAQC,IAAA,MAAM,EAAG,4BAAC,eAAD;AAAQ,MAAA,YAAY,EAAGf;AAAvB,MARV;AASC,IAAA,MAAM,EACL,4BAAC,0BAAD;AACC,MAAA,kBAAkB,EAAGA,YADtB;AAEC,MAAA,aAAa;AAFd,MAVF;AAeC,IAAA,OAAO,EAAG,4BAAC,uBAAD,OAfX;AAgBC,IAAA,OAAO,EACN;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,4BAAC,cAAD;AAAO,MAAA,YAAY,EAAGA;AAAtB,MADD,CAjBF;AAqBC,IAAA,SAAS,EAAG;AACXoB,MAAAA,QAAQ,EAAEnB,gBADC;AAEXoB,MAAAA,IAAI,EAAEnB;AAFK;AArBb,IADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { InterfaceSkeleton } from '@wordpress/interface';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { EditorSnackbars } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useRegisterShortcuts from './use-register-shortcuts';\nimport Header from './header';\nimport NavigationSidebar from '../navigation-sidebar';\nimport Table from './table';\nimport { store as editSiteStore } from '../../store';\n\nexport default function List( { templateType } ) {\n\tuseRegisterShortcuts();\n\n\tconst { previousShortcut, nextShortcut, isNavigationOpen } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tpreviousShortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t\t'core/edit-site/previous-region'\n\t\t\t\t),\n\t\t\t\tnextShortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst postType = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( templateType ),\n\t\t[ templateType ]\n\t);\n\n\t// `postType` could load in asynchronously. Only provide the detailed region labels if\n\t// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.\n\tconst itemsListLabel = postType?.labels?.items_list;\n\tconst detailedRegionLabels = postType\n\t\t? {\n\t\t\t\theader: sprintf(\n\t\t\t\t\t// translators: %s - the name of the page, 'Header' as in the header area of that page.\n\t\t\t\t\t__( '%s - Header' ),\n\t\t\t\t\titemsListLabel\n\t\t\t\t),\n\t\t\t\tbody: sprintf(\n\t\t\t\t\t// translators: %s - the name of the page, 'Content' as in the content area of that page.\n\t\t\t\t\t__( '%s - Content' ),\n\t\t\t\t\titemsListLabel\n\t\t\t\t),\n\t\t }\n\t\t: undefined;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tclassName={ classnames( 'edit-site-list', {\n\t\t\t\t'is-navigation-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\tdrawer: __( 'Navigation Sidebar' ),\n\t\t\t\t...detailedRegionLabels,\n\t\t\t} }\n\t\t\theader={ <Header templateType={ templateType } /> }\n\t\t\tdrawer={\n\t\t\t\t<NavigationSidebar\n\t\t\t\t\tactiveTemplateType={ templateType }\n\t\t\t\t\tisDefaultOpen\n\t\t\t\t/>\n\t\t\t}\n\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\tcontent={\n\t\t\t\t<main className=\"edit-site-list-main\">\n\t\t\t\t\t<Table templateType={ templateType } />\n\t\t\t\t</main>\n\t\t\t}\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -17,13 +17,11 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
17
|
|
|
18
18
|
var _components = require("@wordpress/components");
|
|
19
19
|
|
|
20
|
-
var _icons = require("@wordpress/icons");
|
|
21
|
-
|
|
22
20
|
var _url = require("@wordpress/url");
|
|
23
21
|
|
|
24
|
-
var
|
|
22
|
+
var _actions = _interopRequireDefault(require("./actions"));
|
|
25
23
|
|
|
26
|
-
var
|
|
24
|
+
var _addedBy = _interopRequireDefault(require("./added-by"));
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
27
|
* WordPress dependencies
|
|
@@ -32,26 +30,10 @@ var _isTemplateRemovable = _interopRequireDefault(require("../../utils/is-templa
|
|
|
32
30
|
/**
|
|
33
31
|
* Internal dependencies
|
|
34
32
|
*/
|
|
35
|
-
function
|
|
36
|
-
let {
|
|
37
|
-
template,
|
|
38
|
-
onClose
|
|
39
|
-
} = _ref;
|
|
40
|
-
const {
|
|
41
|
-
removeTemplate
|
|
42
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
43
|
-
return (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
44
|
-
onClick: () => {
|
|
45
|
-
removeTemplate(template);
|
|
46
|
-
onClose();
|
|
47
|
-
}
|
|
48
|
-
}, (0, _i18n.__)('Remove template')));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function Table(_ref2) {
|
|
33
|
+
function Table(_ref) {
|
|
52
34
|
let {
|
|
53
35
|
templateType
|
|
54
|
-
} =
|
|
36
|
+
} = _ref;
|
|
55
37
|
const {
|
|
56
38
|
templates,
|
|
57
39
|
isLoading,
|
|
@@ -63,8 +45,12 @@ function Table(_ref2) {
|
|
|
63
45
|
getPostType
|
|
64
46
|
} = select(_coreData.store);
|
|
65
47
|
return {
|
|
66
|
-
templates: getEntityRecords('postType', templateType
|
|
67
|
-
|
|
48
|
+
templates: getEntityRecords('postType', templateType, {
|
|
49
|
+
per_page: -1
|
|
50
|
+
}),
|
|
51
|
+
isLoading: !hasFinishedResolution('getEntityRecords', ['postType', templateType, {
|
|
52
|
+
per_page: -1
|
|
53
|
+
}]),
|
|
68
54
|
postType: getPostType(templateType)
|
|
69
55
|
};
|
|
70
56
|
}, [templateType]);
|
|
@@ -80,48 +66,53 @@ function Table(_ref2) {
|
|
|
80
66
|
(0, _i18n.__)('No %s found.'), postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : (_postType$labels$name = _postType$labels.name) === null || _postType$labels$name === void 0 ? void 0 : _postType$labels$name.toLowerCase()));
|
|
81
67
|
}
|
|
82
68
|
|
|
83
|
-
return (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
69
|
+
return (// These explicit aria roles are needed for Safari.
|
|
70
|
+
// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables
|
|
71
|
+
(0, _element.createElement)("table", {
|
|
72
|
+
className: "edit-site-list-table",
|
|
73
|
+
role: "table"
|
|
74
|
+
}, (0, _element.createElement)("thead", null, (0, _element.createElement)("tr", {
|
|
75
|
+
className: "edit-site-list-table-head",
|
|
76
|
+
role: "row"
|
|
77
|
+
}, (0, _element.createElement)("th", {
|
|
78
|
+
className: "edit-site-list-table-column",
|
|
79
|
+
role: "columnheader"
|
|
80
|
+
}, (0, _i18n.__)('Template')), (0, _element.createElement)("th", {
|
|
81
|
+
className: "edit-site-list-table-column",
|
|
82
|
+
role: "columnheader"
|
|
83
|
+
}, (0, _i18n.__)('Added by')), (0, _element.createElement)("th", {
|
|
84
|
+
className: "edit-site-list-table-column",
|
|
85
|
+
role: "columnheader"
|
|
86
|
+
}, (0, _element.createElement)(_components.VisuallyHidden, null, (0, _i18n.__)('Actions'))))), (0, _element.createElement)("tbody", null, templates.map(template => {
|
|
87
|
+
var _template$title;
|
|
88
|
+
|
|
89
|
+
return (0, _element.createElement)("tr", {
|
|
90
|
+
key: template.id,
|
|
91
|
+
className: "edit-site-list-table-row",
|
|
92
|
+
role: "row"
|
|
93
|
+
}, (0, _element.createElement)("td", {
|
|
94
|
+
className: "edit-site-list-table-column",
|
|
95
|
+
role: "cell"
|
|
96
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
97
|
+
level: 4
|
|
98
|
+
}, (0, _element.createElement)("a", {
|
|
99
|
+
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
100
|
+
postId: template.id,
|
|
101
|
+
postType: template.type
|
|
102
|
+
})
|
|
103
|
+
}, ((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug)), template.description), (0, _element.createElement)("td", {
|
|
104
|
+
className: "edit-site-list-table-column",
|
|
105
|
+
role: "cell"
|
|
106
|
+
}, (0, _element.createElement)(_addedBy.default, {
|
|
107
|
+
templateType: templateType,
|
|
108
|
+
template: template
|
|
109
|
+
})), (0, _element.createElement)("td", {
|
|
110
|
+
className: "edit-site-list-table-column",
|
|
111
|
+
role: "cell"
|
|
112
|
+
}, (0, _element.createElement)(_actions.default, {
|
|
113
|
+
template: template
|
|
114
|
+
})));
|
|
115
|
+
})))
|
|
116
|
+
);
|
|
126
117
|
}
|
|
127
118
|
//# sourceMappingURL=table.js.map
|
|
@@ -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":"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","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"]}
|
|
@@ -14,6 +14,10 @@ var _components = require("@wordpress/components");
|
|
|
14
14
|
|
|
15
15
|
var _compose = require("@wordpress/compose");
|
|
16
16
|
|
|
17
|
+
var _data = require("@wordpress/data");
|
|
18
|
+
|
|
19
|
+
var _store = require("../../store");
|
|
20
|
+
|
|
17
21
|
var _navigationPanel = _interopRequireDefault(require("./navigation-panel"));
|
|
18
22
|
|
|
19
23
|
var _navigationToggle = _interopRequireDefault(require("./navigation-toggle"));
|
|
@@ -38,25 +42,22 @@ function NavigationSidebar(_ref) {
|
|
|
38
42
|
activeTemplateType
|
|
39
43
|
} = _ref;
|
|
40
44
|
const isDesktopViewport = (0, _compose.useViewportMatch)('medium');
|
|
41
|
-
const
|
|
45
|
+
const {
|
|
46
|
+
setIsNavigationPanelOpened
|
|
47
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
42
48
|
(0, _element.useEffect)(() => {
|
|
43
49
|
// When transitioning to desktop open the navigation if `isDefaultOpen` is true.
|
|
44
50
|
if (isDefaultOpen && isDesktopViewport) {
|
|
45
|
-
|
|
51
|
+
setIsNavigationPanelOpened(true);
|
|
46
52
|
} // When transitioning to mobile/tablet, close the navigation.
|
|
47
53
|
|
|
48
54
|
|
|
49
55
|
if (!isDesktopViewport) {
|
|
50
|
-
|
|
56
|
+
setIsNavigationPanelOpened(false);
|
|
51
57
|
}
|
|
52
|
-
}, [isDefaultOpen, isDesktopViewport]);
|
|
53
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_navigationToggle.default, {
|
|
54
|
-
|
|
55
|
-
setIsOpen: setIsNavigationOpen
|
|
56
|
-
}), (0, _element.createElement)(_navigationPanel.default, {
|
|
57
|
-
isOpen: isNavigationOpen,
|
|
58
|
-
setIsOpen: setIsNavigationOpen,
|
|
59
|
-
activeTemplateType: activeTemplateType
|
|
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
|
|
60
61
|
}), (0, _element.createElement)(NavigationPanelPreviewSlot, null));
|
|
61
62
|
}
|
|
62
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","isDefaultOpen","activeTemplateType","isDesktopViewport","
|
|
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,12 +105,15 @@ 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'),
|
|
110
|
+
item: SITE_EDITOR_KEY,
|
|
96
111
|
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
97
112
|
postId: undefined,
|
|
98
113
|
postType: undefined
|
|
99
114
|
})
|
|
100
115
|
}), (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
116
|
+
icon: _icons.layout,
|
|
101
117
|
title: (0, _i18n.__)('Templates'),
|
|
102
118
|
item: "wp_template",
|
|
103
119
|
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
@@ -105,6 +121,7 @@ const NavigationPanel = _ref => {
|
|
|
105
121
|
postType: 'wp_template'
|
|
106
122
|
})
|
|
107
123
|
}), (0, _element.createElement)(_components.__experimentalNavigationItem, {
|
|
124
|
+
icon: _icons.symbolFilled,
|
|
108
125
|
title: (0, _i18n.__)('Template Parts'),
|
|
109
126
|
item: "wp_template_part",
|
|
110
127
|
href: (0, _url.addQueryArgs)(window.location.href, {
|
|
@@ -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;AACA;AACD,GAJD,EAIG,CAAEd,UAAF,EAAcC,gBAAd,CAJH;;AAMA,QAAMc,aAAa,GAAKC,KAAF,IAAa;AAClC,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3DH,MAAAA,KAAK,CAACI,cAAN;AACAT,MAAAA,0BAA0B,CAAE,KAAF,CAA1B;AACA;AACD,GALD;;AAOA,SACC;AACA;AACC,MAAA,SAAS,EAAG,yBAAa,4BAAb,EAA0C;AACrD,mBAAWV;AAD0C,OAA1C,CADb;AAIC,MAAA,GAAG,EAAGW,QAJP;AAKC,MAAA,QAAQ,EAAC,IALV;AAMC,MAAA,SAAS,EAAGG;AANb,OAQC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACG,kCAAgBb,SAAhB,CADH,CADD,CADD,EAMC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,oCAAD;AAAY,MAAA,UAAU,EAAGF;AAAzB,OACC,4BAAC,4BAAD,CAAqB,IAArB,QACC,4BAAC,8CAAD;AACC,MAAA,eAAe,EAAG,cAAI,WAAJ,CADnB;AAEC,MAAA,SAAS,EAAC,+CAFX;AAGC,MAAA,IAAI,EAAC;AAHN,MADD,CADD,EASC,4BAAC,wCAAD,QACC,4BAAC,yCAAD;AAAiB,MAAA,KAAK,EAAG,cAAI,QAAJ;AAAzB,OACC,4BAAC,wCAAD;AACC,MAAA,IAAI,EAAGqB,WADR;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGvB,eAHR;AAIC,MAAA,IAAI,EAAG,uBAAcwB,MAAM,CAACC,QAAP,CAAgBC,IAA9B,EAAoC;AAC1CC,QAAAA,MAAM,EAAElB,SADkC;AAE1CmB,QAAAA,QAAQ,EAAEnB;AAFgC,OAApC;AAJR,MADD,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,MAAAA,gBAAgB,EAAEG,MAAM,CAAEM,YAAF,CAAN,CAAwBC,kBAAxB,EADZ;AAENT,MAAAA,oBAAoB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CAC7D,MAD6D,EAE7D,gBAF6D,EAG7DG,SAH6D,CAA7B,CAF3B;AAONN,MAAAA,WAAW,EAAEK,QAAQ,CAACI;AAPhB,KAAP;AASA,GAf8D,EAgB/D,EAhB+D,CAAhE;AAkBA,QAAM;AAAEC,IAAAA;AAAF,MAAiC,uBAAaH,YAAb,CAAvC;AAEA,QAAMI,aAAa,GAAG,gCAAtB;;AAEA,QAAMC,qBAAqB,GAAG,MAC7BF,0BAA0B,CAAE,CAAEZ,gBAAJ,CAD3B;;AAGA,MAAIe,UAAU,GAAG,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,MAAX;AAAkB,IAAA,IAAI,EAAGC;AAAzB,IAAjB;AAEA,QAAMC,MAAM,GAAG;AACdC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,GADA;AAEPC,MAAAA,YAAY,EAAE,CAFP;AAGPC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,IAAI,EAAE,OAAR;AAAiBC,QAAAA,QAAQ,EAAE;AAA3B;AAHL;AADM,GAAf;;AAQA,MAAKrB,WAAL,EAAmB;AAClBa,IAAAA,UAAU,GACT,4BAAC,4BAAD,CAAQ,GAAR;AACC,MAAA,QAAQ,EAAG,CAAEF,aAAF,IAAmBI,MAD/B;AAEC,MAAA,GAAG,EAAG,cAAI,WAAJ,CAFP;AAGC,MAAA,SAAS,EAAC,wCAHX;AAIC,MAAA,GAAG,EAAGf;AAJP,MADD;AAQA,GATD,MASO,IAAKD,oBAAL,EAA4B;AAClCc,IAAAA,UAAU,GAAG,IAAb;AACA,GAFM,MAEA,IAAKhB,IAAL,EAAY;AAClBgB,IAAAA,UAAU,GAAG,4BAAC,gBAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,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"]}
|