@wordpress/edit-site 6.1.0 → 6.2.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/CHANGELOG.md +8 -6
- package/build/components/add-new-page/index.js +9 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +31 -16
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +11 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +18 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +17 -17
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +2 -2
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +25 -19
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/page-pages/index.js +38 -6
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/index.js +8 -2
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-templates/index.js +10 -3
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +4 -4
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/deprecated.js +11 -0
- package/build/deprecated.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +11 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build-module/components/add-new-page/index.js +10 -2
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +31 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +12 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +19 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +18 -18
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +2 -2
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +25 -19
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +1 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/page-pages/index.js +38 -6
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +8 -2
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-templates/index.js +10 -3
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +5 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/deprecated.js +11 -0
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +11 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-style/style-rtl.css +19 -17
- package/build-style/style.css +19 -17
- package/lib/inflate.js +3188 -3937
- package/lib/lib-font.browser.js +32 -2
- package/lib/unbrotli.js +1818 -2458
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +20 -2
- package/src/components/add-new-pattern/index.js +38 -23
- package/src/components/block-editor/style.scss +0 -11
- package/src/components/editor/index.js +13 -15
- package/src/components/editor-canvas-container/index.js +20 -8
- package/src/components/global-styles/font-families.js +28 -19
- package/src/components/global-styles/font-library-modal/context.js +2 -2
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/variations/variation.js +37 -22
- package/src/components/global-styles/variations/variations-color.js +1 -0
- package/src/components/global-styles/variations/variations-typography.js +1 -0
- package/src/components/page-pages/index.js +45 -11
- package/src/components/page-patterns/index.js +8 -2
- package/src/components/page-patterns/rename-category-menu-item.js +2 -0
- package/src/components/page-templates/index.js +9 -2
- package/src/components/sidebar-dataviews/default-views.js +13 -5
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +6 -1
- package/src/deprecated.js +14 -0
- package/src/hooks/commands/use-set-command-context.js +12 -0
- package/src/lock-unlock.js +1 -1
- package/src/style.scss +13 -0
|
@@ -39,6 +39,7 @@ import AddNewPageModal from '../add-new-page';
|
|
|
39
39
|
import Media from '../media';
|
|
40
40
|
import { unlock } from '../../lock-unlock';
|
|
41
41
|
import { useEditPostAction } from '../dataviews-actions';
|
|
42
|
+
import { usePrevious } from '@wordpress/compose';
|
|
42
43
|
|
|
43
44
|
const { usePostActions } = unlock( editorPrivateApis );
|
|
44
45
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
@@ -201,10 +202,18 @@ function FeaturedImage( { item, viewType } ) {
|
|
|
201
202
|
);
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
function getItemId( item ) {
|
|
206
|
+
return item.id.toString();
|
|
207
|
+
}
|
|
208
|
+
|
|
204
209
|
export default function PagePages() {
|
|
205
210
|
const postType = 'page';
|
|
206
211
|
const [ view, setView ] = useView( postType );
|
|
207
212
|
const history = useHistory();
|
|
213
|
+
const {
|
|
214
|
+
params: { postId },
|
|
215
|
+
} = useLocation();
|
|
216
|
+
const [ selection, setSelection ] = useState( [ postId ] );
|
|
208
217
|
|
|
209
218
|
const onSelectionChange = useCallback(
|
|
210
219
|
( items ) => {
|
|
@@ -266,6 +275,20 @@ export default function PagePages() {
|
|
|
266
275
|
totalPages,
|
|
267
276
|
} = useEntityRecords( 'postType', postType, queryArgs );
|
|
268
277
|
|
|
278
|
+
const ids = pages?.map( ( page ) => getItemId( page ) ) ?? [];
|
|
279
|
+
const prevIds = usePrevious( ids ) ?? [];
|
|
280
|
+
const deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );
|
|
281
|
+
const postIdWasDeleted = deletedIds.includes( postId );
|
|
282
|
+
|
|
283
|
+
useEffect( () => {
|
|
284
|
+
if ( postIdWasDeleted ) {
|
|
285
|
+
history.push( {
|
|
286
|
+
...history.getLocationWithParams().params,
|
|
287
|
+
postId: undefined,
|
|
288
|
+
} );
|
|
289
|
+
}
|
|
290
|
+
}, [ postIdWasDeleted, history ] );
|
|
291
|
+
|
|
269
292
|
const { records: authors, isResolving: isLoadingAuthors } =
|
|
270
293
|
useEntityRecords( 'root', 'user', { per_page: -1 } );
|
|
271
294
|
|
|
@@ -277,15 +300,19 @@ export default function PagePages() {
|
|
|
277
300
|
[ totalItems, totalPages ]
|
|
278
301
|
);
|
|
279
302
|
|
|
280
|
-
const { frontPageId, postsPageId, addNewLabel } = useSelect(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
303
|
+
const { frontPageId, postsPageId, addNewLabel, canCreatePage } = useSelect(
|
|
304
|
+
( select ) => {
|
|
305
|
+
const { getEntityRecord, getPostType, canUser } =
|
|
306
|
+
select( coreStore );
|
|
307
|
+
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
308
|
+
return {
|
|
309
|
+
frontPageId: siteSettings?.page_on_front,
|
|
310
|
+
postsPageId: siteSettings?.page_for_posts,
|
|
311
|
+
addNewLabel: getPostType( 'page' )?.labels?.add_new_item,
|
|
312
|
+
canCreatePage: canUser( 'create', 'pages' ),
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
);
|
|
289
316
|
|
|
290
317
|
const fields = useMemo(
|
|
291
318
|
() => [
|
|
@@ -456,7 +483,10 @@ export default function PagePages() {
|
|
|
456
483
|
[ authors, view.type, frontPageId, postsPageId ]
|
|
457
484
|
);
|
|
458
485
|
|
|
459
|
-
const postTypeActions = usePostActions(
|
|
486
|
+
const postTypeActions = usePostActions( {
|
|
487
|
+
postType: 'page',
|
|
488
|
+
context: 'list',
|
|
489
|
+
} );
|
|
460
490
|
const editAction = useEditPostAction();
|
|
461
491
|
const actions = useMemo(
|
|
462
492
|
() => [ editAction, ...postTypeActions ],
|
|
@@ -496,7 +526,8 @@ export default function PagePages() {
|
|
|
496
526
|
<Page
|
|
497
527
|
title={ __( 'Pages' ) }
|
|
498
528
|
actions={
|
|
499
|
-
addNewLabel &&
|
|
529
|
+
addNewLabel &&
|
|
530
|
+
canCreatePage && (
|
|
500
531
|
<>
|
|
501
532
|
<Button
|
|
502
533
|
variant="primary"
|
|
@@ -523,7 +554,10 @@ export default function PagePages() {
|
|
|
523
554
|
isLoading={ isLoadingPages || isLoadingAuthors }
|
|
524
555
|
view={ view }
|
|
525
556
|
onChangeView={ onChangeView }
|
|
557
|
+
selection={ selection }
|
|
558
|
+
setSelection={ setSelection }
|
|
526
559
|
onSelectionChange={ onSelectionChange }
|
|
560
|
+
getItemId={ getItemId }
|
|
527
561
|
/>
|
|
528
562
|
</Page>
|
|
529
563
|
);
|
|
@@ -354,8 +354,14 @@ export default function DataviewsPatterns() {
|
|
|
354
354
|
return filterSortAndPaginate( patterns, viewWithoutFilters, fields );
|
|
355
355
|
}, [ patterns, view, fields, type ] );
|
|
356
356
|
|
|
357
|
-
const templatePartActions = usePostActions(
|
|
358
|
-
|
|
357
|
+
const templatePartActions = usePostActions( {
|
|
358
|
+
postType: TEMPLATE_PART_POST_TYPE,
|
|
359
|
+
context: 'list',
|
|
360
|
+
} );
|
|
361
|
+
const patternActions = usePostActions( {
|
|
362
|
+
postType: PATTERN_TYPES.user,
|
|
363
|
+
context: 'list',
|
|
364
|
+
} );
|
|
359
365
|
const editAction = useEditPostAction();
|
|
360
366
|
|
|
361
367
|
const actions = useMemo( () => {
|
|
@@ -186,7 +186,9 @@ function Preview( { item, viewType } ) {
|
|
|
186
186
|
|
|
187
187
|
export default function PageTemplates() {
|
|
188
188
|
const { params } = useLocation();
|
|
189
|
-
const { activeView = 'all', layout } = params;
|
|
189
|
+
const { activeView = 'all', layout, postId } = params;
|
|
190
|
+
const [ selection, setSelection ] = useState( [ postId ] );
|
|
191
|
+
|
|
190
192
|
const defaultView = useMemo( () => {
|
|
191
193
|
const usedType = layout ?? DEFAULT_VIEW.type;
|
|
192
194
|
return {
|
|
@@ -323,7 +325,10 @@ export default function PageTemplates() {
|
|
|
323
325
|
return filterSortAndPaginate( records, view, fields );
|
|
324
326
|
}, [ records, view, fields ] );
|
|
325
327
|
|
|
326
|
-
const postTypeActions = usePostActions(
|
|
328
|
+
const postTypeActions = usePostActions( {
|
|
329
|
+
postType: TEMPLATE_POST_TYPE,
|
|
330
|
+
context: 'list',
|
|
331
|
+
} );
|
|
327
332
|
const editAction = useEditPostAction();
|
|
328
333
|
const actions = useMemo(
|
|
329
334
|
() => [ editAction, ...postTypeActions ],
|
|
@@ -366,6 +371,8 @@ export default function PageTemplates() {
|
|
|
366
371
|
view={ view }
|
|
367
372
|
onChangeView={ onChangeView }
|
|
368
373
|
onSelectionChange={ onSelectionChange }
|
|
374
|
+
selection={ selection }
|
|
375
|
+
setSelection={ setSelection }
|
|
369
376
|
/>
|
|
370
377
|
</Page>
|
|
371
378
|
);
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
trash,
|
|
7
|
+
pages,
|
|
8
|
+
drafts,
|
|
9
|
+
published,
|
|
10
|
+
scheduled,
|
|
11
|
+
pending,
|
|
12
|
+
notAllowed,
|
|
13
|
+
} from '@wordpress/icons';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
16
|
* Internal dependencies
|
|
@@ -57,7 +65,7 @@ export const DEFAULT_VIEWS = {
|
|
|
57
65
|
{
|
|
58
66
|
title: __( 'Published' ),
|
|
59
67
|
slug: 'published',
|
|
60
|
-
icon:
|
|
68
|
+
icon: published,
|
|
61
69
|
view: {
|
|
62
70
|
...DEFAULT_PAGE_BASE,
|
|
63
71
|
filters: [
|
|
@@ -72,7 +80,7 @@ export const DEFAULT_VIEWS = {
|
|
|
72
80
|
{
|
|
73
81
|
title: __( 'Scheduled' ),
|
|
74
82
|
slug: 'future',
|
|
75
|
-
icon:
|
|
83
|
+
icon: scheduled,
|
|
76
84
|
view: {
|
|
77
85
|
...DEFAULT_PAGE_BASE,
|
|
78
86
|
filters: [
|
|
@@ -102,7 +110,7 @@ export const DEFAULT_VIEWS = {
|
|
|
102
110
|
{
|
|
103
111
|
title: __( 'Pending' ),
|
|
104
112
|
slug: 'pending',
|
|
105
|
-
icon:
|
|
113
|
+
icon: pending,
|
|
106
114
|
view: {
|
|
107
115
|
...DEFAULT_PAGE_BASE,
|
|
108
116
|
filters: [
|
|
@@ -117,7 +125,7 @@ export const DEFAULT_VIEWS = {
|
|
|
117
125
|
{
|
|
118
126
|
title: __( 'Private' ),
|
|
119
127
|
slug: 'private',
|
|
120
|
-
icon:
|
|
128
|
+
icon: notAllowed,
|
|
121
129
|
view: {
|
|
122
130
|
...DEFAULT_PAGE_BASE,
|
|
123
131
|
filters: [
|
|
@@ -22,7 +22,12 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
|
|
|
22
22
|
titleHasChanged && notEmptyString( editedMenuTitle );
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<Modal
|
|
25
|
+
<Modal
|
|
26
|
+
title={ __( 'Rename' ) }
|
|
27
|
+
onRequestClose={ onClose }
|
|
28
|
+
focusOnMount="firstContentElement"
|
|
29
|
+
size="small"
|
|
30
|
+
>
|
|
26
31
|
<form className="sidebar-navigation__rename-modal-form">
|
|
27
32
|
<VStack spacing="3">
|
|
28
33
|
<TextControl
|
package/src/deprecated.js
CHANGED
|
@@ -6,8 +6,13 @@ import {
|
|
|
6
6
|
PluginSidebar as EditorPluginSidebar,
|
|
7
7
|
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
|
|
8
8
|
} from '@wordpress/editor';
|
|
9
|
+
import { getPath } from '@wordpress/url';
|
|
9
10
|
import deprecated from '@wordpress/deprecated';
|
|
10
11
|
|
|
12
|
+
const isSiteEditor = getPath( window.location.href )?.includes(
|
|
13
|
+
'site-editor.php'
|
|
14
|
+
);
|
|
15
|
+
|
|
11
16
|
const deprecateSlot = ( name ) => {
|
|
12
17
|
deprecated( `wp.editPost.${ name }`, {
|
|
13
18
|
since: '6.6',
|
|
@@ -20,6 +25,9 @@ const deprecateSlot = ( name ) => {
|
|
|
20
25
|
* @see PluginMoreMenuItem in @wordpress/editor package.
|
|
21
26
|
*/
|
|
22
27
|
export function PluginMoreMenuItem( props ) {
|
|
28
|
+
if ( ! isSiteEditor ) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
23
31
|
deprecateSlot( 'PluginMoreMenuItem' );
|
|
24
32
|
return <EditorPluginMoreMenuItem { ...props } />;
|
|
25
33
|
}
|
|
@@ -28,6 +36,9 @@ export function PluginMoreMenuItem( props ) {
|
|
|
28
36
|
* @see PluginSidebar in @wordpress/editor package.
|
|
29
37
|
*/
|
|
30
38
|
export function PluginSidebar( props ) {
|
|
39
|
+
if ( ! isSiteEditor ) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
31
42
|
deprecateSlot( 'PluginSidebar' );
|
|
32
43
|
return <EditorPluginSidebar { ...props } />;
|
|
33
44
|
}
|
|
@@ -36,6 +47,9 @@ export function PluginSidebar( props ) {
|
|
|
36
47
|
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
|
|
37
48
|
*/
|
|
38
49
|
export function PluginSidebarMoreMenuItem( props ) {
|
|
50
|
+
if ( ! isSiteEditor ) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
39
53
|
deprecateSlot( 'PluginSidebarMoreMenuItem' );
|
|
40
54
|
return <EditorPluginSidebarMoreMenuItem { ...props } />;
|
|
41
55
|
}
|
|
@@ -10,6 +10,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
10
10
|
*/
|
|
11
11
|
import { store as editSiteStore } from '../../store';
|
|
12
12
|
import { unlock } from '../../lock-unlock';
|
|
13
|
+
import { useHasEditorCanvasContainer } from '../../components/editor-canvas-container';
|
|
13
14
|
|
|
14
15
|
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
15
16
|
|
|
@@ -25,6 +26,9 @@ export default function useSetCommandContext() {
|
|
|
25
26
|
hasBlockSelected: getBlockSelectionStart(),
|
|
26
27
|
};
|
|
27
28
|
}, [] );
|
|
29
|
+
|
|
30
|
+
const hasEditorCanvasContainer = useHasEditorCanvasContainer();
|
|
31
|
+
|
|
28
32
|
// Sets the right context for the command palette
|
|
29
33
|
let commandContext = 'site-editor';
|
|
30
34
|
if ( canvasMode === 'edit' ) {
|
|
@@ -33,5 +37,13 @@ export default function useSetCommandContext() {
|
|
|
33
37
|
if ( hasBlockSelected ) {
|
|
34
38
|
commandContext = 'block-selection-edit';
|
|
35
39
|
}
|
|
40
|
+
if ( hasEditorCanvasContainer ) {
|
|
41
|
+
/*
|
|
42
|
+
* The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context
|
|
43
|
+
* to remove the suggested commands that may not make sense with Style Book or Style Revisions open.
|
|
44
|
+
* See https://github.com/WordPress/gutenberg/issues/62216.
|
|
45
|
+
*/
|
|
46
|
+
commandContext = '';
|
|
47
|
+
}
|
|
36
48
|
useCommandContext( commandContext );
|
|
37
49
|
}
|
package/src/lock-unlock.js
CHANGED
|
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
|
|
|
5
5
|
|
|
6
6
|
export const { lock, unlock } =
|
|
7
7
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
-
'I
|
|
8
|
+
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
|
9
9
|
'@wordpress/edit-site'
|
|
10
10
|
);
|
package/src/style.scss
CHANGED
|
@@ -36,6 +36,19 @@
|
|
|
36
36
|
@import "./components/pagination/style.scss";
|
|
37
37
|
@import "./components/global-styles/variations/style.scss";
|
|
38
38
|
|
|
39
|
+
/* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
|
|
40
|
+
::view-transition-image-pair(root) {
|
|
41
|
+
isolation: auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
::view-transition-old(root),
|
|
45
|
+
::view-transition-new(root) {
|
|
46
|
+
animation: none;
|
|
47
|
+
mix-blend-mode: normal;
|
|
48
|
+
display: block;
|
|
49
|
+
}
|
|
50
|
+
/* stylelint-enable */
|
|
51
|
+
|
|
39
52
|
body.js #wpadminbar {
|
|
40
53
|
display: none;
|
|
41
54
|
}
|