@wordpress/edit-site 5.12.13 → 5.12.14
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/layout/index.js +3 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +9 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +28 -34
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/layout/index.js +3 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +28 -34
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-style/style-rtl.css +12 -5
- package/build-style/style.css +12 -5
- package/package.json +11 -11
- package/src/components/header-edit-mode/document-actions/style.scss +5 -0
- package/src/components/layout/index.js +27 -20
- package/src/components/layout/style.scss +2 -2
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
- package/src/components/sidebar-navigation-screen/index.js +11 -1
- package/src/components/sidebar-navigation-screen/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +42 -38
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.14",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.35.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
34
|
-
"@wordpress/blocks": "^12.12.
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
32
|
+
"@wordpress/block-editor": "^12.3.12",
|
|
33
|
+
"@wordpress/block-library": "^8.12.14",
|
|
34
|
+
"@wordpress/blocks": "^12.12.7",
|
|
35
|
+
"@wordpress/commands": "^0.6.11",
|
|
36
36
|
"@wordpress/components": "^25.1.10",
|
|
37
37
|
"@wordpress/compose": "^6.12.2",
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
38
|
+
"@wordpress/core-commands": "^0.4.12",
|
|
39
|
+
"@wordpress/core-data": "^6.12.12",
|
|
40
40
|
"@wordpress/data": "^9.5.5",
|
|
41
41
|
"@wordpress/date": "^4.35.1",
|
|
42
42
|
"@wordpress/deprecated": "^3.35.1",
|
|
43
43
|
"@wordpress/dom": "^3.35.1",
|
|
44
|
-
"@wordpress/editor": "^13.12.
|
|
44
|
+
"@wordpress/editor": "^13.12.12",
|
|
45
45
|
"@wordpress/element": "^5.12.1",
|
|
46
46
|
"@wordpress/escape-html": "^2.35.1",
|
|
47
47
|
"@wordpress/hooks": "^3.35.1",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"@wordpress/preferences": "^3.12.10",
|
|
58
58
|
"@wordpress/primitives": "^3.33.1",
|
|
59
59
|
"@wordpress/private-apis": "^0.17.2",
|
|
60
|
-
"@wordpress/reusable-blocks": "^4.12.
|
|
60
|
+
"@wordpress/reusable-blocks": "^4.12.12",
|
|
61
61
|
"@wordpress/router": "^0.4.2",
|
|
62
62
|
"@wordpress/style-engine": "^1.18.1",
|
|
63
63
|
"@wordpress/url": "^3.36.1",
|
|
64
64
|
"@wordpress/viewport": "^5.12.5",
|
|
65
|
-
"@wordpress/widgets": "^3.12.
|
|
65
|
+
"@wordpress/widgets": "^3.12.12",
|
|
66
66
|
"@wordpress/wordcount": "^3.35.1",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"classnames": "^2.3.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "53cd9574a54a643c73e76fe1abaa8d1be489f8f7"
|
|
88
88
|
}
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
border-radius: 4px;
|
|
14
14
|
width: min(100%, 450px);
|
|
15
15
|
|
|
16
|
+
// Make the document title shorter in top-toolbar mode, as it has to be covered.
|
|
17
|
+
.has-fixed-toolbar & {
|
|
18
|
+
width: min(100%, 380px);
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
.components-button {
|
|
17
22
|
&:hover {
|
|
18
23
|
color: var(--wp-block-synced-color);
|
|
@@ -260,28 +260,35 @@ export default function Layout() {
|
|
|
260
260
|
</motion.div>
|
|
261
261
|
|
|
262
262
|
<div className="edit-site-layout__content">
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
transition={ {
|
|
271
|
-
type: 'tween',
|
|
272
|
-
duration:
|
|
273
|
-
// Disable transition in mobile to emulate a full page transition.
|
|
274
|
-
disableMotion || isMobileViewport
|
|
275
|
-
? 0
|
|
276
|
-
: ANIMATION_DURATION,
|
|
277
|
-
ease: 'easeOut',
|
|
278
|
-
} }
|
|
279
|
-
className="edit-site-layout__sidebar"
|
|
263
|
+
{ /*
|
|
264
|
+
The NavigableRegion must always be rendered and not use
|
|
265
|
+
`inert` otherwise `useNavigateRegions` will fail.
|
|
266
|
+
*/ }
|
|
267
|
+
<NavigableRegion
|
|
268
|
+
ariaLabel={ __( 'Navigation' ) }
|
|
269
|
+
className="edit-site-layout__sidebar-region"
|
|
280
270
|
>
|
|
281
|
-
<
|
|
271
|
+
<motion.div
|
|
272
|
+
// The sidebar is needed for routing on mobile
|
|
273
|
+
// (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
|
|
274
|
+
// so we can't remove the element entirely. Using `inert` will make
|
|
275
|
+
// it inaccessible to screen readers and keyboard navigation.
|
|
276
|
+
inert={ showSidebar ? undefined : 'inert' }
|
|
277
|
+
animate={ { opacity: showSidebar ? 1 : 0 } }
|
|
278
|
+
transition={ {
|
|
279
|
+
type: 'tween',
|
|
280
|
+
duration:
|
|
281
|
+
// Disable transition in mobile to emulate a full page transition.
|
|
282
|
+
disableMotion || isMobileViewport
|
|
283
|
+
? 0
|
|
284
|
+
: ANIMATION_DURATION,
|
|
285
|
+
ease: 'easeOut',
|
|
286
|
+
} }
|
|
287
|
+
className="edit-site-layout__sidebar"
|
|
288
|
+
>
|
|
282
289
|
<Sidebar />
|
|
283
|
-
</
|
|
284
|
-
</
|
|
290
|
+
</motion.div>
|
|
291
|
+
</NavigableRegion>
|
|
285
292
|
|
|
286
293
|
<SavePanel />
|
|
287
294
|
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
display: flex;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.edit-site-layout__sidebar {
|
|
61
|
+
.edit-site-layout__sidebar-region {
|
|
62
62
|
z-index: z-index(".edit-site-layout__sidebar");
|
|
63
63
|
width: 100vw;
|
|
64
64
|
flex-shrink: 0;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
top: 0;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
.edit-site-layout__sidebar {
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: column;
|
|
81
81
|
height: 100%;
|
|
@@ -49,7 +49,7 @@ export function useDisableNonPageContentBlocks() {
|
|
|
49
49
|
|
|
50
50
|
const withDisableNonPageContentBlocks = createHigherOrderComponent(
|
|
51
51
|
( BlockEdit ) => ( props ) => {
|
|
52
|
-
const isDescendentOfQueryLoop =
|
|
52
|
+
const isDescendentOfQueryLoop = props.context.queryId !== undefined;
|
|
53
53
|
const isPageContent =
|
|
54
54
|
PAGE_CONTENT_BLOCK_TYPES.includes( props.name ) &&
|
|
55
55
|
! isDescendentOfQueryLoop;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -51,7 +56,12 @@ export default function SidebarNavigationScreen( {
|
|
|
51
56
|
return (
|
|
52
57
|
<>
|
|
53
58
|
<VStack
|
|
54
|
-
className=
|
|
59
|
+
className={ classnames(
|
|
60
|
+
'edit-site-sidebar-navigation-screen__main',
|
|
61
|
+
{
|
|
62
|
+
'has-footer': !! footer,
|
|
63
|
+
}
|
|
64
|
+
) }
|
|
55
65
|
spacing={ 0 }
|
|
56
66
|
justify="flex-start"
|
|
57
67
|
>
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
// Ensure the sidebar is always at least as tall as the viewport.
|
|
10
10
|
// This allows the footer section to be sticky at the bottom of the viewport.
|
|
11
11
|
flex-grow: 1;
|
|
12
|
+
margin-bottom: $grid-unit-20;
|
|
13
|
+
&.has-footer {
|
|
14
|
+
margin-bottom: 0;
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
.edit-site-sidebar-navigation-screen__content {
|
|
@@ -108,30 +108,10 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function SidebarNavigationScreenGlobalStylesFooter( {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
select( coreStore );
|
|
116
|
-
|
|
117
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
118
|
-
const globalStyles = globalStylesId
|
|
119
|
-
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
120
|
-
: undefined;
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
revisionsCount:
|
|
124
|
-
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,
|
|
125
|
-
};
|
|
126
|
-
}, [] );
|
|
127
|
-
|
|
128
|
-
const hasRevisions = revisionsCount >= 2;
|
|
129
|
-
const modified = revisions?.[ 0 ]?.modified;
|
|
130
|
-
|
|
131
|
-
if ( ! hasRevisions || isLoading || ! modified ) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
|
|
111
|
+
function SidebarNavigationScreenGlobalStylesFooter( {
|
|
112
|
+
modifiedDateTime,
|
|
113
|
+
onClickRevisions,
|
|
114
|
+
} ) {
|
|
135
115
|
return (
|
|
136
116
|
<VStack className="edit-site-sidebar-navigation-screen-global-styles__footer">
|
|
137
117
|
<SidebarNavigationItem
|
|
@@ -150,8 +130,8 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
|
|
|
150
130
|
{ __( 'Last modified' ) }
|
|
151
131
|
</span>
|
|
152
132
|
<span>
|
|
153
|
-
<time dateTime={
|
|
154
|
-
{ humanTimeDiff(
|
|
133
|
+
<time dateTime={ modifiedDateTime }>
|
|
134
|
+
{ humanTimeDiff( modifiedDateTime ) }
|
|
155
135
|
</time>
|
|
156
136
|
</span>
|
|
157
137
|
<Icon icon={ backup } style={ { fill: 'currentcolor' } } />
|
|
@@ -162,6 +142,8 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
|
|
|
162
142
|
}
|
|
163
143
|
|
|
164
144
|
export default function SidebarNavigationScreenGlobalStyles() {
|
|
145
|
+
const { revisions, isLoading: isLoadingRevisions } =
|
|
146
|
+
useGlobalStylesRevisions();
|
|
165
147
|
const { openGeneralSidebar, setIsListViewOpened } =
|
|
166
148
|
useDispatch( editSiteStore );
|
|
167
149
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
@@ -171,15 +153,28 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
171
153
|
const { createNotice } = useDispatch( noticesStore );
|
|
172
154
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
173
155
|
const { get: getPrefference } = useSelect( preferencesStore );
|
|
174
|
-
const { isViewMode, isStyleBookOpened } = useSelect(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
156
|
+
const { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(
|
|
157
|
+
( select ) => {
|
|
158
|
+
const { getCanvasMode, getEditorCanvasContainerView } = unlock(
|
|
159
|
+
select( editSiteStore )
|
|
160
|
+
);
|
|
161
|
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
162
|
+
select( coreStore );
|
|
163
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
164
|
+
const globalStyles = globalStylesId
|
|
165
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
166
|
+
: undefined;
|
|
167
|
+
return {
|
|
168
|
+
isViewMode: 'view' === getCanvasMode(),
|
|
169
|
+
isStyleBookOpened:
|
|
170
|
+
'style-book' === getEditorCanvasContainerView(),
|
|
171
|
+
revisionsCount:
|
|
172
|
+
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??
|
|
173
|
+
0,
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
[]
|
|
177
|
+
);
|
|
183
178
|
|
|
184
179
|
const turnOffDistractionFreeMode = useCallback( () => {
|
|
185
180
|
const isDistractionFree = getPrefference(
|
|
@@ -226,6 +221,12 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
226
221
|
setEditorCanvasContainerView( 'global-styles-revisions' );
|
|
227
222
|
}, [ openGlobalStyles, setEditorCanvasContainerView ] );
|
|
228
223
|
|
|
224
|
+
// If there are no revisions, do not render a footer.
|
|
225
|
+
const hasRevisions = revisionsCount >= 2;
|
|
226
|
+
const modifiedDateTime = revisions?.[ 0 ]?.modified;
|
|
227
|
+
const shouldShowGlobalStylesFooter =
|
|
228
|
+
hasRevisions && ! isLoadingRevisions && modifiedDateTime;
|
|
229
|
+
|
|
229
230
|
return (
|
|
230
231
|
<>
|
|
231
232
|
<SidebarNavigationScreen
|
|
@@ -235,9 +236,12 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
235
236
|
) }
|
|
236
237
|
content={ <SidebarNavigationScreenGlobalStylesContent /> }
|
|
237
238
|
footer={
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
shouldShowGlobalStylesFooter && (
|
|
240
|
+
<SidebarNavigationScreenGlobalStylesFooter
|
|
241
|
+
modifiedDateTime={ modifiedDateTime }
|
|
242
|
+
onClickRevisions={ openRevisions }
|
|
243
|
+
/>
|
|
244
|
+
)
|
|
241
245
|
}
|
|
242
246
|
actions={
|
|
243
247
|
<>
|
package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
privateApis as blockEditorPrivateApis,
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
BlockList,
|
|
8
|
-
BlockTools,
|
|
9
8
|
} from '@wordpress/block-editor';
|
|
10
9
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
10
|
import { createBlock } from '@wordpress/blocks';
|
|
@@ -106,9 +105,7 @@ export default function NavigationMenuContent( { rootClientId } ) {
|
|
|
106
105
|
/>
|
|
107
106
|
) }
|
|
108
107
|
<div className="edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor">
|
|
109
|
-
<
|
|
110
|
-
<BlockList />
|
|
111
|
-
</BlockTools>
|
|
108
|
+
<BlockList />
|
|
112
109
|
</div>
|
|
113
110
|
</>
|
|
114
111
|
);
|