@wordpress/edit-site 5.3.4 → 5.3.6
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/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +3 -6
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/editor/index.js +3 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/screen-border.js +1 -1
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +5 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +41 -42
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/table.js +3 -2
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +4 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-button/index.js +5 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +28 -35
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +10 -10
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +17 -16
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +9 -19
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +25 -15
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +17 -2
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +7 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/index.js +10 -22
- package/build/index.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +3 -6
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/editor/index.js +3 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +1 -1
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +3 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +43 -44
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/table.js +3 -2
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +25 -35
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -11
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +16 -17
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +8 -18
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -16
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +17 -3
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +63 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +7 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/index.js +12 -22
- package/build-module/index.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +41 -38
- package/build-style/style.css +41 -38
- package/package.json +21 -21
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/add-new-template/style.scss +0 -5
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +4 -3
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/screen-border.js +1 -1
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.scss +8 -1
- package/src/components/list/added-by.js +48 -55
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +4 -5
- package/src/components/navigation-inspector/navigation-menu.js +8 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +34 -29
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +23 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-screen/index.js +31 -38
- package/src/components/sidebar-navigation-screen/style.scss +1 -9
- package/src/components/sidebar-navigation-screen-main/index.js +3 -3
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +24 -20
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +0 -2
- package/src/components/sidebar-navigation-screen-template/index.js +7 -19
- package/src/components/sidebar-navigation-screen-templates/index.js +22 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
- package/src/components/style-book/index.js +25 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +72 -17
- package/src/components/template-details/index.js +5 -6
- package/src/index.js +6 -21
- package/src/style.scss +1 -0
- package/src/utils/get-is-list-page.js +1 -1
|
@@ -8,41 +8,25 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { __experimentalHStack as HStack, Icon
|
|
11
|
+
import { __experimentalHStack as HStack, Icon } from '@wordpress/components';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
14
|
import { useState } from '@wordpress/element';
|
|
15
15
|
import { commentAuthorAvatar as authorIcon, layout as themeIcon, plugins as pluginIcon, globe as globeIcon } from '@wordpress/icons';
|
|
16
|
-
import {
|
|
16
|
+
import { _x } from '@wordpress/i18n';
|
|
17
17
|
const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part'];
|
|
18
18
|
|
|
19
|
-
function
|
|
20
|
-
let {
|
|
21
|
-
isCustomized,
|
|
22
|
-
children
|
|
23
|
-
} = _ref;
|
|
24
|
-
|
|
25
|
-
if (!isCustomized) {
|
|
26
|
-
return children;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return createElement(Tooltip, {
|
|
30
|
-
text: __('This template has been customized')
|
|
31
|
-
}, children);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function BaseAddedBy(_ref2) {
|
|
19
|
+
function BaseAddedBy(_ref) {
|
|
35
20
|
let {
|
|
36
21
|
text,
|
|
37
22
|
icon,
|
|
38
23
|
imageUrl,
|
|
39
|
-
isCustomized
|
|
40
|
-
|
|
24
|
+
isCustomized,
|
|
25
|
+
templateType
|
|
26
|
+
} = _ref;
|
|
41
27
|
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
42
28
|
return createElement(HStack, {
|
|
43
29
|
alignment: "left"
|
|
44
|
-
}, createElement(CustomizedTooltip, {
|
|
45
|
-
isCustomized: isCustomized
|
|
46
30
|
}, imageUrl ? createElement("div", {
|
|
47
31
|
className: classnames('edit-site-list-added-by__avatar', {
|
|
48
32
|
'is-loaded': isImageLoaded
|
|
@@ -52,57 +36,66 @@ function BaseAddedBy(_ref2) {
|
|
|
52
36
|
alt: "",
|
|
53
37
|
src: imageUrl
|
|
54
38
|
})) : createElement("div", {
|
|
55
|
-
className:
|
|
56
|
-
'is-customized': isCustomized
|
|
57
|
-
})
|
|
39
|
+
className: "edit-site-list-added-by__icon"
|
|
58
40
|
}, createElement(Icon, {
|
|
59
41
|
icon: icon
|
|
60
|
-
}))
|
|
42
|
+
})), createElement("span", null, text, isCustomized && createElement("span", {
|
|
43
|
+
className: "edit-site-list-added-by__customized-info"
|
|
44
|
+
}, templateType === 'wp_template' ? _x('Customized', 'template') : _x('Customized', 'template part'))));
|
|
61
45
|
}
|
|
62
46
|
|
|
63
|
-
function AddedByTheme(
|
|
47
|
+
function AddedByTheme(_ref2) {
|
|
64
48
|
var _theme$name;
|
|
65
49
|
|
|
66
50
|
let {
|
|
67
51
|
slug,
|
|
68
|
-
isCustomized
|
|
69
|
-
|
|
52
|
+
isCustomized,
|
|
53
|
+
templateType
|
|
54
|
+
} = _ref2;
|
|
70
55
|
const theme = useSelect(select => select(coreStore).getTheme(slug), [slug]);
|
|
71
56
|
return createElement(BaseAddedBy, {
|
|
72
57
|
icon: themeIcon,
|
|
73
58
|
text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug,
|
|
74
|
-
isCustomized: isCustomized
|
|
59
|
+
isCustomized: isCustomized,
|
|
60
|
+
templateType: templateType
|
|
75
61
|
});
|
|
76
62
|
}
|
|
77
63
|
|
|
78
|
-
function AddedByPlugin(
|
|
64
|
+
function AddedByPlugin(_ref3) {
|
|
79
65
|
let {
|
|
80
66
|
slug,
|
|
81
|
-
isCustomized
|
|
82
|
-
|
|
67
|
+
isCustomized,
|
|
68
|
+
templateType
|
|
69
|
+
} = _ref3;
|
|
83
70
|
const plugin = useSelect(select => select(coreStore).getPlugin(slug), [slug]);
|
|
84
71
|
return createElement(BaseAddedBy, {
|
|
85
72
|
icon: pluginIcon,
|
|
86
73
|
text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug,
|
|
87
|
-
isCustomized: isCustomized
|
|
74
|
+
isCustomized: isCustomized,
|
|
75
|
+
templateType: templateType
|
|
88
76
|
});
|
|
89
77
|
}
|
|
90
78
|
|
|
91
|
-
function AddedByAuthor(
|
|
79
|
+
function AddedByAuthor(_ref4) {
|
|
92
80
|
var _user$avatar_urls;
|
|
93
81
|
|
|
94
82
|
let {
|
|
95
|
-
id
|
|
96
|
-
|
|
83
|
+
id,
|
|
84
|
+
templateType
|
|
85
|
+
} = _ref4;
|
|
97
86
|
const user = useSelect(select => select(coreStore).getUser(id), [id]);
|
|
98
87
|
return createElement(BaseAddedBy, {
|
|
99
88
|
icon: authorIcon,
|
|
100
89
|
imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48],
|
|
101
|
-
text: user === null || user === void 0 ? void 0 : user.nickname
|
|
90
|
+
text: user === null || user === void 0 ? void 0 : user.nickname,
|
|
91
|
+
templateType: templateType
|
|
102
92
|
});
|
|
103
93
|
}
|
|
104
94
|
|
|
105
|
-
function AddedBySite() {
|
|
95
|
+
function AddedBySite(_ref5) {
|
|
96
|
+
let {
|
|
97
|
+
templateType
|
|
98
|
+
} = _ref5;
|
|
106
99
|
const {
|
|
107
100
|
name,
|
|
108
101
|
logoURL
|
|
@@ -122,7 +115,8 @@ function AddedBySite() {
|
|
|
122
115
|
return createElement(BaseAddedBy, {
|
|
123
116
|
icon: globeIcon,
|
|
124
117
|
imageUrl: logoURL,
|
|
125
|
-
text: name
|
|
118
|
+
text: name,
|
|
119
|
+
templateType: templateType
|
|
126
120
|
});
|
|
127
121
|
}
|
|
128
122
|
|
|
@@ -144,7 +138,8 @@ export default function AddedBy(_ref6) {
|
|
|
144
138
|
if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) {
|
|
145
139
|
return createElement(AddedByTheme, {
|
|
146
140
|
slug: template.theme,
|
|
147
|
-
isCustomized: template.source === 'custom'
|
|
141
|
+
isCustomized: template.source === 'custom',
|
|
142
|
+
templateType: templateType
|
|
148
143
|
});
|
|
149
144
|
} // Template originally provided by a plugin, but customized by a user.
|
|
150
145
|
|
|
@@ -152,7 +147,8 @@ export default function AddedBy(_ref6) {
|
|
|
152
147
|
if (template.has_theme_file && template.origin === 'plugin') {
|
|
153
148
|
return createElement(AddedByPlugin, {
|
|
154
149
|
slug: template.theme,
|
|
155
|
-
isCustomized: template.source === 'custom'
|
|
150
|
+
isCustomized: template.source === 'custom',
|
|
151
|
+
templateType: templateType
|
|
156
152
|
});
|
|
157
153
|
} // Template was created from scratch, but has no author. Author support
|
|
158
154
|
// was only added to templates in WordPress 5.9. Fallback to showing the
|
|
@@ -160,14 +156,17 @@ export default function AddedBy(_ref6) {
|
|
|
160
156
|
|
|
161
157
|
|
|
162
158
|
if (!template.has_theme_file && template.source === 'custom' && !template.author) {
|
|
163
|
-
return createElement(AddedBySite,
|
|
159
|
+
return createElement(AddedBySite, {
|
|
160
|
+
templateType: templateType
|
|
161
|
+
});
|
|
164
162
|
}
|
|
165
163
|
} // Simply show the author for templates created from scratch that have an
|
|
166
164
|
// author or for any other post type.
|
|
167
165
|
|
|
168
166
|
|
|
169
167
|
return createElement(AddedByAuthor, {
|
|
170
|
-
id: template.author
|
|
168
|
+
id: template.author,
|
|
169
|
+
templateType: templateType
|
|
171
170
|
});
|
|
172
171
|
}
|
|
173
172
|
//# sourceMappingURL=added-by.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["classnames","__experimentalHStack","HStack","Icon","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["classnames","__experimentalHStack","HStack","Icon","store","coreStore","useSelect","useState","commentAuthorAvatar","authorIcon","layout","themeIcon","plugins","pluginIcon","globe","globeIcon","_x","TEMPLATE_POST_TYPE_NAMES","BaseAddedBy","text","icon","imageUrl","isCustomized","templateType","isImageLoaded","setIsImageLoaded","AddedByTheme","slug","theme","select","getTheme","name","rendered","AddedByPlugin","plugin","getPlugin","AddedByAuthor","id","user","getUser","avatar_urls","nickname","AddedBySite","logoURL","getEntityRecord","getMedia","siteData","site_logo","source_url","undefined","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,IAAAA,YAAF;AAAgB4B,IAAAA;AAAhB,GAA6B;;AAC7D,MAAK,CAAEA,QAAP,EAAkB;AACjB;AACA;;AAED,MAAKlC,wBAAwB,CAACmC,QAAzB,CAAmC7B,YAAnC,CAAL,EAAyD;AACxD;AACA;AACA;AACA;AACA,QACC4B,QAAQ,CAACE,cAAT,KACEF,QAAQ,CAACG,MAAT,KAAoB,OAApB,IACC,CAAEH,QAAQ,CAACG,MAAX,IACD,CAAE,OAAF,EAAW,QAAX,EAAsBF,QAAtB,CAAgCD,QAAQ,CAACI,MAAzC,CAHF,CADD,EAKE;AACD,aACC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGJ,QAAQ,CAACvB,KADjB;AAEC,QAAA,YAAY,EAAGuB,QAAQ,CAACI,MAAT,KAAoB,QAFpC;AAGC,QAAA,YAAY,EAAGhC;AAHhB,QADD;AAOA,KAlBuD,CAoBxD;;;AACA,QAAK4B,QAAQ,CAACE,cAAT,IAA2BF,QAAQ,CAACG,MAAT,KAAoB,QAApD,EAA+D;AAC9D,aACC,cAAC,aAAD;AACC,QAAA,IAAI,EAAGH,QAAQ,CAACvB,KADjB;AAEC,QAAA,YAAY,EAAGuB,QAAQ,CAACI,MAAT,KAAoB,QAFpC;AAGC,QAAA,YAAY,EAAGhC;AAHhB,QADD;AAOA,KA7BuD,CA+BxD;AACA;AACA;;;AACA,QACC,CAAE4B,QAAQ,CAACE,cAAX,IACAF,QAAQ,CAACI,MAAT,KAAoB,QADpB,IAEA,CAAEJ,QAAQ,CAACK,MAHZ,EAIE;AACD,aAAO,cAAC,WAAD;AAAa,QAAA,YAAY,EAAGjC;AAA5B,QAAP;AACA;AACD,GA9C4D,CAgD7D;AACA;;;AACA,SACC,cAAC,aAAD;AAAe,IAAA,EAAE,EAAG4B,QAAQ,CAACK,MAA7B;AAAsC,IAAA,YAAY,EAAGjC;AAArD,IADD;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport {\n\tcommentAuthorAvatar as authorIcon,\n\tlayout as themeIcon,\n\tplugins as pluginIcon,\n\tglobe as globeIcon,\n} from '@wordpress/icons';\nimport { _x } from '@wordpress/i18n';\n\nconst TEMPLATE_POST_TYPE_NAMES = [ 'wp_template', 'wp_template_part' ];\n\nfunction BaseAddedBy( { text, icon, imageUrl, isCustomized, templateType } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t{ imageUrl ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-site-list-added-by__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-list-added-by__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>\n\t\t\t\t{ text }\n\t\t\t\t{ isCustomized && (\n\t\t\t\t\t<span className=\"edit-site-list-added-by__customized-info\">\n\t\t\t\t\t\t{ templateType === 'wp_template'\n\t\t\t\t\t\t\t? _x( 'Customized', 'template' )\n\t\t\t\t\t\t\t: _x( 'Customized', 'template part' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByTheme( { slug, isCustomized, templateType } ) {\n\tconst theme = useSelect(\n\t\t( select ) => select( coreStore ).getTheme( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ themeIcon }\n\t\t\ttext={ theme?.name?.rendered || slug }\n\t\t\tisCustomized={ isCustomized }\n\t\t\ttemplateType={ templateType }\n\t\t/>\n\t);\n}\n\nfunction AddedByPlugin( { slug, isCustomized, templateType } ) {\n\tconst plugin = useSelect(\n\t\t( select ) => select( coreStore ).getPlugin( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ pluginIcon }\n\t\t\ttext={ plugin?.name || slug }\n\t\t\tisCustomized={ isCustomized }\n\t\t\ttemplateType={ templateType }\n\t\t/>\n\t);\n}\n\nfunction AddedByAuthor( { id, templateType } ) {\n\tconst user = useSelect(\n\t\t( select ) => select( coreStore ).getUser( id ),\n\t\t[ id ]\n\t);\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ authorIcon }\n\t\t\timageUrl={ user?.avatar_urls?.[ 48 ] }\n\t\t\ttext={ user?.nickname }\n\t\t\ttemplateType={ templateType }\n\t\t/>\n\t);\n}\n\nfunction AddedBySite( { templateType } ) {\n\tconst { name, logoURL } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getMedia } = select( coreStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tname: siteData?.name,\n\t\t\tlogoURL: siteData?.site_logo\n\t\t\t\t? getMedia( siteData.site_logo )?.source_url\n\t\t\t\t: undefined,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<BaseAddedBy\n\t\t\ticon={ globeIcon }\n\t\t\timageUrl={ logoURL }\n\t\t\ttext={ name }\n\t\t\ttemplateType={ templateType }\n\t\t/>\n\t);\n}\n\nexport default function AddedBy( { templateType, template } ) {\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tif ( TEMPLATE_POST_TYPE_NAMES.includes( templateType ) ) {\n\t\t// Template originally provided by a theme, but customized by a user.\n\t\t// Templates originally didn't have the 'origin' field so identify\n\t\t// older customized templates by checking for no origin and a 'theme'\n\t\t// or 'custom' source.\n\t\tif (\n\t\t\ttemplate.has_theme_file &&\n\t\t\t( template.origin === 'theme' ||\n\t\t\t\t( ! template.origin &&\n\t\t\t\t\t[ 'theme', 'custom' ].includes( template.source ) ) )\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<AddedByTheme\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t\ttemplateType={ templateType }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template originally provided by a plugin, but customized by a user.\n\t\tif ( template.has_theme_file && template.origin === 'plugin' ) {\n\t\t\treturn (\n\t\t\t\t<AddedByPlugin\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t\ttemplateType={ templateType }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template was created from scratch, but has no author. Author support\n\t\t// was only added to templates in WordPress 5.9. Fallback to showing the\n\t\t// site logo and title.\n\t\tif (\n\t\t\t! template.has_theme_file &&\n\t\t\ttemplate.source === 'custom' &&\n\t\t\t! template.author\n\t\t) {\n\t\t\treturn <AddedBySite templateType={ templateType } />;\n\t\t}\n\t}\n\n\t// Simply show the author for templates created from scratch that have an\n\t// author or for any other post type.\n\treturn (\n\t\t<AddedByAuthor id={ template.author } templateType={ templateType } />\n\t);\n}\n"]}
|
|
@@ -38,6 +38,8 @@ export default function Table(_ref) {
|
|
|
38
38
|
__('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()));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
const sortedTemplates = [...templates];
|
|
42
|
+
sortedTemplates.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
41
43
|
return (// These explicit aria roles are needed for Safari.
|
|
42
44
|
// See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables
|
|
43
45
|
createElement("table", {
|
|
@@ -55,7 +57,7 @@ export default function Table(_ref) {
|
|
|
55
57
|
}, __('Added by')), createElement("th", {
|
|
56
58
|
className: "edit-site-list-table-column",
|
|
57
59
|
role: "columnheader"
|
|
58
|
-
}, createElement(VisuallyHidden, null, __('Actions'))))), createElement("tbody", null,
|
|
60
|
+
}, createElement(VisuallyHidden, null, __('Actions'))))), createElement("tbody", null, sortedTemplates.map(template => {
|
|
59
61
|
var _template$title;
|
|
60
62
|
|
|
61
63
|
return createElement("tr", {
|
|
@@ -69,7 +71,6 @@ export default function Table(_ref) {
|
|
|
69
71
|
level: 4
|
|
70
72
|
}, createElement(Link, {
|
|
71
73
|
params: {
|
|
72
|
-
path: template.type === 'wp_template' ? '/templates/single' : '/template-parts/single',
|
|
73
74
|
postId: template.id,
|
|
74
75
|
postType: template.type
|
|
75
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["useSelect","store","coreStore","useEntityRecords","__","sprintf","VisuallyHidden","__experimentalHeading","Heading","decodeEntities","Link","Actions","AddedBy","Table","templateType","records","templates","isResolving","isLoading","per_page","postType","select","getPostType","length","labels","name","toLowerCase","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/table.js"],"names":["useSelect","store","coreStore","useEntityRecords","__","sprintf","VisuallyHidden","__experimentalHeading","Heading","decodeEntities","Link","Actions","AddedBy","Table","templateType","records","templates","isResolving","isLoading","per_page","postType","select","getPostType","length","labels","name","toLowerCase","sortedTemplates","sort","a","b","slug","localeCompare","map","template","id","postId","type","title","rendered","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,gBAA7B,QAAqD,sBAArD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAC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AS,QAAA,QAAQ,EAAGA;AAApB,QADD,CA5BD,CADsB;AAAA,KAArB,CADH,CAxBD;AAHD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Link from '../routes/link';\nimport Actions from './actions';\nimport AddedBy from './added-by';\n\nexport default function Table( { templateType } ) {\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\ttemplateType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst postType = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( templateType ),\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\tconst sortedTemplates = [ ...templates ];\n\tsortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );\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{ sortedTemplates.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<Link\n\t\t\t\t\t\t\t\t\tparams={ {\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{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t{ decodeEntities( 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"]}
|
|
@@ -26,7 +26,8 @@ export default function NavigationMenu(_ref) {
|
|
|
26
26
|
updateBlockListSettings
|
|
27
27
|
} = useDispatch(blockEditorStore);
|
|
28
28
|
const {
|
|
29
|
-
OffCanvasEditor
|
|
29
|
+
OffCanvasEditor,
|
|
30
|
+
LeafMoreMenu
|
|
30
31
|
} = unlock(blockEditorPrivateApis); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
|
|
31
32
|
//Think through a better way of doing this, possible with adding allowed blocks to block library metadata
|
|
32
33
|
|
|
@@ -44,7 +45,8 @@ export default function NavigationMenu(_ref) {
|
|
|
44
45
|
}, [updateBlockListSettings, innerBlocks]);
|
|
45
46
|
return createElement(OffCanvasEditor, {
|
|
46
47
|
blocks: innerBlocks,
|
|
47
|
-
onSelect: onSelect
|
|
48
|
+
onSelect: onSelect,
|
|
49
|
+
LeafMoreMenu: LeafMoreMenu
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
52
|
//# sourceMappingURL=navigation-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","useEffect","useDispatch","unlock","ALLOWED_BLOCKS","NavigationMenu","innerBlocks","onSelect","updateBlockListSettings","OffCanvasEditor","allowedBlocks","forEach","block","name","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAMC,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;AAuBA,eAAe,SAASC,cAAT,OAAqD;AAAA,MAA5B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAA4B;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAA8BN,WAAW,CAAEF,gBAAF,CAA/C;AAEA,QAAM;AAAES,IAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","useEffect","useDispatch","unlock","ALLOWED_BLOCKS","NavigationMenu","innerBlocks","onSelect","updateBlockListSettings","OffCanvasEditor","LeafMoreMenu","allowedBlocks","forEach","block","name","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAMC,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;AAuBA,eAAe,SAASC,cAAT,OAAqD;AAAA,MAA5B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAA4B;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAA8BN,WAAW,CAAEF,gBAAF,CAA/C;AAEA,QAAM;AAAES,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,MAAoCP,MAAM,CAAEL,sBAAF,CAAhD,CAHmE,CAKnE;AACA;;AACAG,EAAAA,SAAS,CAAE,MAAM;AAChBO,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BG,MAAAA,aAAa,EAAEP,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACM,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKT,cAAc,CAAES,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCN,QAAAA,uBAAuB,CAAEK,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAEP,cAAc,CAAES,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXQ,EAWN,CAAEN,uBAAF,EAA2BF,WAA3B,CAXM,CAAT;AAaA,SACC,cAAC,eAAD;AACC,IAAA,MAAM,EAAGA,WADV;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,YAAY,EAAGG;AAHhB,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst ALLOWED_BLOCKS = {\n\t'core/navigation': [\n\t\t'core/navigation-link',\n\t\t'core/search',\n\t\t'core/social-links',\n\t\t'core/page-list',\n\t\t'core/spacer',\n\t\t'core/home-link',\n\t\t'core/site-title',\n\t\t'core/site-logo',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/social-links': [ 'core/social-link' ],\n\t'core/navigation-submenu': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/navigation-link': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n};\n\nexport default function NavigationMenu( { innerBlocks, onSelect } ) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\t//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList\n\t//Think through a better way of doing this, possible with adding allowed blocks to block library metadata\n\tuseEffect( () => {\n\t\tupdateBlockListSettings( '', {\n\t\t\tallowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],\n\t\t} );\n\t\tinnerBlocks.forEach( ( block ) => {\n\t\t\tif ( ALLOWED_BLOCKS[ block.name ] ) {\n\t\t\t\tupdateBlockListSettings( block.clientId, {\n\t\t\t\t\tallowedBlocks: ALLOWED_BLOCKS[ block.name ],\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [ updateBlockListSettings, innerBlocks ] );\n\n\treturn (\n\t\t<OffCanvasEditor\n\t\t\tblocks={ innerBlocks }\n\t\t\tonSelect={ onSelect }\n\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -13,7 +13,10 @@ import { displayShortcut } from '@wordpress/keycodes';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { store as editSiteStore } from '../../store';
|
|
16
|
-
export default function SaveButton() {
|
|
16
|
+
export default function SaveButton(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
showTooltip = true
|
|
19
|
+
} = _ref;
|
|
17
20
|
const {
|
|
18
21
|
isDirty,
|
|
19
22
|
isSaving,
|
|
@@ -63,7 +66,7 @@ export default function SaveButton() {
|
|
|
63
66
|
& the tooltip is always rendered even when there's no keyboard shortcut.
|
|
64
67
|
*/
|
|
65
68
|
,
|
|
66
|
-
showTooltip:
|
|
69
|
+
showTooltip: showTooltip
|
|
67
70
|
}, label);
|
|
68
71
|
}
|
|
69
72
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["useSelect","useDispatch","Button","__","store","coreStore","displayShortcut","editSiteStore","SaveButton","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","isSaveViewOpened","length","some","record","kind","name","key","setIsSaveViewOpened","disabled","label","undefined","primary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,UAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["useSelect","useDispatch","Button","__","store","coreStore","displayShortcut","editSiteStore","SaveButton","showTooltip","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","isSaveViewOpened","length","some","record","kind","name","key","setIsSaveViewOpened","disabled","label","undefined","primary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAEA;AACA;AACA;;AACA,SAAS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AXE;AAYC,IAAA,QAAQ,EAAGD,QAAQ,GAAGE,SAAH,GAAerB,eAAe,CAACsB,OAAhB,CAAyB,GAAzB;AAClC;AACH;AACA;AACA;AACA;AACA;AAlBE;AAmBC,IAAA,WAAW,EAAGnB;AAnBf,KAqBGiB,KArBH,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function SaveButton( { showTooltip = true } ) {\n\tconst { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t),\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\tconst label = __( 'Save' );\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"primary\"\n\t\t\tclassName=\"edit-site-save-button__button\"\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"]}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import classnames from 'classnames';
|
|
3
7
|
/**
|
|
4
8
|
* WordPress dependencies
|
|
5
9
|
*/
|
|
10
|
+
|
|
6
11
|
import { Button, Modal } from '@wordpress/components';
|
|
7
12
|
import { EntitiesSavedStates } from '@wordpress/editor';
|
|
8
13
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -48,7 +53,9 @@ export default function SavePanel() {
|
|
|
48
53
|
}
|
|
49
54
|
|
|
50
55
|
return createElement(NavigableRegion, {
|
|
51
|
-
className:
|
|
56
|
+
className: classnames('edit-site-layout__actions', {
|
|
57
|
+
'is-entity-save-view-open': isSaveViewOpen
|
|
58
|
+
}),
|
|
52
59
|
ariaLabel: __('Save sidebar')
|
|
53
60
|
}, isSaveViewOpen ? createElement(EntitiesSavedStates, {
|
|
54
61
|
close: onClose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["Button","Modal","EntitiesSavedStates","useDispatch","useSelect","__","NavigableRegion","store","editSiteStore","unlock","SavePanel","isSaveViewOpen","canvasMode","select","isSaveViewOpened","getCanvasMode","setIsSaveViewOpened","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["classnames","Button","Modal","EntitiesSavedStates","useDispatch","useSelect","__","NavigableRegion","store","editSiteStore","unlock","SavePanel","isSaveViewOpen","canvasMode","select","isSaveViewOpened","getCanvasMode","setIsSaveViewOpened","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,KAAjB,QAA8B,uBAA9B;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,eAAT,QAAgC,sBAAhC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,eAAe,SAASC,SAAT,GAAqB;AACnC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAiCR,SAAS,CAAIS,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAAsCN,MAAM,CACjDI,MAAM,CAAEL,aAAF,CAD2C,CAAlD,CAD+D,CAK/D;AACA;;AACA,WAAO;AACNG,MAAAA,cAAc,EAAEG,gBAAgB,EAD1B;AAENF,MAAAA,UAAU,EAAEG,aAAa;AAFnB,KAAP;AAIA,GAX+C,EAW7C,EAX6C,CAAhD;AAYA,QAAM;AAAEC,IAAAA;AAAF,MAA0Bb,WAAW,CAAEK,aAAF,CAA3C;;AACA,QAAMS,OAAO,GAAG,MAAMD,mBAAmB,CAAE,KAAF,CAAzC;;AAEA,MAAKJ,UAAU,KAAK,MAApB,EAA6B;AAC5B,WAAOD,cAAc,GACpB,cAAC,KAAD;AACC,MAAA,SAAS,EAAC,6BADX;AAEC,MAAA,cAAc,EAAGM,OAFlB;AAGC,MAAA,wBAAwB,MAHzB;AAIC,MAAA,YAAY,EAAGZ,EAAE,CAChB,0CADgB;AAJlB,OAQC,cAAC,mBAAD;AAAqB,MAAA,KAAK,EAAGY;AAA7B,MARD,CADoB,GAWjB,IAXJ;AAYA;;AAED,SACC,cAAC,eAAD;AACC,IAAA,SAAS,EAAGlB,UAAU,CAAE,2BAAF,EAA+B;AACpD,kCAA4BY;AADwB,KAA/B,CADvB;AAIC,IAAA,SAAS,EAAGN,EAAE,CAAE,cAAF;AAJf,KAMGM,cAAc,GACf,cAAC,mBAAD;AAAqB,IAAA,KAAK,EAAGM;AAA7B,IADe,GAGf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,SAAS,EAAC,4CAFX;AAGC,IAAA,OAAO,EAAG,MAAMD,mBAAmB,CAAE,IAAF,CAHpC;AAIC,qBAAgB;AAJjB,KAMGX,EAAE,CAAE,iBAAF,CANL,CADD,CATF,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport { EntitiesSavedStates } from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {\n\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ classnames( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save sidebar' ) }\n\t\t>\n\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t<EntitiesSavedStates close={ onClose } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"]}
|
|
@@ -3,10 +3,8 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { memo } from '@wordpress/element';
|
|
7
|
-
import {
|
|
8
|
-
import { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { memo, useRef } from '@wordpress/element';
|
|
7
|
+
import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen } from '@wordpress/components';
|
|
10
8
|
/**
|
|
11
9
|
* Internal dependencies
|
|
12
10
|
*/
|
|
@@ -14,51 +12,43 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
14
12
|
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
|
|
15
13
|
import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
|
|
16
14
|
import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
|
|
17
|
-
import useSyncPathWithURL from '../sync-state-with-url/use-sync-path-with-url';
|
|
15
|
+
import useSyncPathWithURL, { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
|
|
18
16
|
import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
|
|
19
17
|
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
20
18
|
import SaveButton from '../save-button';
|
|
21
19
|
import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
|
|
20
|
+
import { useLocation } from '../routes';
|
|
22
21
|
|
|
23
22
|
function SidebarScreens() {
|
|
24
23
|
useSyncPathWithURL();
|
|
25
|
-
return createElement(Fragment, null, createElement(
|
|
26
|
-
|
|
27
|
-
}), createElement(
|
|
28
|
-
|
|
29
|
-
}), createElement(
|
|
30
|
-
|
|
31
|
-
}), createElement(
|
|
32
|
-
|
|
33
|
-
}), createElement(
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}));
|
|
24
|
+
return createElement(Fragment, null, createElement(NavigatorScreen, {
|
|
25
|
+
path: "/"
|
|
26
|
+
}, createElement(SidebarNavigationScreenMain, null)), createElement(NavigatorScreen, {
|
|
27
|
+
path: "/navigation"
|
|
28
|
+
}, createElement(SidebarNavigationScreenNavigationMenus, null)), createElement(NavigatorScreen, {
|
|
29
|
+
path: "/navigation/:postType/:postId"
|
|
30
|
+
}, createElement(SidebarNavigationScreenNavigationItem, null)), createElement(NavigatorScreen, {
|
|
31
|
+
path: "/:postType(wp_template|wp_template_part)"
|
|
32
|
+
}, createElement(SidebarNavigationScreenTemplates, null)), createElement(NavigatorScreen, {
|
|
33
|
+
path: "/:postType(wp_template|wp_template_part)/all"
|
|
34
|
+
}, createElement(SidebarNavigationScreenTemplatesBrowse, null)), createElement(NavigatorScreen, {
|
|
35
|
+
path: "/:postType(wp_template|wp_template_part)/:postId"
|
|
36
|
+
}, createElement(SidebarNavigationScreenTemplate, null)));
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
function Sidebar() {
|
|
41
40
|
const {
|
|
42
|
-
|
|
43
|
-
} =
|
|
44
|
-
|
|
45
|
-
__experimentalGetDirtyEntityRecords
|
|
46
|
-
} = select(coreStore);
|
|
47
|
-
|
|
48
|
-
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); // The currently selected entity to display.
|
|
49
|
-
// Typically template or template part in the site editor.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
isDirty: dirtyEntityRecords.length > 0
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
41
|
+
params: urlParams
|
|
42
|
+
} = useLocation();
|
|
43
|
+
const initialPath = useRef(getPathFromURL(urlParams));
|
|
56
44
|
return createElement(Fragment, null, createElement(NavigatorProvider, {
|
|
57
45
|
className: "edit-site-sidebar__content",
|
|
58
|
-
initialPath:
|
|
59
|
-
}, createElement(SidebarScreens, null)),
|
|
46
|
+
initialPath: initialPath.current
|
|
47
|
+
}, createElement(SidebarScreens, null)), createElement("div", {
|
|
60
48
|
className: "edit-site-sidebar__footer"
|
|
61
|
-
}, createElement(SaveButton,
|
|
49
|
+
}, createElement(SaveButton, {
|
|
50
|
+
showTooltip: false
|
|
51
|
+
})));
|
|
62
52
|
}
|
|
63
53
|
|
|
64
54
|
export default memo(Sidebar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenTemplatesBrowse","SaveButton","SidebarNavigationScreenNavigationItem","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,kBAAP,IACCC,cADD,QAEO,+CAFP;AAGA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;AACA,SAASC,WAAT,QAA4B,WAA5B;;AAEA,SAASC,cAAT,GAA0B;AACzBP,EAAAA,kBAAkB;AAElB,SACC,8BACC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,2BAAD,OADD,CADD,EAIC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAJD,EAOC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,qCAAD,OADD,CAPD,EAUC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,gCAAD,OADD,CAVD,EAaC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,sCAAD,OADD,CAbD,EAgBC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,cAAC,+BAAD,OADD,CAhBD,CADD;AAsBA;;AAED,SAASQ,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAAwBJ,WAAW,EAAzC;AACA,QAAMK,WAAW,GAAGnB,MAAM,CAAES,cAAc,CAAES,SAAF,CAAhB,CAA1B;AAEA,SACC,8BACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAGC,WAAW,CAACC;AAF3B,KAIC,cAAC,cAAD,OAJD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD;AAAY,IAAA,WAAW,EAAG;AAA1B,IADD,CARD,CADD;AAcA;;AAED,eAAerB,IAAI,CAAEiB,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveButton from '../save-button';\nimport SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';\nimport { useLocation } from '../routes';\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationItem />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\n\t\t\t<div className=\"edit-site-sidebar__footer\">\n\t\t\t\t<SaveButton showTooltip={ false } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* External dependencies
|
|
6
|
+
*/
|
|
7
|
+
import classnames from 'classnames';
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Button } from '@wordpress/components';
|
|
13
|
+
export default function SidebarButton(props) {
|
|
14
|
+
return createElement(Button, _extends({}, props, {
|
|
15
|
+
className: classnames('edit-site-sidebar-button', props.className)
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-button/index.js"],"names":["classnames","Button","SidebarButton","props","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AAEA,eAAe,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC9C,SACC,cAAC,MAAD,eACMA,KADN;AAEC,IAAA,SAAS,EAAGH,UAAU,CACrB,0BADqB,EAErBG,KAAK,CAACC,SAFe;AAFvB,KADD;AASA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\n\nexport default function SidebarButton( props ) {\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-button',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -31,9 +31,15 @@ export default function GlobalStylesSidebar() {
|
|
|
31
31
|
icon: styles,
|
|
32
32
|
closeLabel: __('Close Styles sidebar'),
|
|
33
33
|
panelClassName: "edit-site-global-styles-sidebar__panel",
|
|
34
|
-
header: createElement(Flex,
|
|
34
|
+
header: createElement(Flex, {
|
|
35
|
+
className: "edit-site-global-styles-sidebar__header"
|
|
36
|
+
}, createElement(FlexBlock, {
|
|
37
|
+
style: {
|
|
38
|
+
minWidth: 'min-content'
|
|
39
|
+
}
|
|
40
|
+
}, createElement("strong", null, __('Styles'))), createElement(FlexItem, null, createElement(Button, {
|
|
35
41
|
icon: seen,
|
|
36
|
-
label:
|
|
42
|
+
label: __('Style Book'),
|
|
37
43
|
isPressed: isStyleBookOpened,
|
|
38
44
|
disabled: editorMode !== 'visual',
|
|
39
45
|
onClick: () => {
|