@wordpress/edit-site 6.50.0 → 6.50.1-next.v.202607070741.0
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/editor/index.cjs +33 -101
- package/build/components/editor/index.cjs.map +3 -3
- package/build/components/layout/index.cjs +12 -14
- package/build/components/layout/index.cjs.map +3 -3
- package/build/components/page-patterns/fields.cjs +0 -36
- package/build/components/page-patterns/fields.cjs.map +2 -2
- package/build/components/page-patterns/index.cjs +4 -15
- package/build/components/page-patterns/index.cjs.map +2 -2
- package/build/components/save-panel/index.cjs +1 -2
- package/build/components/save-panel/index.cjs.map +2 -2
- package/build/components/site-hub/index.cjs +24 -155
- package/build/components/site-hub/index.cjs.map +3 -3
- package/build/index.cjs +3 -1
- package/build/index.cjs.map +2 -2
- package/build-module/components/editor/index.mjs +36 -104
- package/build-module/components/editor/index.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +12 -14
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/page-patterns/fields.mjs +2 -41
- package/build-module/components/page-patterns/fields.mjs.map +2 -2
- package/build-module/components/page-patterns/index.mjs +5 -16
- package/build-module/components/page-patterns/index.mjs.map +2 -2
- package/build-module/components/save-panel/index.mjs +1 -2
- package/build-module/components/save-panel/index.mjs.map +2 -2
- package/build-module/components/site-hub/index.mjs +27 -158
- package/build-module/components/site-hub/index.mjs.map +2 -2
- package/build-module/index.mjs +3 -1
- package/build-module/index.mjs.map +2 -2
- package/build-style/style-rtl.css +71 -189
- package/build-style/style.css +71 -189
- package/package.json +48 -48
- package/src/components/editor/index.js +18 -101
- package/src/components/editor/style.scss +8 -19
- package/src/components/layout/index.js +12 -15
- package/src/components/layout/style.scss +5 -7
- package/src/components/page-patterns/fields.js +2 -50
- package/src/components/page-patterns/index.js +5 -23
- package/src/components/page-patterns/style.scss +1 -1
- package/src/components/save-panel/index.js +1 -2
- package/src/components/sidebar/style.scss +2 -0
- package/src/components/sidebar-global-styles/style.scss +7 -4
- package/src/components/sidebar-navigation-screen/style.scss +1 -1
- package/src/components/site-hub/index.js +7 -141
- package/src/components/site-hub/style.scss +0 -72
- package/src/index.js +3 -1
- package/src/style.scss +14 -11
- package/build/components/site-icon/index.cjs +0 -73
- package/build/components/site-icon/index.cjs.map +0 -7
- package/build-module/components/site-icon/index.mjs +0 -42
- package/build-module/components/site-icon/index.mjs.map +0 -7
- package/build-style/experimental-omnibar-rtl.css +0 -103
- package/build-style/experimental-omnibar.css +0 -103
- package/src/components/site-icon/index.js +0 -51
- package/src/components/site-icon/style.scss +0 -41
- package/src/experimental-omnibar.scss +0 -75
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
-
import { Button
|
|
11
|
-
import { useInstanceId
|
|
5
|
+
import { Button } from '@wordpress/components';
|
|
6
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
12
7
|
import {
|
|
13
8
|
EditorKeyboardShortcutsRegister,
|
|
14
9
|
privateApis as editorPrivateApis,
|
|
@@ -21,7 +16,7 @@ import { useCallback } from '@wordpress/element';
|
|
|
21
16
|
import { store as noticesStore } from '@wordpress/notices';
|
|
22
17
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
23
18
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
24
|
-
import { Icon,
|
|
19
|
+
import { Icon, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
25
20
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
26
21
|
import { addQueryArgs } from '@wordpress/url';
|
|
27
22
|
|
|
@@ -37,7 +32,6 @@ import { isPreviewingTheme } from '../../utils/is-previewing-theme';
|
|
|
37
32
|
import SaveButton from '../save-button';
|
|
38
33
|
import SavePanel from '../save-panel';
|
|
39
34
|
import SiteEditorMoreMenu from '../more-menu';
|
|
40
|
-
import SiteIcon from '../site-icon';
|
|
41
35
|
import useEditorIframeProps from '../block-editor/use-editor-iframe-props';
|
|
42
36
|
import { ViewportSync } from '../block-editor/use-viewport-sync';
|
|
43
37
|
import useEditorTitle from './use-editor-title';
|
|
@@ -53,30 +47,6 @@ const { Editor, BackButton } = unlock( editorPrivateApis );
|
|
|
53
47
|
const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
54
48
|
const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
|
|
55
49
|
|
|
56
|
-
const toggleHomeIconVariants = {
|
|
57
|
-
edit: {
|
|
58
|
-
opacity: 0,
|
|
59
|
-
scale: 0.2,
|
|
60
|
-
},
|
|
61
|
-
hover: {
|
|
62
|
-
opacity: 1,
|
|
63
|
-
scale: 1,
|
|
64
|
-
clipPath: 'inset( 22% round 2px )',
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const siteIconVariants = {
|
|
69
|
-
edit: {
|
|
70
|
-
clipPath: 'inset(0% round 0px)',
|
|
71
|
-
},
|
|
72
|
-
hover: {
|
|
73
|
-
clipPath: 'inset( 22% round 2px )',
|
|
74
|
-
},
|
|
75
|
-
tap: {
|
|
76
|
-
clipPath: 'inset(0% round 0px)',
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
50
|
function getListPathForPostType( postType ) {
|
|
81
51
|
switch ( postType ) {
|
|
82
52
|
case 'navigation':
|
|
@@ -113,7 +83,6 @@ function getNavigationPath( location, postType ) {
|
|
|
113
83
|
}
|
|
114
84
|
|
|
115
85
|
export default function EditSiteEditor( { isHomeRoute = false } ) {
|
|
116
|
-
const disableMotion = useReducedMotion();
|
|
117
86
|
const location = useLocation();
|
|
118
87
|
const history = useHistory();
|
|
119
88
|
const { canvas = 'view' } = location.query;
|
|
@@ -123,15 +92,10 @@ export default function EditSiteEditor( { isHomeRoute = false } ) {
|
|
|
123
92
|
// deprecated sync state with url
|
|
124
93
|
useSyncDeprecatedEntityIntoState( entity );
|
|
125
94
|
const { postType, postId, context } = entity;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
|
|
132
|
-
hasSiteIcon: !! siteData?.site_icon_url,
|
|
133
|
-
};
|
|
134
|
-
}, [] );
|
|
95
|
+
const isBlockBasedTheme = useSelect(
|
|
96
|
+
( select ) => select( coreDataStore ).getCurrentTheme()?.is_block_theme,
|
|
97
|
+
[]
|
|
98
|
+
);
|
|
135
99
|
const postWithTemplate = !! context?.postId;
|
|
136
100
|
useEditorTitle(
|
|
137
101
|
postWithTemplate ? context.postType : postType,
|
|
@@ -204,11 +168,6 @@ export default function EditSiteEditor( { isHomeRoute = false } ) {
|
|
|
204
168
|
);
|
|
205
169
|
|
|
206
170
|
const isReady = ! isLoading;
|
|
207
|
-
const transition = {
|
|
208
|
-
duration: disableMotion ? 0 : 0.2,
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const hasAdminBarInEditor = window.__experimentalAdminBarInEditor;
|
|
212
171
|
|
|
213
172
|
return ! isBlockBasedTheme && isHomeRoute ? (
|
|
214
173
|
<SitePreview />
|
|
@@ -246,14 +205,7 @@ export default function EditSiteEditor( { isHomeRoute = false } ) {
|
|
|
246
205
|
<BackButton>
|
|
247
206
|
{ ( { length } ) =>
|
|
248
207
|
length <= 1 && (
|
|
249
|
-
<
|
|
250
|
-
className="edit-site-editor__view-mode-toggle"
|
|
251
|
-
transition={ transition }
|
|
252
|
-
animate="edit"
|
|
253
|
-
initial="edit"
|
|
254
|
-
whileHover="hover"
|
|
255
|
-
whileTap="tap"
|
|
256
|
-
>
|
|
208
|
+
<div className="edit-site-editor__view-mode-toggle">
|
|
257
209
|
<Button
|
|
258
210
|
__next40pxDefaultSize
|
|
259
211
|
label={ __( 'Open Navigation' ) }
|
|
@@ -275,52 +227,17 @@ export default function EditSiteEditor( { isHomeRoute = false } ) {
|
|
|
275
227
|
}
|
|
276
228
|
);
|
|
277
229
|
} }
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
>
|
|
286
|
-
<SiteIcon className="edit-site-editor__view-mode-toggle-icon" />
|
|
287
|
-
</motion.div>
|
|
288
|
-
) }
|
|
289
|
-
</Button>
|
|
290
|
-
{ hasAdminBarInEditor ? (
|
|
291
|
-
<div className="edit-site-editor__back-icon">
|
|
292
|
-
<Icon
|
|
293
|
-
icon={
|
|
294
|
-
isRTL()
|
|
295
|
-
? arrowUpRight
|
|
296
|
-
: arrowUpLeft
|
|
297
|
-
}
|
|
298
|
-
/>
|
|
299
|
-
</div>
|
|
300
|
-
) : (
|
|
301
|
-
<motion.div
|
|
302
|
-
className={ clsx(
|
|
303
|
-
'edit-site-editor__back-icon',
|
|
304
|
-
{
|
|
305
|
-
'has-site-icon':
|
|
306
|
-
hasSiteIcon,
|
|
307
|
-
}
|
|
308
|
-
) }
|
|
309
|
-
variants={
|
|
310
|
-
! disableMotion &&
|
|
311
|
-
toggleHomeIconVariants
|
|
230
|
+
/>
|
|
231
|
+
<div className="edit-site-editor__back-icon">
|
|
232
|
+
<Icon
|
|
233
|
+
icon={
|
|
234
|
+
isRTL()
|
|
235
|
+
? chevronRight
|
|
236
|
+
: chevronLeft
|
|
312
237
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
isRTL()
|
|
317
|
-
? arrowUpRight
|
|
318
|
-
: arrowUpLeft
|
|
319
|
-
}
|
|
320
|
-
/>
|
|
321
|
-
</motion.div>
|
|
322
|
-
) }
|
|
323
|
-
</motion.div>
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
324
241
|
)
|
|
325
242
|
}
|
|
326
243
|
</BackButton>
|
|
@@ -24,13 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.edit-site-editor__view-mode-toggle {
|
|
27
|
-
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
|
|
28
27
|
view-transition-name: toggle;
|
|
29
|
-
|
|
28
|
+
position: relative;
|
|
30
29
|
top: 0;
|
|
31
30
|
left: 0;
|
|
32
|
-
height: $
|
|
33
|
-
width: $
|
|
31
|
+
height: $button-size-compact;
|
|
32
|
+
width: $button-size-compact;
|
|
34
33
|
z-index: 100;
|
|
35
34
|
|
|
36
35
|
.components-button {
|
|
@@ -53,12 +52,8 @@
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
.edit-site-
|
|
57
|
-
|
|
58
|
-
img {
|
|
59
|
-
background: $gray-900;
|
|
60
|
-
display: block;
|
|
61
|
-
}
|
|
55
|
+
&:hover .edit-site-editor__back-icon {
|
|
56
|
+
color: var(--wp-admin-theme-color);
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
59
|
|
|
@@ -66,21 +61,15 @@
|
|
|
66
61
|
position: absolute;
|
|
67
62
|
top: 0;
|
|
68
63
|
left: 0;
|
|
69
|
-
width: $
|
|
70
|
-
height: $
|
|
64
|
+
width: $button-size-compact;
|
|
65
|
+
height: $button-size-compact;
|
|
71
66
|
display: flex;
|
|
72
67
|
align-items: center;
|
|
73
68
|
justify-content: center;
|
|
74
|
-
background-color:
|
|
69
|
+
background-color: transparent;
|
|
75
70
|
pointer-events: none;
|
|
76
71
|
|
|
77
72
|
svg {
|
|
78
73
|
fill: currentColor;
|
|
79
74
|
}
|
|
80
|
-
|
|
81
|
-
&.has-site-icon {
|
|
82
|
-
background-color: hsla(0, 0%, 100%, 0.6);
|
|
83
|
-
-webkit-backdrop-filter: saturate(180%) blur(15px);
|
|
84
|
-
backdrop-filter: saturate(180%) blur(15px);
|
|
85
|
-
}
|
|
86
75
|
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useResizeObserver,
|
|
20
20
|
usePrevious,
|
|
21
21
|
} from '@wordpress/compose';
|
|
22
|
+
import { focus } from '@wordpress/dom';
|
|
22
23
|
import { __, sprintf } from '@wordpress/i18n';
|
|
23
24
|
import { useState, useRef, useEffect, useMemo } from '@wordpress/element';
|
|
24
25
|
import {
|
|
@@ -37,7 +38,7 @@ import { Tooltip } from '@wordpress/ui';
|
|
|
37
38
|
/**
|
|
38
39
|
* Internal dependencies
|
|
39
40
|
*/
|
|
40
|
-
import {
|
|
41
|
+
import { SiteHubMobile } from '../site-hub';
|
|
41
42
|
import ResizableFrame from '../resizable-frame';
|
|
42
43
|
import { unlock } from '../../lock-unlock';
|
|
43
44
|
import SaveKeyboardShortcut from '../save-keyboard-shortcut';
|
|
@@ -57,13 +58,12 @@ function Layout() {
|
|
|
57
58
|
const { query, name: routeKey, areas, widths } = useLocation();
|
|
58
59
|
// Force canvas to 'view' on notfound route to show the error message and allow navigation.
|
|
59
60
|
const canvas = routeKey === 'notfound' ? 'view' : query?.canvas ?? 'view';
|
|
60
|
-
const
|
|
61
|
-
const showDesktopSiteHub = ! hasAdminBarInEditor;
|
|
62
|
-
const showMobileSiteHub = ! hasAdminBarInEditor || routeKey !== 'home';
|
|
61
|
+
const showMobileSiteHub = !! areas.mobileContent;
|
|
63
62
|
const hasMobileAreas =
|
|
64
63
|
areas.mobileSidebar || areas.mobileContent || areas.preview;
|
|
65
64
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
66
|
-
const
|
|
65
|
+
const mobileToggleRef = useRef();
|
|
66
|
+
const sidebarRegionRef = useRef();
|
|
67
67
|
const navigateRegionsProps = useNavigateRegions();
|
|
68
68
|
const disableMotion = useReducedMotion();
|
|
69
69
|
const [ canvasResizer, canvasSize ] = useResizeObserver();
|
|
@@ -88,7 +88,11 @@ function Layout() {
|
|
|
88
88
|
const previousCanvaMode = usePrevious( canvas );
|
|
89
89
|
useEffect( () => {
|
|
90
90
|
if ( previousCanvaMode === 'edit' ) {
|
|
91
|
-
|
|
91
|
+
const desktopToggle = sidebarRegionRef.current
|
|
92
|
+
? // We're typically expecting the `<DashboardBackButton />` component as the first tabbable element.
|
|
93
|
+
focus.tabbable.find( sidebarRegionRef.current )[ 0 ]
|
|
94
|
+
: undefined;
|
|
95
|
+
( desktopToggle ?? mobileToggleRef.current )?.focus();
|
|
92
96
|
}
|
|
93
97
|
// Should not depend on the previous canvas mode value but the next.
|
|
94
98
|
}, [ canvas ] );
|
|
@@ -116,6 +120,7 @@ function Layout() {
|
|
|
116
120
|
*/ }
|
|
117
121
|
{ ( ! isMobileViewport || ! hasMobileAreas ) && (
|
|
118
122
|
<NavigableRegion
|
|
123
|
+
ref={ sidebarRegionRef }
|
|
119
124
|
ariaLabel={ __( 'Navigation' ) }
|
|
120
125
|
className="edit-site-layout__sidebar-region"
|
|
121
126
|
>
|
|
@@ -137,14 +142,6 @@ function Layout() {
|
|
|
137
142
|
} }
|
|
138
143
|
className="edit-site-layout__sidebar"
|
|
139
144
|
>
|
|
140
|
-
{ showDesktopSiteHub && (
|
|
141
|
-
<SiteHub
|
|
142
|
-
ref={ toggleRef }
|
|
143
|
-
isTransparent={
|
|
144
|
-
isResizableFrameOversized
|
|
145
|
-
}
|
|
146
|
-
/>
|
|
147
|
-
) }
|
|
148
145
|
<SidebarNavigationProvider>
|
|
149
146
|
<SidebarContent
|
|
150
147
|
shouldAnimate={
|
|
@@ -176,7 +173,7 @@ function Layout() {
|
|
|
176
173
|
<>
|
|
177
174
|
{ showMobileSiteHub && (
|
|
178
175
|
<SiteHubMobile
|
|
179
|
-
ref={
|
|
176
|
+
ref={ mobileToggleRef }
|
|
180
177
|
isTransparent={
|
|
181
178
|
isResizableFrameOversized
|
|
182
179
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
.edit-site-layout__content {
|
|
19
19
|
height: 100%;
|
|
20
|
+
min-height: 0;
|
|
20
21
|
flex-grow: 1;
|
|
21
22
|
display: flex;
|
|
22
23
|
}
|
|
@@ -33,15 +34,16 @@
|
|
|
33
34
|
// This is only necessary for the exit animation
|
|
34
35
|
.edit-site-layout.is-full-canvas & {
|
|
35
36
|
position: fixed !important;
|
|
36
|
-
height: 100vh;
|
|
37
|
+
height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
|
|
37
38
|
left: 0;
|
|
38
|
-
top: 0;
|
|
39
|
+
top: var(--wp-admin--admin-bar--height, 0);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.edit-site-layout__sidebar {
|
|
42
43
|
display: flex;
|
|
43
44
|
flex-direction: column;
|
|
44
45
|
height: 100%;
|
|
46
|
+
min-height: 0;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
.resizable-editor__drag-handle {
|
|
@@ -163,7 +165,6 @@
|
|
|
163
165
|
height: 100%;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
|
-
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
|
|
167
168
|
html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
168
169
|
animation-delay: 255ms;
|
|
169
170
|
}
|
|
@@ -175,16 +176,13 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
|
175
176
|
animation: none !important;
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
/* stylelint-enable */
|
|
179
179
|
|
|
180
180
|
.edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region .edit-site-layout__view-mode-toggle {
|
|
181
181
|
display: none;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
.edit-site-layout__view-mode-toggle.components-button {
|
|
185
|
-
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
|
|
186
185
|
view-transition-name: toggle;
|
|
187
|
-
/* stylelint-enable */
|
|
188
186
|
position: relative;
|
|
189
187
|
color: var(--wpds-color-foreground-interactive-neutral);
|
|
190
188
|
height: $header-height;
|
|
@@ -254,7 +252,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
|
254
252
|
&.is-entity-save-view-open {
|
|
255
253
|
&:focus,
|
|
256
254
|
&:focus-within {
|
|
257
|
-
top: 0;
|
|
255
|
+
top: var(--wp-admin--admin-bar--height, 0);
|
|
258
256
|
}
|
|
259
257
|
}
|
|
260
258
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { useMemo, useId } from '@wordpress/element';
|
|
6
6
|
import { BlockPreview } from '@wordpress/block-editor';
|
|
7
7
|
import { parse } from '@wordpress/blocks';
|
|
@@ -10,11 +10,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
14
|
-
TEMPLATE_PART_POST_TYPE,
|
|
15
|
-
PATTERN_SYNC_TYPES,
|
|
16
|
-
OPERATOR_IS,
|
|
17
|
-
} from '../../utils/constants';
|
|
13
|
+
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
18
14
|
import { unlock } from '../../lock-unlock';
|
|
19
15
|
|
|
20
16
|
const { useStyle } = unlock( editorPrivateApis );
|
|
@@ -65,47 +61,3 @@ export const previewField = {
|
|
|
65
61
|
render: PreviewField,
|
|
66
62
|
enableSorting: false,
|
|
67
63
|
};
|
|
68
|
-
|
|
69
|
-
const SYNC_FILTERS = [
|
|
70
|
-
{
|
|
71
|
-
value: PATTERN_SYNC_TYPES.full,
|
|
72
|
-
label: _x( 'Synced', 'pattern (singular)' ),
|
|
73
|
-
description: __( 'Patterns that are kept in sync across the site.' ),
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: PATTERN_SYNC_TYPES.unsynced,
|
|
77
|
-
label: _x( 'Not synced', 'pattern (singular)' ),
|
|
78
|
-
description: __(
|
|
79
|
-
'Patterns that can be changed freely without affecting the site.'
|
|
80
|
-
),
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
|
|
84
|
-
export const patternStatusField = {
|
|
85
|
-
label: __( 'Sync status' ),
|
|
86
|
-
id: 'sync-status',
|
|
87
|
-
render: ( { item } ) => {
|
|
88
|
-
const syncStatus =
|
|
89
|
-
'wp_pattern_sync_status' in item
|
|
90
|
-
? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full
|
|
91
|
-
: PATTERN_SYNC_TYPES.unsynced;
|
|
92
|
-
// User patterns can have their sync statuses checked directly.
|
|
93
|
-
// Non-user patterns are all unsynced for the time being.
|
|
94
|
-
return (
|
|
95
|
-
<span
|
|
96
|
-
className={ `edit-site-patterns__field-sync-status-${ syncStatus }` }
|
|
97
|
-
>
|
|
98
|
-
{
|
|
99
|
-
SYNC_FILTERS.find( ( { value } ) => value === syncStatus )
|
|
100
|
-
.label
|
|
101
|
-
}
|
|
102
|
-
</span>
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
elements: SYNC_FILTERS,
|
|
106
|
-
filterBy: {
|
|
107
|
-
operators: [ OPERATOR_IS ],
|
|
108
|
-
isPrimary: true,
|
|
109
|
-
},
|
|
110
|
-
enableSorting: false,
|
|
111
|
-
};
|
|
@@ -26,12 +26,11 @@ import { unlock } from '../../lock-unlock';
|
|
|
26
26
|
import usePatterns, { useAugmentPatternsWithPermissions } from './use-patterns';
|
|
27
27
|
import PatternsActions from './actions';
|
|
28
28
|
import { useEditPostAction } from '../dataviews-actions';
|
|
29
|
-
import {
|
|
29
|
+
import { previewField } from './fields';
|
|
30
30
|
import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';
|
|
31
31
|
|
|
32
32
|
const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
|
|
33
|
-
const { usePostActions, usePostFields
|
|
34
|
-
unlock( editorPrivateApis );
|
|
33
|
+
const { usePostActions, usePostFields } = unlock( editorPrivateApis );
|
|
35
34
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
36
35
|
|
|
37
36
|
const EMPTY_ARRAY = [];
|
|
@@ -104,27 +103,10 @@ export default function DataviewsPatterns() {
|
|
|
104
103
|
syncStatus: viewSyncStatus,
|
|
105
104
|
} );
|
|
106
105
|
|
|
107
|
-
const
|
|
108
|
-
postType: TEMPLATE_PART_POST_TYPE,
|
|
109
|
-
} );
|
|
110
|
-
const templatePartAuthorField = templatePartFields.find(
|
|
111
|
-
( field ) => field.id === 'author'
|
|
112
|
-
);
|
|
113
|
-
|
|
106
|
+
const postTypeFields = usePostFields( { postType } );
|
|
114
107
|
const fields = useMemo( () => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if ( postType === PATTERN_TYPES.user ) {
|
|
118
|
-
_fields.push( patternStatusField );
|
|
119
|
-
} else if (
|
|
120
|
-
postType === TEMPLATE_PART_POST_TYPE &&
|
|
121
|
-
templatePartAuthorField
|
|
122
|
-
) {
|
|
123
|
-
_fields.push( templatePartAuthorField );
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return _fields;
|
|
127
|
-
}, [ postType, templatePartAuthorField ] );
|
|
108
|
+
return [ previewField, ...( postTypeFields || [] ) ];
|
|
109
|
+
}, [ postTypeFields ] );
|
|
128
110
|
|
|
129
111
|
const { data, paginationInfo } = useMemo( () => {
|
|
130
112
|
// Search is managed server-side as well as filters for patterns.
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
.edit-site-page-patterns-dataviews {
|
|
69
69
|
.dataviews-view-grid__badge-fields {
|
|
70
|
-
.dataviews-view-grid__field-value:has(.
|
|
70
|
+
.dataviews-view-grid__field-value:has(.fields-field__pattern-sync-status-fully) {
|
|
71
71
|
background: rgba(var(--wp-block-synced-color--rgb), 0.04);
|
|
72
72
|
color: var(--wp-block-synced-color);
|
|
73
73
|
}
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
padding-right: 0;
|
|
17
17
|
|
|
18
18
|
.global-styles-ui-sidebar__navigator-screen {
|
|
19
|
-
padding
|
|
20
|
-
padding-left: $grid-unit-15;
|
|
21
|
-
padding-right: $grid-unit-15;
|
|
22
|
-
padding-bottom: $grid-unit-15;
|
|
19
|
+
padding: $grid-unit-15;
|
|
23
20
|
outline: none;
|
|
21
|
+
|
|
22
|
+
.global-styles-ui-color-palette__tablist-container {
|
|
23
|
+
margin-inline: -$grid-unit-15;
|
|
24
|
+
width: calc(100% + #{$grid-unit-15 * 2});
|
|
25
|
+
padding-inline: $grid-unit-15;
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
.edit-site-sidebar-button {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
position: sticky;
|
|
36
36
|
top: 0;
|
|
37
37
|
background: var(--wpds-color-background-surface-neutral-weak);
|
|
38
|
-
padding-top: $grid-unit-
|
|
38
|
+
padding-top: $grid-unit-40;
|
|
39
39
|
margin-bottom: $grid-unit-10;
|
|
40
40
|
padding-bottom: $grid-unit-10;
|
|
41
41
|
// Title needs to appear above other UI in the section content.
|