@wordpress/edit-site 6.14.0 → 6.15.1
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/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-pattern/index.js +6 -10
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +1 -9
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/confirm-reset-shadow-dialog.js +39 -0
- package/build/components/global-styles/confirm-reset-shadow-dialog.js.map +1 -0
- package/build/components/global-styles/font-library-modal/index.js +1 -1
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-size.js +17 -14
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes.js +17 -20
- package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +21 -13
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/shadows-panel.js +43 -5
- package/build/components/global-styles/shadows-panel.js.map +1 -1
- package/build/components/layout/index.js +10 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/fields.js +6 -35
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-templates/fields.js +6 -19
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/post-list/index.js +13 -5
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +5 -7
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +3 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +40 -72
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/site-editor-routes/stylebook.js +6 -2
- package/build/components/site-editor-routes/stylebook.js.map +1 -1
- package/build/components/site-editor-routes/styles.js +7 -1
- package/build/components/site-editor-routes/styles.js.map +1 -1
- package/build/components/style-book/constants.js +36 -2
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/index.js +106 -61
- package/build/components/style-book/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +6 -10
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -9
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/confirm-reset-shadow-dialog.js +32 -0
- package/build-module/components/global-styles/confirm-reset-shadow-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/index.js +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-size.js +17 -14
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-sizes.js +24 -27
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +21 -13
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/shadows-panel.js +46 -8
- package/build-module/components/global-styles/shadows-panel.js.map +1 -1
- package/build-module/components/layout/index.js +11 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +7 -36
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-templates/fields.js +6 -19
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/post-list/index.js +13 -5
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +5 -7
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +3 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +41 -75
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/site-editor-routes/stylebook.js +6 -2
- package/build-module/components/site-editor-routes/stylebook.js.map +1 -1
- package/build-module/components/site-editor-routes/styles.js +7 -1
- package/build-module/components/site-editor-routes/styles.js.map +1 -1
- package/build-module/components/style-book/constants.js +35 -1
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/index.js +107 -62
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-style/posts-rtl.css +72 -78
- package/build-style/posts.css +72 -78
- package/build-style/style-rtl.css +163 -184
- package/build-style/style.css +163 -184
- package/package.json +42 -41
- package/src/components/add-new-pattern/index.js +10 -7
- package/src/components/canvas-loader/style.scss +4 -3
- package/src/components/editor/index.js +1 -7
- package/src/components/editor/style.scss +4 -2
- package/src/components/editor-canvas-container/style.scss +7 -1
- package/src/components/global-styles/confirm-reset-shadow-dialog.js +37 -0
- package/src/components/global-styles/font-library-modal/index.js +1 -1
- package/src/components/global-styles/font-library-modal/style.scss +4 -2
- package/src/components/global-styles/font-sizes/font-size.js +28 -19
- package/src/components/global-styles/font-sizes/font-sizes.js +37 -35
- package/src/components/global-styles/screen-block.js +3 -2
- package/src/components/global-styles/shadows-edit-panel.js +38 -28
- package/src/components/global-styles/shadows-panel.js +64 -5
- package/src/components/global-styles/style.scss +9 -1
- package/src/components/global-styles/variations/style.scss +4 -3
- package/src/components/layout/index.js +12 -1
- package/src/components/layout/style.scss +8 -3
- package/src/components/page/style.scss +8 -5
- package/src/components/page-patterns/fields.js +11 -41
- package/src/components/page-patterns/style.scss +4 -25
- package/src/components/page-templates/fields.js +6 -16
- package/src/components/page-templates/style.scss +4 -20
- package/src/components/post-list/index.js +13 -4
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +7 -6
- package/src/components/sidebar-dataviews/default-views.js +3 -2
- package/src/components/sidebar-dataviews/style.scss +4 -1
- package/src/components/sidebar-global-styles-wrapper/index.js +37 -83
- package/src/components/sidebar-global-styles-wrapper/style.scss +22 -0
- package/src/components/sidebar-navigation-item/style.scss +6 -0
- package/src/components/sidebar-navigation-screen-main/index.js +1 -1
- package/src/components/site-editor-routes/stylebook.js +2 -2
- package/src/components/site-editor-routes/styles.js +5 -1
- package/src/components/site-hub/style.scss +4 -2
- package/src/components/style-book/constants.ts +49 -1
- package/src/components/style-book/index.js +151 -77
|
@@ -8,10 +8,17 @@ import {
|
|
|
8
8
|
Button,
|
|
9
9
|
Flex,
|
|
10
10
|
FlexItem,
|
|
11
|
+
privateApis as componentsPrivateApis,
|
|
11
12
|
} from '@wordpress/components';
|
|
12
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
+
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
13
14
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
plus,
|
|
17
|
+
Icon,
|
|
18
|
+
chevronLeft,
|
|
19
|
+
chevronRight,
|
|
20
|
+
moreVertical,
|
|
21
|
+
} from '@wordpress/icons';
|
|
15
22
|
|
|
16
23
|
/**
|
|
17
24
|
* Internal dependencies
|
|
@@ -21,8 +28,11 @@ import Subtitle from './subtitle';
|
|
|
21
28
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
22
29
|
import ScreenHeader from './header';
|
|
23
30
|
import { getNewIndexFromPresets } from './utils';
|
|
31
|
+
import { useState } from '@wordpress/element';
|
|
32
|
+
import ConfirmResetShadowDialog from './confirm-reset-shadow-dialog';
|
|
24
33
|
|
|
25
34
|
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
35
|
+
const { Menu } = unlock( componentsPrivateApis );
|
|
26
36
|
|
|
27
37
|
export const defaultShadow = '6px 6px 9px rgba(0, 0, 0, 0.2)';
|
|
28
38
|
|
|
@@ -40,8 +50,27 @@ export default function ShadowsPanel() {
|
|
|
40
50
|
setCustomShadows( [ ...( customShadows || [] ), shadow ] );
|
|
41
51
|
};
|
|
42
52
|
|
|
53
|
+
const handleResetShadows = () => {
|
|
54
|
+
setCustomShadows( [] );
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const [ isResetDialogOpen, setIsResetDialogOpen ] = useState( false );
|
|
58
|
+
|
|
59
|
+
const toggleResetDialog = () => setIsResetDialogOpen( ! isResetDialogOpen );
|
|
60
|
+
|
|
43
61
|
return (
|
|
44
62
|
<>
|
|
63
|
+
{ isResetDialogOpen && (
|
|
64
|
+
<ConfirmResetShadowDialog
|
|
65
|
+
text={ __(
|
|
66
|
+
'Are you sure you want to remove all custom shadows?'
|
|
67
|
+
) }
|
|
68
|
+
confirmButtonText={ __( 'Remove' ) }
|
|
69
|
+
isOpen={ isResetDialogOpen }
|
|
70
|
+
toggleOpen={ toggleResetDialog }
|
|
71
|
+
onConfirm={ handleResetShadows }
|
|
72
|
+
/>
|
|
73
|
+
) }
|
|
45
74
|
<ScreenHeader
|
|
46
75
|
title={ __( 'Shadows' ) }
|
|
47
76
|
description={ __(
|
|
@@ -73,6 +102,7 @@ export default function ShadowsPanel() {
|
|
|
73
102
|
category="custom"
|
|
74
103
|
canCreate
|
|
75
104
|
onCreate={ onCreateShadow }
|
|
105
|
+
onReset={ toggleResetDialog }
|
|
76
106
|
/>
|
|
77
107
|
</VStack>
|
|
78
108
|
</div>
|
|
@@ -80,7 +110,14 @@ export default function ShadowsPanel() {
|
|
|
80
110
|
);
|
|
81
111
|
}
|
|
82
112
|
|
|
83
|
-
function ShadowList( {
|
|
113
|
+
function ShadowList( {
|
|
114
|
+
label,
|
|
115
|
+
shadows,
|
|
116
|
+
category,
|
|
117
|
+
canCreate,
|
|
118
|
+
onCreate,
|
|
119
|
+
onReset,
|
|
120
|
+
} ) {
|
|
84
121
|
const handleAddShadow = () => {
|
|
85
122
|
const newIndex = getNewIndexFromPresets( shadows, 'shadow-' );
|
|
86
123
|
onCreate( {
|
|
@@ -115,6 +152,26 @@ function ShadowList( { label, shadows, category, canCreate, onCreate } ) {
|
|
|
115
152
|
/>
|
|
116
153
|
</FlexItem>
|
|
117
154
|
) }
|
|
155
|
+
{ !! shadows?.length && category === 'custom' && (
|
|
156
|
+
<Menu>
|
|
157
|
+
<Menu.TriggerButton
|
|
158
|
+
render={
|
|
159
|
+
<Button
|
|
160
|
+
size="small"
|
|
161
|
+
icon={ moreVertical }
|
|
162
|
+
label={ __( 'Shadow options' ) }
|
|
163
|
+
/>
|
|
164
|
+
}
|
|
165
|
+
/>
|
|
166
|
+
<Menu.Popover>
|
|
167
|
+
<Menu.Item onClick={ onReset }>
|
|
168
|
+
<Menu.ItemLabel>
|
|
169
|
+
{ __( 'Remove all custom shadows' ) }
|
|
170
|
+
</Menu.ItemLabel>
|
|
171
|
+
</Menu.Item>
|
|
172
|
+
</Menu.Popover>
|
|
173
|
+
</Menu>
|
|
174
|
+
) }
|
|
118
175
|
</HStack>
|
|
119
176
|
{ shadows.length > 0 && (
|
|
120
177
|
<ItemGroup isBordered isSeparated>
|
|
@@ -135,9 +192,11 @@ function ShadowItem( { shadow, category } ) {
|
|
|
135
192
|
return (
|
|
136
193
|
<NavigationButtonAsItem
|
|
137
194
|
path={ `/shadows/edit/${ category }/${ shadow.slug }` }
|
|
138
|
-
icon={ shadowIcon }
|
|
139
195
|
>
|
|
140
|
-
|
|
196
|
+
<HStack>
|
|
197
|
+
<FlexItem>{ shadow.name }</FlexItem>
|
|
198
|
+
<Icon icon={ isRTL() ? chevronLeft : chevronRight } />
|
|
199
|
+
</HStack>
|
|
141
200
|
</NavigationButtonAsItem>
|
|
142
201
|
);
|
|
143
202
|
}
|
|
@@ -169,10 +169,18 @@
|
|
|
169
169
|
top: $grid-unit;
|
|
170
170
|
opacity: 0;
|
|
171
171
|
|
|
172
|
+
&.edit-site-global-styles__shadow-editor__remove-button {
|
|
173
|
+
border: none;
|
|
174
|
+
}
|
|
175
|
+
|
|
172
176
|
.edit-site-global-styles__shadow-editor__dropdown-toggle:hover + &,
|
|
173
177
|
&:focus,
|
|
174
178
|
&:hover {
|
|
175
|
-
|
|
179
|
+
opacity: 1;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@media (hover: none) {
|
|
183
|
+
// Show reset button on devices that do not support hover.
|
|
176
184
|
opacity: 1;
|
|
177
185
|
}
|
|
178
186
|
}
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
outline-offset: -$border-width;
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
position: relative;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
@media not (prefers-reduced-motion) {
|
|
13
|
+
// Add the same transition that block style variations and other buttons have.
|
|
14
|
+
transition: outline 0.1s linear;
|
|
15
|
+
}
|
|
15
16
|
|
|
16
17
|
&.is-pill {
|
|
17
18
|
height: $button-size-compact;
|
|
@@ -32,7 +32,8 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
|
|
|
32
32
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
33
33
|
import { PluginArea } from '@wordpress/plugins';
|
|
34
34
|
import { store as noticesStore } from '@wordpress/notices';
|
|
35
|
-
import { useDispatch } from '@wordpress/data';
|
|
35
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
36
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Internal dependencies
|
|
@@ -70,6 +71,15 @@ function Layout() {
|
|
|
70
71
|
triggerAnimationOnChange: routeKey + '-' + canvas,
|
|
71
72
|
} );
|
|
72
73
|
|
|
74
|
+
const { showIconLabels } = useSelect( ( select ) => {
|
|
75
|
+
return {
|
|
76
|
+
showIconLabels: select( preferencesStore ).get(
|
|
77
|
+
'core',
|
|
78
|
+
'showIconLabels'
|
|
79
|
+
),
|
|
80
|
+
};
|
|
81
|
+
} );
|
|
82
|
+
|
|
73
83
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
74
84
|
const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
|
|
75
85
|
const previousCanvaMode = usePrevious( canvas );
|
|
@@ -93,6 +103,7 @@ function Layout() {
|
|
|
93
103
|
navigateRegionsProps.className,
|
|
94
104
|
{
|
|
95
105
|
'is-full-canvas': canvas === 'edit',
|
|
106
|
+
'show-icon-labels': showIconLabels,
|
|
96
107
|
}
|
|
97
108
|
) }
|
|
98
109
|
>
|
|
@@ -115,10 +115,13 @@
|
|
|
115
115
|
|
|
116
116
|
.edit-site-resizable-frame__inner-content {
|
|
117
117
|
box-shadow: $elevation-x-small;
|
|
118
|
-
transition: border-radius, box-shadow 0.4s;
|
|
119
118
|
// This ensure the radius work properly.
|
|
120
119
|
overflow: hidden;
|
|
121
120
|
|
|
121
|
+
@media not (prefers-reduced-motion) {
|
|
122
|
+
transition: border-radius, box-shadow 0.4s;
|
|
123
|
+
}
|
|
124
|
+
|
|
122
125
|
.edit-site-layout:not(.is-full-canvas) & {
|
|
123
126
|
border-radius: $radius-large;
|
|
124
127
|
}
|
|
@@ -195,8 +198,6 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
&::before {
|
|
198
|
-
transition: box-shadow 0.1s ease;
|
|
199
|
-
@include reduce-motion("transition");
|
|
200
201
|
content: "";
|
|
201
202
|
display: block;
|
|
202
203
|
position: absolute;
|
|
@@ -206,6 +207,10 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
|
206
207
|
left: 9px;
|
|
207
208
|
border-radius: $radius-medium;
|
|
208
209
|
box-shadow: none;
|
|
210
|
+
|
|
211
|
+
@media not (prefers-reduced-motion) {
|
|
212
|
+
transition: box-shadow 0.1s ease;
|
|
213
|
+
}
|
|
209
214
|
}
|
|
210
215
|
|
|
211
216
|
.edit-site-layout__view-mode-toggle-icon {
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
height: calc(100% - #{$header-height});
|
|
5
5
|
/* stylelint-disable-next-line property-no-unknown -- '@container' not globally permitted */
|
|
6
6
|
container: edit-site-page / inline-size;
|
|
7
|
-
|
|
8
|
-
@
|
|
7
|
+
|
|
8
|
+
@media not (prefers-reduced-motion) {
|
|
9
|
+
transition: width ease-out 0.2s;
|
|
10
|
+
}
|
|
9
11
|
|
|
10
12
|
@include break-medium() {
|
|
11
13
|
height: 100%;
|
|
@@ -19,8 +21,10 @@
|
|
|
19
21
|
position: sticky;
|
|
20
22
|
top: 0;
|
|
21
23
|
z-index: z-index(".edit-site-page-header");
|
|
22
|
-
|
|
23
|
-
@
|
|
24
|
+
|
|
25
|
+
@media not (prefers-reduced-motion) {
|
|
26
|
+
transition: padding ease-out 0.1s;
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
.components-heading {
|
|
26
30
|
color: $gray-900;
|
|
@@ -41,7 +45,6 @@
|
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
45
48
|
@container (max-width: 430px) {
|
|
46
49
|
.edit-site-page-header {
|
|
47
50
|
padding: $grid-unit-20 $grid-unit-30;
|
|
@@ -15,50 +15,25 @@ import {
|
|
|
15
15
|
} from '@wordpress/block-editor';
|
|
16
16
|
import { Icon } from '@wordpress/icons';
|
|
17
17
|
import { parse } from '@wordpress/blocks';
|
|
18
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Internal dependencies
|
|
22
21
|
*/
|
|
23
22
|
import {
|
|
24
|
-
PATTERN_TYPES,
|
|
25
23
|
TEMPLATE_PART_POST_TYPE,
|
|
26
24
|
PATTERN_SYNC_TYPES,
|
|
27
25
|
OPERATOR_IS,
|
|
28
26
|
} from '../../utils/constants';
|
|
29
27
|
import { unlock } from '../../lock-unlock';
|
|
30
28
|
import { useAddedBy } from '../page-templates/hooks';
|
|
31
|
-
import { defaultGetTitle } from './search-items';
|
|
32
29
|
|
|
33
|
-
const { useLink } = unlock( routerPrivateApis );
|
|
34
30
|
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
35
31
|
|
|
36
|
-
function PreviewWrapper( { item, onClick, ariaDescribedBy, children } ) {
|
|
37
|
-
return (
|
|
38
|
-
<button
|
|
39
|
-
className="page-patterns-preview-field__button"
|
|
40
|
-
type="button"
|
|
41
|
-
onClick={ item.type !== PATTERN_TYPES.theme ? onClick : undefined }
|
|
42
|
-
aria-label={ defaultGetTitle( item ) }
|
|
43
|
-
aria-describedby={ ariaDescribedBy }
|
|
44
|
-
aria-disabled={ item.type === PATTERN_TYPES.theme }
|
|
45
|
-
>
|
|
46
|
-
{ children }
|
|
47
|
-
</button>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
32
|
function PreviewField( { item } ) {
|
|
52
33
|
const descriptionId = useId();
|
|
53
34
|
const description = item.description || item?.excerpt?.raw;
|
|
54
|
-
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
55
35
|
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
56
36
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
57
|
-
const { onClick } = useLink(
|
|
58
|
-
`/${ item.type }/${
|
|
59
|
-
isUserPattern || isTemplatePart ? item.id : item.name
|
|
60
|
-
}?canvas=edit`
|
|
61
|
-
);
|
|
62
37
|
const blocks = useMemo( () => {
|
|
63
38
|
return (
|
|
64
39
|
item.blocks ??
|
|
@@ -73,23 +48,18 @@ function PreviewField( { item } ) {
|
|
|
73
48
|
<div
|
|
74
49
|
className="page-patterns-preview-field"
|
|
75
50
|
style={ { backgroundColor } }
|
|
51
|
+
aria-describedby={ !! description ? descriptionId : undefined }
|
|
76
52
|
>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
blocks={ blocks }
|
|
88
|
-
viewportWidth={ item.viewportWidth }
|
|
89
|
-
/>
|
|
90
|
-
</BlockPreview.Async>
|
|
91
|
-
) }
|
|
92
|
-
</PreviewWrapper>
|
|
53
|
+
{ isEmpty && isTemplatePart && __( 'Empty template part' ) }
|
|
54
|
+
{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }
|
|
55
|
+
{ ! isEmpty && (
|
|
56
|
+
<BlockPreview.Async>
|
|
57
|
+
<BlockPreview
|
|
58
|
+
blocks={ blocks }
|
|
59
|
+
viewportWidth={ item.viewportWidth }
|
|
60
|
+
/>
|
|
61
|
+
</BlockPreview.Async>
|
|
62
|
+
) }
|
|
93
63
|
{ !! description && (
|
|
94
64
|
<div hidden id={ descriptionId }>
|
|
95
65
|
{ description }
|
|
@@ -12,28 +12,6 @@
|
|
|
12
12
|
width: 96px;
|
|
13
13
|
flex-grow: 0;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
.page-patterns-preview-field__button {
|
|
17
|
-
box-shadow: none;
|
|
18
|
-
border: none;
|
|
19
|
-
padding: 0;
|
|
20
|
-
background-color: unset;
|
|
21
|
-
box-sizing: border-box;
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
height: 100%;
|
|
25
|
-
border-radius: $grid-unit-05;
|
|
26
|
-
|
|
27
|
-
&:focus-visible {
|
|
28
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
29
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
30
|
-
outline: 2px solid transparent;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&[aria-disabled="true"] {
|
|
34
|
-
cursor: default;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
15
|
}
|
|
38
16
|
|
|
39
17
|
.edit-site-patterns__pattern-icon {
|
|
@@ -48,10 +26,12 @@
|
|
|
48
26
|
top: 0;
|
|
49
27
|
z-index: 2;
|
|
50
28
|
flex-shrink: 0;
|
|
51
|
-
transition: padding ease-out 0.1s;
|
|
52
|
-
@include reduce-motion("transition");
|
|
53
29
|
min-height: $grid-unit-50;
|
|
54
30
|
|
|
31
|
+
@media not (prefers-reduced-motion) {
|
|
32
|
+
transition: padding ease-out 0.1s;
|
|
33
|
+
}
|
|
34
|
+
|
|
55
35
|
.edit-site-patterns__title {
|
|
56
36
|
min-height: $grid-unit-50;
|
|
57
37
|
|
|
@@ -114,7 +94,6 @@
|
|
|
114
94
|
}
|
|
115
95
|
}
|
|
116
96
|
|
|
117
|
-
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
118
97
|
@container (max-width: 430px) {
|
|
119
98
|
.edit-site-page-patterns-dataviews .edit-site-patterns__section-header {
|
|
120
99
|
padding-left: $grid-unit-30;
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
privateApis as blockEditorPrivateApis,
|
|
17
17
|
} from '@wordpress/block-editor';
|
|
18
18
|
import { EditorProvider } from '@wordpress/editor';
|
|
19
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Internal dependencies
|
|
@@ -25,7 +24,6 @@ import { useAddedBy } from './hooks';
|
|
|
25
24
|
import usePatternSettings from '../page-patterns/use-pattern-settings';
|
|
26
25
|
import { unlock } from '../../lock-unlock';
|
|
27
26
|
|
|
28
|
-
const { useLink } = unlock( routerPrivateApis );
|
|
29
27
|
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
30
28
|
|
|
31
29
|
function PreviewField( { item } ) {
|
|
@@ -34,7 +32,6 @@ function PreviewField( { item } ) {
|
|
|
34
32
|
const blocks = useMemo( () => {
|
|
35
33
|
return parse( item.content.raw );
|
|
36
34
|
}, [ item.content.raw ] );
|
|
37
|
-
const { onClick } = useLink( `/${ item.type }/${ item.id }?canvas=edit` );
|
|
38
35
|
|
|
39
36
|
const isEmpty = ! blocks?.length;
|
|
40
37
|
// Wrap everything in a block editor provider to ensure 'styles' that are needed
|
|
@@ -50,19 +47,12 @@ function PreviewField( { item } ) {
|
|
|
50
47
|
className="page-templates-preview-field"
|
|
51
48
|
style={ { backgroundColor } }
|
|
52
49
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{ isEmpty && __( 'Empty template' ) }
|
|
60
|
-
{ ! isEmpty && (
|
|
61
|
-
<BlockPreview.Async>
|
|
62
|
-
<BlockPreview blocks={ blocks } />
|
|
63
|
-
</BlockPreview.Async>
|
|
64
|
-
) }
|
|
65
|
-
</button>
|
|
50
|
+
{ isEmpty && __( 'Empty template' ) }
|
|
51
|
+
{ ! isEmpty && (
|
|
52
|
+
<BlockPreview.Async>
|
|
53
|
+
<BlockPreview blocks={ blocks } />
|
|
54
|
+
</BlockPreview.Async>
|
|
55
|
+
) }
|
|
66
56
|
</div>
|
|
67
57
|
</EditorProvider>
|
|
68
58
|
);
|
|
@@ -5,24 +5,6 @@
|
|
|
5
5
|
width: 100%;
|
|
6
6
|
border-radius: $radius-medium;
|
|
7
7
|
|
|
8
|
-
.page-templates-preview-field__button {
|
|
9
|
-
box-shadow: none;
|
|
10
|
-
border: none;
|
|
11
|
-
padding: 0;
|
|
12
|
-
background-color: unset;
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
overflow: hidden;
|
|
16
|
-
height: 100%;
|
|
17
|
-
border-radius: $radius-medium;
|
|
18
|
-
|
|
19
|
-
&:focus-visible {
|
|
20
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
21
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
22
|
-
outline: 2px solid transparent;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
8
|
.dataviews-view-list & {
|
|
27
9
|
.block-editor-block-preview__container {
|
|
28
10
|
height: 120px;
|
|
@@ -85,9 +67,11 @@
|
|
|
85
67
|
height: $grid-unit-20;
|
|
86
68
|
object-fit: cover;
|
|
87
69
|
opacity: 0;
|
|
88
|
-
transition: opacity 0.1s linear;
|
|
89
|
-
@include reduce-motion("transition");
|
|
90
70
|
border-radius: 100%;
|
|
71
|
+
|
|
72
|
+
@media not (prefers-reduced-motion) {
|
|
73
|
+
transition: opacity 0.1s linear;
|
|
74
|
+
}
|
|
91
75
|
}
|
|
92
76
|
|
|
93
77
|
&.is-loaded {
|
|
@@ -109,6 +109,7 @@ function useView( postType ) {
|
|
|
109
109
|
return {
|
|
110
110
|
...initialView,
|
|
111
111
|
type,
|
|
112
|
+
...defaultLayouts[ type ],
|
|
112
113
|
};
|
|
113
114
|
} );
|
|
114
115
|
|
|
@@ -140,13 +141,15 @@ function useView( postType ) {
|
|
|
140
141
|
// without affecting any other config.
|
|
141
142
|
const onUrlLayoutChange = useEvent( () => {
|
|
142
143
|
setView( ( prevView ) => {
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
144
|
+
const newType = layout ?? LAYOUT_LIST;
|
|
145
|
+
if ( newType === prevView.type ) {
|
|
145
146
|
return prevView;
|
|
146
147
|
}
|
|
148
|
+
|
|
147
149
|
return {
|
|
148
150
|
...prevView,
|
|
149
|
-
type:
|
|
151
|
+
type: newType,
|
|
152
|
+
...defaultLayouts[ newType ],
|
|
150
153
|
};
|
|
151
154
|
} );
|
|
152
155
|
} );
|
|
@@ -168,6 +171,7 @@ function useView( postType ) {
|
|
|
168
171
|
setView( {
|
|
169
172
|
...newView,
|
|
170
173
|
type,
|
|
174
|
+
...defaultLayouts[ type ],
|
|
171
175
|
} );
|
|
172
176
|
}
|
|
173
177
|
} );
|
|
@@ -190,6 +194,10 @@ function getItemId( item ) {
|
|
|
190
194
|
return item.id.toString();
|
|
191
195
|
}
|
|
192
196
|
|
|
197
|
+
function getItemLevel( item ) {
|
|
198
|
+
return item.level;
|
|
199
|
+
}
|
|
200
|
+
|
|
193
201
|
export default function PostList( { postType } ) {
|
|
194
202
|
const [ view, setView ] = useView( postType );
|
|
195
203
|
const defaultViews = useDefaultViews( { postType } );
|
|
@@ -215,7 +223,6 @@ export default function PostList( { postType } ) {
|
|
|
215
223
|
},
|
|
216
224
|
[ location.path, location.query.isCustom, history ]
|
|
217
225
|
);
|
|
218
|
-
|
|
219
226
|
const getActiveViewFilters = ( views, match ) => {
|
|
220
227
|
const found = views.find( ( { slug } ) => slug === match );
|
|
221
228
|
return found?.filters ?? [];
|
|
@@ -296,6 +303,7 @@ export default function PostList( { postType } ) {
|
|
|
296
303
|
_embed: 'author',
|
|
297
304
|
order: view.sort?.direction,
|
|
298
305
|
orderby: view.sort?.field,
|
|
306
|
+
orderby_hierarchy: !! view.showLevels,
|
|
299
307
|
search: view.search,
|
|
300
308
|
...filters,
|
|
301
309
|
};
|
|
@@ -417,6 +425,7 @@ export default function PostList( { postType } ) {
|
|
|
417
425
|
history.navigate( `/${ postType }/${ id }?canvas=edit` );
|
|
418
426
|
} }
|
|
419
427
|
getItemId={ getItemId }
|
|
428
|
+
getItemLevel={ getItemLevel }
|
|
420
429
|
defaultLayouts={ defaultLayouts }
|
|
421
430
|
header={
|
|
422
431
|
window.__experimentalQuickEditDataViews &&
|
|
@@ -27,7 +27,7 @@ import DataViewItem from './dataview-item';
|
|
|
27
27
|
import AddNewItem from './add-new-view';
|
|
28
28
|
import { unlock } from '../../lock-unlock';
|
|
29
29
|
|
|
30
|
-
const { useHistory } = unlock( routerPrivateApis );
|
|
30
|
+
const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
31
31
|
|
|
32
32
|
const EMPTY_ARRAY = [];
|
|
33
33
|
|
|
@@ -85,6 +85,7 @@ function RenameItemModalContent( { dataviewId, currentTitle, setIsRenaming } ) {
|
|
|
85
85
|
|
|
86
86
|
function CustomDataViewItem( { dataviewId, isActive } ) {
|
|
87
87
|
const history = useHistory();
|
|
88
|
+
const location = useLocation();
|
|
88
89
|
const { dataview } = useSelect(
|
|
89
90
|
( select ) => {
|
|
90
91
|
const { getEditedEntityRecord } = select( coreStore );
|
|
@@ -145,10 +146,10 @@ function CustomDataViewItem( { dataviewId, isActive } ) {
|
|
|
145
146
|
}
|
|
146
147
|
);
|
|
147
148
|
if ( isActive ) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
history.replace( {
|
|
150
|
+
postType:
|
|
151
|
+
location.query.postType,
|
|
152
|
+
} );
|
|
152
153
|
}
|
|
153
154
|
onClose();
|
|
154
155
|
} }
|
|
@@ -212,7 +213,7 @@ export default function CustomDataViewsList( { type, activeView, isCustom } ) {
|
|
|
212
213
|
<div className="edit-site-sidebar-navigation-screen-dataviews__group-header">
|
|
213
214
|
<Heading level={ 2 }>{ __( 'Custom Views' ) }</Heading>
|
|
214
215
|
</div>
|
|
215
|
-
<ItemGroup>
|
|
216
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-dataviews__custom-items">
|
|
216
217
|
{ customDataViews.map( ( customViewRecord ) => {
|
|
217
218
|
return (
|
|
218
219
|
<CustomDataViewItem
|
|
@@ -39,9 +39,10 @@ const DEFAULT_POST_BASE = {
|
|
|
39
39
|
page: 1,
|
|
40
40
|
perPage: 20,
|
|
41
41
|
sort: {
|
|
42
|
-
field: '
|
|
43
|
-
direction: '
|
|
42
|
+
field: 'title',
|
|
43
|
+
direction: 'asc',
|
|
44
44
|
},
|
|
45
|
+
showLevels: true,
|
|
45
46
|
titleField: 'title',
|
|
46
47
|
mediaField: 'featured_media',
|
|
47
48
|
fields: [ 'author', 'status' ],
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
margin-right: -$grid-unit-20;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
.edit-site-sidebar-navigation-screen-dataviews__custom-items .edit-site-sidebar-dataviews-dataview-item {
|
|
16
|
+
padding-right: $grid-unit-10;
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
.edit-site-sidebar-dataviews-dataview-item {
|
|
16
20
|
border-radius: $radius-small;
|
|
17
|
-
padding-right: $grid-unit-10;
|
|
18
21
|
|
|
19
22
|
.edit-site-sidebar-dataviews-dataview-item__dropdown-menu {
|
|
20
23
|
min-width: initial;
|