@wordpress/edit-site 3.0.15 → 3.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template-part.js +29 -18
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +30 -23
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +51 -0
- package/build/components/app/index.js.map +1 -0
- package/build/components/block-editor/back-button.js +8 -20
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/index.js +2 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +0 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +20 -8
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +11 -30
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +10 -10
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/document-actions/index.js +3 -6
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/list/index.js +17 -15
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +4 -4
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -13
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +26 -24
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/routes/index.js +60 -0
- package/build/components/routes/index.js.map +1 -0
- package/build/components/routes/link.js +65 -0
- package/build/components/routes/link.js.map +1 -0
- package/build/components/routes/use-title.js +57 -0
- package/build/components/routes/use-title.js.map +1 -0
- package/build/components/sidebar/global-styles-sidebar.js +10 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +7 -4
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/index.js +12 -10
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +27 -10
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/url-query-controller/index.js +41 -50
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -0
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +1 -28
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +18 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +29 -35
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +3 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/site-export.js +61 -0
- package/build/plugins/site-export.js.map +1 -0
- package/build/plugins/welcome-guide-menu-item.js +1 -7
- package/build/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build/store/actions.js +0 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -14
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +7 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -31
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +23 -0
- package/build/utils/get-is-list-page.js.map +1 -0
- package/build/utils/history.js +35 -0
- package/build/utils/history.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +27 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +28 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +35 -0
- package/build-module/components/app/index.js.map +1 -0
- package/build-module/components/block-editor/back-button.js +8 -19
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +0 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +17 -9
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -33
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +10 -10
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +3 -6
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/list/index.js +15 -15
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +4 -4
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +13 -13
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +24 -24
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/routes/index.js +47 -0
- package/build-module/components/routes/index.js.map +1 -0
- package/build-module/components/routes/link.js +51 -0
- package/build-module/components/routes/link.js.map +1 -0
- package/build-module/components/routes/use-title.js +44 -0
- package/build-module/components/routes/use-title.js.map +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js +8 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +8 -4
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/index.js +10 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +24 -9
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +40 -49
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +7 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -26
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +18 -2
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +28 -33
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -18
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/site-export.js +45 -0
- package/build-module/plugins/site-export.js.map +1 -0
- package/build-module/plugins/welcome-guide-menu-item.js +2 -7
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -11
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +7 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -27
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +16 -0
- package/build-module/utils/get-is-list-page.js.map +1 -0
- package/build-module/utils/history.js +25 -0
- package/build-module/utils/history.js.map +1 -0
- package/build-style/style-rtl.css +1 -6
- package/build-style/style.css +1 -6
- package/package.json +9 -8
- package/src/components/add-new-template/new-template-part.js +29 -11
- package/src/components/add-new-template/new-template.js +26 -12
- package/src/components/app/index.js +47 -0
- package/src/components/block-editor/back-button.js +6 -14
- package/src/components/block-editor/index.js +1 -0
- package/src/components/create-template-part-modal/index.js +0 -2
- package/src/components/edit-template-part-menu-button/index.js +16 -5
- package/src/components/editor/index.js +105 -131
- package/src/components/global-styles/gradients-palette-panel.js +12 -12
- package/src/components/global-styles/use-global-styles-output.js +0 -1
- package/src/components/header/document-actions/index.js +3 -9
- package/src/components/list/index.js +11 -12
- package/src/components/list/style.scss +6 -11
- package/src/components/list/table.js +5 -5
- package/src/components/navigation-sidebar/index.js +18 -17
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -22
- package/src/components/routes/index.js +53 -0
- package/src/components/routes/link.js +44 -0
- package/src/components/routes/use-title.js +56 -0
- package/src/components/sidebar/global-styles-sidebar.js +8 -0
- package/src/components/sidebar/template-card/template-areas.js +16 -4
- package/src/components/template-details/index.js +8 -6
- package/src/components/template-details/template-areas.js +31 -8
- package/src/components/template-part-converter/convert-to-template-part.js +4 -2
- package/src/components/url-query-controller/index.js +34 -45
- package/src/components/welcome-guide/editor.js +10 -1
- package/src/components/welcome-guide/index.js +6 -25
- package/src/components/welcome-guide/styles.js +20 -2
- package/src/index.js +33 -36
- package/src/plugins/index.js +2 -32
- package/src/plugins/site-export.js +48 -0
- package/src/plugins/welcome-guide-menu-item.js +2 -16
- package/src/store/actions.js +0 -23
- package/src/store/constants.js +0 -12
- package/src/store/reducer.js +12 -26
- package/src/store/selectors.js +1 -27
- package/src/store/test/reducer.js +22 -39
- package/src/store/test/selectors.js +3 -34
- package/src/utils/get-is-list-page.js +11 -0
- package/src/utils/history.js +35 -0
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect, useState, useMemo, useCallback } from '@wordpress/element';
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
SlotFillProvider,
|
|
8
|
-
Popover,
|
|
9
|
-
Button,
|
|
10
|
-
Notice,
|
|
11
|
-
} from '@wordpress/components';
|
|
6
|
+
import { Popover, Button, Notice } from '@wordpress/components';
|
|
12
7
|
import { EntityProvider, store as coreStore } from '@wordpress/core-data';
|
|
13
8
|
import { BlockContextProvider, BlockBreadcrumb } from '@wordpress/block-editor';
|
|
14
9
|
import {
|
|
15
|
-
FullscreenMode,
|
|
16
10
|
InterfaceSkeleton,
|
|
17
11
|
ComplementaryArea,
|
|
18
12
|
store as interfaceStore,
|
|
@@ -21,8 +15,6 @@ import {
|
|
|
21
15
|
EditorNotices,
|
|
22
16
|
EditorSnackbars,
|
|
23
17
|
EntitiesSavedStates,
|
|
24
|
-
UnsavedChangesWarning,
|
|
25
|
-
store as editorStore,
|
|
26
18
|
} from '@wordpress/editor';
|
|
27
19
|
import { __ } from '@wordpress/i18n';
|
|
28
20
|
import { PluginArea } from '@wordpress/plugins';
|
|
@@ -47,13 +39,14 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
47
39
|
import { store as editSiteStore } from '../../store';
|
|
48
40
|
import { GlobalStylesRenderer } from './global-styles-renderer';
|
|
49
41
|
import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
|
|
42
|
+
import useTitle from '../routes/use-title';
|
|
50
43
|
|
|
51
44
|
const interfaceLabels = {
|
|
52
45
|
secondarySidebar: __( 'Block Library' ),
|
|
53
46
|
drawer: __( 'Navigation Sidebar' ),
|
|
54
47
|
};
|
|
55
48
|
|
|
56
|
-
function Editor( {
|
|
49
|
+
function Editor( { onError } ) {
|
|
57
50
|
const {
|
|
58
51
|
isInserterOpen,
|
|
59
52
|
isListViewOpen,
|
|
@@ -111,26 +104,7 @@ function Editor( { initialSettings, onError } ) {
|
|
|
111
104
|
).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),
|
|
112
105
|
};
|
|
113
106
|
}, [] );
|
|
114
|
-
const {
|
|
115
|
-
const { setPage, setIsInserterOpened, updateSettings } = useDispatch(
|
|
116
|
-
editSiteStore
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
useEffect( () => {
|
|
120
|
-
updateSettings( initialSettings );
|
|
121
|
-
}, [] );
|
|
122
|
-
|
|
123
|
-
// Keep the defaultTemplateTypes in the core/editor settings too,
|
|
124
|
-
// so that they can be selected with core/editor selectors in any editor.
|
|
125
|
-
// This is needed because edit-site doesn't initialize with EditorProvider,
|
|
126
|
-
// which internally uses updateEditorSettings as well.
|
|
127
|
-
const { defaultTemplateTypes, defaultTemplatePartAreas } = settings;
|
|
128
|
-
useEffect( () => {
|
|
129
|
-
updateEditorSettings( {
|
|
130
|
-
defaultTemplateTypes,
|
|
131
|
-
defaultTemplatePartAreas,
|
|
132
|
-
} );
|
|
133
|
-
}, [ defaultTemplateTypes, defaultTemplatePartAreas ] );
|
|
107
|
+
const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
|
|
134
108
|
|
|
135
109
|
const [
|
|
136
110
|
isEntitiesSavedStatesOpen,
|
|
@@ -189,120 +163,120 @@ function Editor( { initialSettings, onError } ) {
|
|
|
189
163
|
return null;
|
|
190
164
|
};
|
|
191
165
|
|
|
166
|
+
// Only announce the title once the editor is ready to prevent "Replace"
|
|
167
|
+
// action in <URlQueryController> from double-announcing.
|
|
168
|
+
useTitle( isReady && __( 'Editor (beta)' ) );
|
|
169
|
+
|
|
192
170
|
return (
|
|
193
171
|
<>
|
|
194
172
|
<URLQueryController />
|
|
195
173
|
{ isReady && (
|
|
196
174
|
<ShortcutProvider>
|
|
197
|
-
<
|
|
198
|
-
<EntityProvider
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
>
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
<
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
175
|
+
<EntityProvider kind="root" type="site">
|
|
176
|
+
<EntityProvider
|
|
177
|
+
kind="postType"
|
|
178
|
+
type={ templateType }
|
|
179
|
+
id={ entityId }
|
|
180
|
+
>
|
|
181
|
+
<GlobalStylesProvider>
|
|
182
|
+
<BlockContextProvider value={ blockContext }>
|
|
183
|
+
<GlobalStylesRenderer />
|
|
184
|
+
<ErrorBoundary onError={ onError }>
|
|
185
|
+
<KeyboardShortcuts.Register />
|
|
186
|
+
<SidebarComplementaryAreaFills />
|
|
187
|
+
<InterfaceSkeleton
|
|
188
|
+
labels={ interfaceLabels }
|
|
189
|
+
secondarySidebar={ secondarySidebar() }
|
|
190
|
+
sidebar={
|
|
191
|
+
sidebarIsOpened && (
|
|
192
|
+
<ComplementaryArea.Slot scope="core/edit-site" />
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
drawer={
|
|
196
|
+
<NavigationSidebar.Slot />
|
|
197
|
+
}
|
|
198
|
+
header={
|
|
199
|
+
<Header
|
|
200
|
+
openEntitiesSavedStates={
|
|
201
|
+
openEntitiesSavedStates
|
|
202
|
+
}
|
|
203
|
+
/>
|
|
204
|
+
}
|
|
205
|
+
notices={ <EditorSnackbars /> }
|
|
206
|
+
content={
|
|
207
|
+
<>
|
|
208
|
+
<EditorNotices />
|
|
209
|
+
{ template && (
|
|
210
|
+
<BlockEditor
|
|
211
|
+
setIsInserterOpen={
|
|
212
|
+
setIsInserterOpened
|
|
213
|
+
}
|
|
214
|
+
/>
|
|
215
|
+
) }
|
|
216
|
+
{ templateResolved &&
|
|
217
|
+
! template &&
|
|
218
|
+
settings?.siteUrl &&
|
|
219
|
+
entityId && (
|
|
220
|
+
<Notice
|
|
221
|
+
status="warning"
|
|
222
|
+
isDismissible={
|
|
223
|
+
false
|
|
224
|
+
}
|
|
225
|
+
>
|
|
226
|
+
{ __(
|
|
227
|
+
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
|
|
228
|
+
) }
|
|
229
|
+
</Notice>
|
|
230
|
+
) }
|
|
231
|
+
<KeyboardShortcuts
|
|
225
232
|
openEntitiesSavedStates={
|
|
226
233
|
openEntitiesSavedStates
|
|
227
234
|
}
|
|
228
235
|
/>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
setIsInserterOpened
|
|
238
|
-
}
|
|
239
|
-
/>
|
|
240
|
-
) }
|
|
241
|
-
{ templateResolved &&
|
|
242
|
-
! template &&
|
|
243
|
-
settings?.siteUrl &&
|
|
244
|
-
entityId && (
|
|
245
|
-
<Notice
|
|
246
|
-
status="warning"
|
|
247
|
-
isDismissible={
|
|
248
|
-
false
|
|
249
|
-
}
|
|
250
|
-
>
|
|
251
|
-
{ __(
|
|
252
|
-
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
|
|
253
|
-
) }
|
|
254
|
-
</Notice>
|
|
255
|
-
) }
|
|
256
|
-
<KeyboardShortcuts
|
|
257
|
-
openEntitiesSavedStates={
|
|
258
|
-
openEntitiesSavedStates
|
|
236
|
+
</>
|
|
237
|
+
}
|
|
238
|
+
actions={
|
|
239
|
+
<>
|
|
240
|
+
{ isEntitiesSavedStatesOpen ? (
|
|
241
|
+
<EntitiesSavedStates
|
|
242
|
+
close={
|
|
243
|
+
closeEntitiesSavedStates
|
|
259
244
|
}
|
|
260
245
|
/>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
closeEntitiesSavedStates
|
|
246
|
+
) : (
|
|
247
|
+
<div className="edit-site-editor__toggle-save-panel">
|
|
248
|
+
<Button
|
|
249
|
+
variant="secondary"
|
|
250
|
+
className="edit-site-editor__toggle-save-panel-button"
|
|
251
|
+
onClick={
|
|
252
|
+
openEntitiesSavedStates
|
|
269
253
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
next: nextShortcut,
|
|
295
|
-
} }
|
|
296
|
-
/>
|
|
297
|
-
<WelcomeGuide />
|
|
298
|
-
<Popover.Slot />
|
|
299
|
-
<PluginArea />
|
|
300
|
-
</ErrorBoundary>
|
|
301
|
-
</BlockContextProvider>
|
|
302
|
-
</GlobalStylesProvider>
|
|
303
|
-
</EntityProvider>
|
|
254
|
+
aria-expanded={
|
|
255
|
+
false
|
|
256
|
+
}
|
|
257
|
+
>
|
|
258
|
+
{ __(
|
|
259
|
+
'Open save panel'
|
|
260
|
+
) }
|
|
261
|
+
</Button>
|
|
262
|
+
</div>
|
|
263
|
+
) }
|
|
264
|
+
</>
|
|
265
|
+
}
|
|
266
|
+
footer={ <BlockBreadcrumb /> }
|
|
267
|
+
shortcuts={ {
|
|
268
|
+
previous: previousShortcut,
|
|
269
|
+
next: nextShortcut,
|
|
270
|
+
} }
|
|
271
|
+
/>
|
|
272
|
+
<WelcomeGuide />
|
|
273
|
+
<Popover.Slot />
|
|
274
|
+
<PluginArea />
|
|
275
|
+
</ErrorBoundary>
|
|
276
|
+
</BlockContextProvider>
|
|
277
|
+
</GlobalStylesProvider>
|
|
304
278
|
</EntityProvider>
|
|
305
|
-
</
|
|
279
|
+
</EntityProvider>
|
|
306
280
|
</ShortcutProvider>
|
|
307
281
|
) }
|
|
308
282
|
</>
|
|
@@ -53,18 +53,6 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
53
53
|
className="edit-site-global-styles-gradient-palette-panel"
|
|
54
54
|
spacing={ 10 }
|
|
55
55
|
>
|
|
56
|
-
<div>
|
|
57
|
-
<Heading className="edit-site-global-styles-gradient-palette-panel__duotone-heading">
|
|
58
|
-
{ __( 'Duotone' ) }
|
|
59
|
-
</Heading>
|
|
60
|
-
<DuotonePicker
|
|
61
|
-
duotonePalette={ duotonePalette }
|
|
62
|
-
disableCustomDuotone={ true }
|
|
63
|
-
disableCustomColors={ true }
|
|
64
|
-
clearable={ false }
|
|
65
|
-
onChange={ noop }
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
56
|
{ !! themeGradients && !! themeGradients.length && (
|
|
69
57
|
<PaletteEdit
|
|
70
58
|
canReset={ themeGradients !== baseThemeGradients }
|
|
@@ -94,6 +82,18 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
94
82
|
) }
|
|
95
83
|
slugPrefix="custom-"
|
|
96
84
|
/>
|
|
85
|
+
<div>
|
|
86
|
+
<Heading className="edit-site-global-styles-gradient-palette-panel__duotone-heading">
|
|
87
|
+
{ __( 'Duotone' ) }
|
|
88
|
+
</Heading>
|
|
89
|
+
<DuotonePicker
|
|
90
|
+
duotonePalette={ duotonePalette }
|
|
91
|
+
disableCustomDuotone={ true }
|
|
92
|
+
disableCustomColors={ true }
|
|
93
|
+
clearable={ false }
|
|
94
|
+
onChange={ noop }
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
97
|
</VStack>
|
|
98
98
|
);
|
|
99
99
|
}
|
|
@@ -106,22 +106,16 @@ export default function DocumentActions( {
|
|
|
106
106
|
>
|
|
107
107
|
<Text
|
|
108
108
|
size="body"
|
|
109
|
-
className="edit-site-document-actions__title
|
|
109
|
+
className="edit-site-document-actions__title"
|
|
110
|
+
as="h1"
|
|
110
111
|
>
|
|
111
112
|
<VisuallyHidden as="span">
|
|
112
113
|
{ sprintf(
|
|
113
114
|
/* translators: %s: the entity being edited, like "template"*/
|
|
114
|
-
__( 'Editing %s:' ),
|
|
115
|
+
__( 'Editing %s: ' ),
|
|
115
116
|
entityLabel
|
|
116
117
|
) }
|
|
117
118
|
</VisuallyHidden>
|
|
118
|
-
</Text>
|
|
119
|
-
|
|
120
|
-
<Text
|
|
121
|
-
size="body"
|
|
122
|
-
className="edit-site-document-actions__title"
|
|
123
|
-
as="h1"
|
|
124
|
-
>
|
|
125
119
|
{ entityTitle }
|
|
126
120
|
</Text>
|
|
127
121
|
|
|
@@ -21,8 +21,14 @@ import Header from './header';
|
|
|
21
21
|
import NavigationSidebar from '../navigation-sidebar';
|
|
22
22
|
import Table from './table';
|
|
23
23
|
import { store as editSiteStore } from '../../store';
|
|
24
|
+
import { useLocation } from '../routes';
|
|
25
|
+
import useTitle from '../routes/use-title';
|
|
26
|
+
|
|
27
|
+
export default function List() {
|
|
28
|
+
const {
|
|
29
|
+
params: { postType: templateType },
|
|
30
|
+
} = useLocation();
|
|
24
31
|
|
|
25
|
-
export default function List( { templateType } ) {
|
|
26
32
|
useRegisterShortcuts();
|
|
27
33
|
|
|
28
34
|
const { previousShortcut, nextShortcut, isNavigationOpen } = useSelect(
|
|
@@ -47,6 +53,8 @@ export default function List( { templateType } ) {
|
|
|
47
53
|
[ templateType ]
|
|
48
54
|
);
|
|
49
55
|
|
|
56
|
+
useTitle( postType?.labels?.name );
|
|
57
|
+
|
|
50
58
|
// `postType` could load in asynchronously. Only provide the detailed region labels if
|
|
51
59
|
// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.
|
|
52
60
|
const itemsListLabel = postType?.labels?.items_list;
|
|
@@ -75,18 +83,9 @@ export default function List( { templateType } ) {
|
|
|
75
83
|
...detailedRegionLabels,
|
|
76
84
|
} }
|
|
77
85
|
header={ <Header templateType={ templateType } /> }
|
|
78
|
-
drawer={
|
|
79
|
-
<NavigationSidebar
|
|
80
|
-
activeTemplateType={ templateType }
|
|
81
|
-
isDefaultOpen
|
|
82
|
-
/>
|
|
83
|
-
}
|
|
86
|
+
drawer={ <NavigationSidebar.Slot /> }
|
|
84
87
|
notices={ <EditorSnackbars /> }
|
|
85
|
-
content={
|
|
86
|
-
<main className="edit-site-list-main">
|
|
87
|
-
<Table templateType={ templateType } />
|
|
88
|
-
</main>
|
|
89
|
-
}
|
|
88
|
+
content={ <Table templateType={ templateType } /> }
|
|
90
89
|
shortcuts={ {
|
|
91
90
|
previous: previousShortcut,
|
|
92
91
|
next: nextShortcut,
|
|
@@ -44,18 +44,13 @@
|
|
|
44
44
|
|
|
45
45
|
.interface-interface-skeleton__content {
|
|
46
46
|
background: $white;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
47
|
+
align-items: center;
|
|
48
|
+
padding: $grid-unit-20;
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
padding: $grid-unit-20;
|
|
56
|
-
|
|
57
|
-
@include break-medium() {
|
|
58
|
-
padding: $grid-unit * 9;
|
|
50
|
+
@include break-medium() {
|
|
51
|
+
padding: $grid-unit * 9;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
VisuallyHidden,
|
|
9
9
|
__experimentalHeading as Heading,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
15
14
|
*/
|
|
15
|
+
import Link from '../routes/link';
|
|
16
16
|
import Actions from './actions';
|
|
17
17
|
import AddedBy from './added-by';
|
|
18
18
|
|
|
@@ -92,15 +92,15 @@ export default function Table( { templateType } ) {
|
|
|
92
92
|
>
|
|
93
93
|
<td className="edit-site-list-table-column" role="cell">
|
|
94
94
|
<Heading level={ 4 }>
|
|
95
|
-
<
|
|
96
|
-
|
|
95
|
+
<Link
|
|
96
|
+
params={ {
|
|
97
97
|
postId: template.id,
|
|
98
98
|
postType: template.type,
|
|
99
|
-
}
|
|
99
|
+
} }
|
|
100
100
|
>
|
|
101
101
|
{ template.title?.rendered ||
|
|
102
102
|
template.slug }
|
|
103
|
-
</
|
|
103
|
+
</Link>
|
|
104
104
|
</Heading>
|
|
105
105
|
{ template.description }
|
|
106
106
|
</td>
|
|
@@ -18,30 +18,31 @@ export const {
|
|
|
18
18
|
Slot: NavigationPanelPreviewSlot,
|
|
19
19
|
} = createSlotFill( 'EditSiteNavigationPanelPreview' );
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} )
|
|
21
|
+
const {
|
|
22
|
+
Fill: NavigationSidebarFill,
|
|
23
|
+
Slot: NavigationSidebarSlot,
|
|
24
|
+
} = createSlotFill( 'EditSiteNavigationSidebar' );
|
|
25
|
+
|
|
26
|
+
function NavigationSidebar( { isDefaultOpen = false, activeTemplateType } ) {
|
|
25
27
|
const isDesktopViewport = useViewportMatch( 'medium' );
|
|
26
28
|
const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );
|
|
27
29
|
|
|
28
|
-
useEffect(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// When transitioning to mobile/tablet, close the navigation.
|
|
35
|
-
if ( ! isDesktopViewport ) {
|
|
36
|
-
setIsNavigationPanelOpened( false );
|
|
37
|
-
}
|
|
38
|
-
}, [ isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened ] );
|
|
30
|
+
useEffect(
|
|
31
|
+
function autoOpenNavigationPanelOnViewportChange() {
|
|
32
|
+
setIsNavigationPanelOpened( isDefaultOpen && isDesktopViewport );
|
|
33
|
+
},
|
|
34
|
+
[ isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened ]
|
|
35
|
+
);
|
|
39
36
|
|
|
40
37
|
return (
|
|
41
|
-
|
|
38
|
+
<NavigationSidebarFill>
|
|
42
39
|
<NavigationToggle />
|
|
43
40
|
<NavigationPanel activeItem={ activeTemplateType } />
|
|
44
41
|
<NavigationPanelPreviewSlot />
|
|
45
|
-
|
|
42
|
+
</NavigationSidebarFill>
|
|
46
43
|
);
|
|
47
44
|
}
|
|
45
|
+
|
|
46
|
+
NavigationSidebar.Slot = NavigationSidebarSlot;
|
|
47
|
+
|
|
48
|
+
export default NavigationSidebar;
|
|
@@ -15,11 +15,9 @@ import {
|
|
|
15
15
|
} from '@wordpress/components';
|
|
16
16
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
17
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
18
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
19
18
|
import { __ } from '@wordpress/i18n';
|
|
20
19
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
21
20
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
22
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
23
21
|
import {
|
|
24
22
|
home as siteIcon,
|
|
25
23
|
layout as templateIcon,
|
|
@@ -29,11 +27,18 @@ import {
|
|
|
29
27
|
/**
|
|
30
28
|
* Internal dependencies
|
|
31
29
|
*/
|
|
30
|
+
import { useLink } from '../../routes/link';
|
|
32
31
|
import MainDashboardButton from '../../main-dashboard-button';
|
|
33
32
|
import { store as editSiteStore } from '../../../store';
|
|
34
33
|
|
|
35
34
|
const SITE_EDITOR_KEY = 'site-editor';
|
|
36
35
|
|
|
36
|
+
function NavLink( { params, replace, ...props } ) {
|
|
37
|
+
const linkProps = useLink( params, replace );
|
|
38
|
+
|
|
39
|
+
return <NavigationItem { ...linkProps } { ...props } />;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
38
43
|
const { isNavigationOpen, siteTitle } = useSelect( ( select ) => {
|
|
39
44
|
const { getEntityRecord } = select( coreDataStore );
|
|
@@ -48,15 +53,6 @@ const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
|
48
53
|
}, [] );
|
|
49
54
|
const { setIsNavigationPanelOpened } = useDispatch( editSiteStore );
|
|
50
55
|
|
|
51
|
-
// Ensures focus is moved to the panel area when it is activated
|
|
52
|
-
// from a separate component (such as document actions in the header).
|
|
53
|
-
const panelRef = useRef();
|
|
54
|
-
useEffect( () => {
|
|
55
|
-
if ( isNavigationOpen ) {
|
|
56
|
-
panelRef.current.focus();
|
|
57
|
-
}
|
|
58
|
-
}, [ activeItem, isNavigationOpen ] );
|
|
59
|
-
|
|
60
56
|
const closeOnEscape = ( event ) => {
|
|
61
57
|
if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
|
|
62
58
|
event.preventDefault();
|
|
@@ -70,8 +66,6 @@ const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
|
70
66
|
className={ classnames( `edit-site-navigation-panel`, {
|
|
71
67
|
'is-open': isNavigationOpen,
|
|
72
68
|
} ) }
|
|
73
|
-
ref={ panelRef }
|
|
74
|
-
tabIndex="-1"
|
|
75
69
|
onKeyDown={ closeOnEscape }
|
|
76
70
|
>
|
|
77
71
|
<div className="edit-site-navigation-panel__inner">
|
|
@@ -92,32 +86,32 @@ const NavigationPanel = ( { activeItem = SITE_EDITOR_KEY } ) => {
|
|
|
92
86
|
|
|
93
87
|
<NavigationMenu>
|
|
94
88
|
<NavigationGroup title={ __( 'Editor' ) }>
|
|
95
|
-
<
|
|
89
|
+
<NavLink
|
|
96
90
|
icon={ siteIcon }
|
|
97
91
|
title={ __( 'Site' ) }
|
|
98
92
|
item={ SITE_EDITOR_KEY }
|
|
99
|
-
|
|
93
|
+
params={ {
|
|
100
94
|
postId: undefined,
|
|
101
95
|
postType: undefined,
|
|
102
|
-
}
|
|
96
|
+
} }
|
|
103
97
|
/>
|
|
104
|
-
<
|
|
98
|
+
<NavLink
|
|
105
99
|
icon={ templateIcon }
|
|
106
100
|
title={ __( 'Templates' ) }
|
|
107
101
|
item="wp_template"
|
|
108
|
-
|
|
102
|
+
params={ {
|
|
109
103
|
postId: undefined,
|
|
110
104
|
postType: 'wp_template',
|
|
111
|
-
}
|
|
105
|
+
} }
|
|
112
106
|
/>
|
|
113
|
-
<
|
|
107
|
+
<NavLink
|
|
114
108
|
icon={ templatePartIcon }
|
|
115
109
|
title={ __( 'Template Parts' ) }
|
|
116
110
|
item="wp_template_part"
|
|
117
|
-
|
|
111
|
+
params={ {
|
|
118
112
|
postId: undefined,
|
|
119
113
|
postType: 'wp_template_part',
|
|
120
|
-
}
|
|
114
|
+
} }
|
|
121
115
|
/>
|
|
122
116
|
</NavigationGroup>
|
|
123
117
|
</NavigationMenu>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
createContext,
|
|
6
|
+
useState,
|
|
7
|
+
useEffect,
|
|
8
|
+
useContext,
|
|
9
|
+
} from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import history from '../../utils/history';
|
|
15
|
+
|
|
16
|
+
const RoutesContext = createContext();
|
|
17
|
+
const HistoryContext = createContext();
|
|
18
|
+
|
|
19
|
+
export function useLocation() {
|
|
20
|
+
return useContext( RoutesContext );
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function useHistory() {
|
|
24
|
+
return useContext( HistoryContext );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getLocationWithParams( location ) {
|
|
28
|
+
const searchParams = new URLSearchParams( location.search );
|
|
29
|
+
return {
|
|
30
|
+
...location,
|
|
31
|
+
params: Object.fromEntries( searchParams.entries() ),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function Routes( { children } ) {
|
|
36
|
+
const [ location, setLocation ] = useState( () =>
|
|
37
|
+
getLocationWithParams( history.location )
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
useEffect( () => {
|
|
41
|
+
return history.listen( ( { location: updatedLocation } ) => {
|
|
42
|
+
setLocation( getLocationWithParams( updatedLocation ) );
|
|
43
|
+
} );
|
|
44
|
+
}, [] );
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<HistoryContext.Provider value={ history }>
|
|
48
|
+
<RoutesContext.Provider value={ location }>
|
|
49
|
+
{ children( location ) }
|
|
50
|
+
</RoutesContext.Provider>
|
|
51
|
+
</HistoryContext.Provider>
|
|
52
|
+
);
|
|
53
|
+
}
|