@wordpress/edit-site 5.12.6 → 5.12.7
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/block-editor/use-site-editor-settings.js +10 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +1 -1
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +1 -1
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +2 -10
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/index.js +1 -0
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +68 -43
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-hub/index.js +1 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/template-actions/index.js +22 -6
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +2 -2
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +2 -2
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +1 -2
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +1 -1
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +1 -1
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -3
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +2 -10
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +1 -0
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +71 -44
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/template-actions/index.js +24 -7
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -2
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +2 -2
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +1 -2
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +48 -7
- package/build-style/style.css +48 -7
- package/package.json +19 -19
- package/src/components/block-editor/use-site-editor-settings.js +8 -4
- package/src/components/create-pattern-modal/index.js +1 -1
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/header-edit-mode/document-actions/style.scss +8 -0
- package/src/components/header-edit-mode/index.js +17 -9
- package/src/components/layout/index.js +1 -1
- package/src/components/layout/style.scss +0 -11
- package/src/components/page/header.js +1 -1
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/grid-item.js +6 -1
- package/src/components/page-patterns/patterns-list.js +3 -3
- package/src/components/page-patterns/use-patterns.js +3 -9
- package/src/components/page-template-parts/index.js +1 -1
- package/src/components/page-templates/index.js +1 -1
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-navigation-screen/style.scss +19 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +56 -39
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +85 -75
- package/src/components/sidebar-navigation-screen-patterns/style.scss +26 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/site-hub/index.js +1 -1
- package/src/components/template-actions/index.js +38 -8
- package/src/components/welcome-guide/page.js +2 -2
- package/src/components/welcome-guide/template.js +2 -2
- package/src/hooks/commands/use-edit-mode-commands.js +0 -1
- package/src/store/private-actions.js +5 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/src/components/page-content-focus-manager/constants.js +0 -5
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Notice } from '@wordpress/components';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
|
+
|
|
9
|
+
const PREFERENCE_NAME = 'isTemplatePartMoveHintVisible';
|
|
10
|
+
|
|
11
|
+
export default function TemplatePartHint() {
|
|
12
|
+
const showTemplatePartHint = useSelect(
|
|
13
|
+
( select ) =>
|
|
14
|
+
select( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,
|
|
15
|
+
[]
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const { set: setPreference } = useDispatch( preferencesStore );
|
|
19
|
+
if ( ! showTemplatePartHint ) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Notice
|
|
25
|
+
politeness="polite"
|
|
26
|
+
className="edit-site-sidebar__notice"
|
|
27
|
+
onRemove={ () => {
|
|
28
|
+
setPreference( 'core', PREFERENCE_NAME, false );
|
|
29
|
+
} }
|
|
30
|
+
>
|
|
31
|
+
{ __(
|
|
32
|
+
'Looking for template parts? You can now find them in the new "Patterns" page.'
|
|
33
|
+
) }
|
|
34
|
+
</Notice>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -2,23 +2,20 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
5
|
import { pencil } from '@wordpress/icons';
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
9
8
|
*/
|
|
10
|
-
import { store as editSiteStore } from '../../store';
|
|
11
9
|
import SidebarButton from '../sidebar-button';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
export default function EditButton() {
|
|
15
|
-
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
10
|
+
import { useLink } from '../routes/link';
|
|
16
11
|
|
|
12
|
+
export default function EditButton( { postId } ) {
|
|
13
|
+
const linkInfo = useLink( {
|
|
14
|
+
postId,
|
|
15
|
+
postType: 'wp_navigation',
|
|
16
|
+
canvas: 'edit',
|
|
17
|
+
} );
|
|
17
18
|
return (
|
|
18
|
-
<SidebarButton
|
|
19
|
-
onClick={ () => setCanvasMode( 'edit' ) }
|
|
20
|
-
label={ __( 'Edit' ) }
|
|
21
|
-
icon={ pencil }
|
|
22
|
-
/>
|
|
19
|
+
<SidebarButton { ...linkInfo } label={ __( 'Edit' ) } icon={ pencil } />
|
|
23
20
|
);
|
|
24
21
|
}
|
|
@@ -9,6 +9,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
9
9
|
import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';
|
|
10
10
|
import ScreenNavigationMoreMenu from './more-menu';
|
|
11
11
|
import NavigationMenuEditor from './navigation-menu-editor';
|
|
12
|
+
import EditButton from './edit-button';
|
|
12
13
|
|
|
13
14
|
export default function SingleNavigationMenu( {
|
|
14
15
|
navigationMenu,
|
|
@@ -21,12 +22,15 @@ export default function SingleNavigationMenu( {
|
|
|
21
22
|
return (
|
|
22
23
|
<SidebarNavigationScreenWrapper
|
|
23
24
|
actions={
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
<>
|
|
26
|
+
<EditButton postId={ navigationMenu?.id } />
|
|
27
|
+
<ScreenNavigationMoreMenu
|
|
28
|
+
menuTitle={ decodeEntities( menuTitle ) }
|
|
29
|
+
onDelete={ handleDelete }
|
|
30
|
+
onSave={ handleSave }
|
|
31
|
+
onDuplicate={ handleDuplicate }
|
|
32
|
+
/>
|
|
33
|
+
</>
|
|
30
34
|
}
|
|
31
35
|
title={ decodeEntities( menuTitle ) }
|
|
32
36
|
description={ __(
|
|
@@ -43,7 +43,7 @@ const pendingIcon = (
|
|
|
43
43
|
|
|
44
44
|
export default function StatusLabel( { status, date, short } ) {
|
|
45
45
|
const relateToNow = humanTimeDiff( date );
|
|
46
|
-
let statusLabel =
|
|
46
|
+
let statusLabel = status;
|
|
47
47
|
let statusIcon = pendingIcon;
|
|
48
48
|
switch ( status ) {
|
|
49
49
|
case 'publish':
|
|
@@ -38,7 +38,7 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
38
38
|
if ( ! descriptionText && addedBy.text ) {
|
|
39
39
|
descriptionText = sprintf(
|
|
40
40
|
// translators: %s: pattern title e.g: "Header".
|
|
41
|
-
__( 'This is
|
|
41
|
+
__( 'This is the %s pattern.' ),
|
|
42
42
|
getTitle()
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -46,7 +46,7 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
46
46
|
if ( ! descriptionText && postType === 'wp_block' && record?.title ) {
|
|
47
47
|
descriptionText = sprintf(
|
|
48
48
|
// translators: %s: user created pattern title e.g. "Footer".
|
|
49
|
-
__( 'This is
|
|
49
|
+
__( 'This is the %s pattern.' ),
|
|
50
50
|
record.title
|
|
51
51
|
);
|
|
52
52
|
}
|
|
@@ -95,7 +95,7 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
95
95
|
details.push( {
|
|
96
96
|
label: __( 'Syncing' ),
|
|
97
97
|
value:
|
|
98
|
-
record.
|
|
98
|
+
record.wp_pattern_sync_status === 'unsynced'
|
|
99
99
|
? __( 'Not synced' )
|
|
100
100
|
: __( 'Fully synced' ),
|
|
101
101
|
} );
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Flex,
|
|
8
8
|
Icon,
|
|
9
9
|
Tooltip,
|
|
10
|
+
__experimentalHeading as Heading,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
13
|
import { useSelect } from '@wordpress/data';
|
|
@@ -29,12 +30,79 @@ import usePatternCategories from './use-pattern-categories';
|
|
|
29
30
|
import useMyPatterns from './use-my-patterns';
|
|
30
31
|
import useTemplatePartAreas from './use-template-part-areas';
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
33
|
+
function TemplatePartGroup( { areas, currentArea, currentType } ) {
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<div className="edit-site-sidebar-navigation-screen-patterns__group-header">
|
|
37
|
+
<Heading level={ 2 }>{ __( 'Template parts' ) }</Heading>
|
|
38
|
+
<p>{ __( 'Synced patterns for use in template building.' ) }</p>
|
|
39
|
+
</div>
|
|
40
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
41
|
+
{ Object.entries( areas ).map(
|
|
42
|
+
( [ area, { label, templateParts } ] ) => (
|
|
43
|
+
<CategoryItem
|
|
44
|
+
key={ area }
|
|
45
|
+
count={ templateParts?.length }
|
|
46
|
+
icon={ getTemplatePartIcon( area ) }
|
|
47
|
+
label={ label }
|
|
48
|
+
id={ area }
|
|
49
|
+
type="wp_template_part"
|
|
50
|
+
isActive={
|
|
51
|
+
currentArea === area &&
|
|
52
|
+
currentType === 'wp_template_part'
|
|
53
|
+
}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
) }
|
|
57
|
+
</ItemGroup>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function ThemePatternsGroup( { categories, currentCategory, currentType } ) {
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<div className="edit-site-sidebar-navigation-screen-patterns__group-header">
|
|
66
|
+
<Heading level={ 2 }>{ __( 'Theme patterns' ) }</Heading>
|
|
67
|
+
<p>
|
|
68
|
+
{ __(
|
|
69
|
+
'For insertion into documents where they can then be customized.'
|
|
70
|
+
) }
|
|
71
|
+
</p>
|
|
72
|
+
</div>
|
|
73
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
74
|
+
{ categories.map( ( category ) => (
|
|
75
|
+
<CategoryItem
|
|
76
|
+
key={ category.name }
|
|
77
|
+
count={ category.count }
|
|
78
|
+
label={
|
|
79
|
+
<Flex justify="left" align="center" gap={ 0 }>
|
|
80
|
+
{ category.label }
|
|
81
|
+
<Tooltip
|
|
82
|
+
position="top center"
|
|
83
|
+
text={ __(
|
|
84
|
+
'Theme patterns cannot be edited.'
|
|
85
|
+
) }
|
|
86
|
+
>
|
|
87
|
+
<span className="edit-site-sidebar-navigation-screen-pattern__lock-icon">
|
|
88
|
+
<Icon icon={ lockSmall } size={ 24 } />
|
|
89
|
+
</span>
|
|
90
|
+
</Tooltip>
|
|
91
|
+
</Flex>
|
|
92
|
+
}
|
|
93
|
+
icon={ file }
|
|
94
|
+
id={ category.name }
|
|
95
|
+
type="pattern"
|
|
96
|
+
isActive={
|
|
97
|
+
currentCategory === `${ category.name }` &&
|
|
98
|
+
currentType === 'pattern'
|
|
99
|
+
}
|
|
100
|
+
/>
|
|
101
|
+
) ) }
|
|
102
|
+
</ItemGroup>
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
38
106
|
|
|
39
107
|
export default function SidebarNavigationScreenPatterns() {
|
|
40
108
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
@@ -73,7 +141,7 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
73
141
|
isRoot={ isTemplatePartsMode }
|
|
74
142
|
title={ __( 'Patterns' ) }
|
|
75
143
|
description={ __(
|
|
76
|
-
'Manage what patterns are available when editing
|
|
144
|
+
'Manage what patterns are available when editing the site.'
|
|
77
145
|
) }
|
|
78
146
|
actions={ <AddNewPattern /> }
|
|
79
147
|
footer={ footer }
|
|
@@ -109,76 +177,18 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
109
177
|
</ItemGroup>
|
|
110
178
|
) }
|
|
111
179
|
{ hasTemplateParts && (
|
|
112
|
-
<
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
count={ parts.length }
|
|
118
|
-
icon={ getTemplatePartIcon(
|
|
119
|
-
area
|
|
120
|
-
) }
|
|
121
|
-
label={
|
|
122
|
-
templatePartAreaLabels[
|
|
123
|
-
area
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
id={ area }
|
|
127
|
-
type="wp_template_part"
|
|
128
|
-
isActive={
|
|
129
|
-
currentCategory === area &&
|
|
130
|
-
currentType ===
|
|
131
|
-
'wp_template_part'
|
|
132
|
-
}
|
|
133
|
-
/>
|
|
134
|
-
)
|
|
135
|
-
) }
|
|
136
|
-
</ItemGroup>
|
|
180
|
+
<TemplatePartGroup
|
|
181
|
+
areas={ templatePartAreas }
|
|
182
|
+
currentArea={ currentCategory }
|
|
183
|
+
currentType={ currentType }
|
|
184
|
+
/>
|
|
137
185
|
) }
|
|
138
186
|
{ hasPatterns && (
|
|
139
|
-
<
|
|
140
|
-
{ patternCategories
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
label={
|
|
145
|
-
<Flex
|
|
146
|
-
justify="left"
|
|
147
|
-
align="center"
|
|
148
|
-
gap={ 0 }
|
|
149
|
-
>
|
|
150
|
-
{ category.label }
|
|
151
|
-
<Tooltip
|
|
152
|
-
position="top center"
|
|
153
|
-
text={ __(
|
|
154
|
-
'Theme patterns cannot be edited.'
|
|
155
|
-
) }
|
|
156
|
-
>
|
|
157
|
-
<span className="edit-site-sidebar-navigation-screen-pattern__lock-icon">
|
|
158
|
-
<Icon
|
|
159
|
-
style={ {
|
|
160
|
-
fill: 'currentcolor',
|
|
161
|
-
} }
|
|
162
|
-
icon={
|
|
163
|
-
lockSmall
|
|
164
|
-
}
|
|
165
|
-
size={ 24 }
|
|
166
|
-
/>
|
|
167
|
-
</span>
|
|
168
|
-
</Tooltip>
|
|
169
|
-
</Flex>
|
|
170
|
-
}
|
|
171
|
-
icon={ file }
|
|
172
|
-
id={ category.name }
|
|
173
|
-
type="pattern"
|
|
174
|
-
isActive={
|
|
175
|
-
currentCategory ===
|
|
176
|
-
`${ category.name }` &&
|
|
177
|
-
currentType === 'pattern'
|
|
178
|
-
}
|
|
179
|
-
/>
|
|
180
|
-
) ) }
|
|
181
|
-
</ItemGroup>
|
|
187
|
+
<ThemePatternsGroup
|
|
188
|
+
categories={ patternCategories }
|
|
189
|
+
currentCategory={ currentCategory }
|
|
190
|
+
currentType={ currentType }
|
|
191
|
+
/>
|
|
182
192
|
) }
|
|
183
193
|
</>
|
|
184
194
|
) }
|
|
@@ -1,3 +1,28 @@
|
|
|
1
1
|
.edit-site-sidebar-navigation-screen-patterns__group {
|
|
2
|
-
margin-bottom: $grid-unit-
|
|
2
|
+
margin-bottom: $grid-unit-40;
|
|
3
|
+
padding-bottom: $grid-unit-30;
|
|
4
|
+
border-bottom: 1px solid $gray-800;
|
|
5
|
+
|
|
6
|
+
&:last-of-type,
|
|
7
|
+
&:first-of-type {
|
|
8
|
+
border-bottom: 0;
|
|
9
|
+
padding-bottom: 0;
|
|
10
|
+
margin-bottom: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&:first-of-type {
|
|
14
|
+
margin-bottom: $grid-unit-40;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.edit-site-sidebar-navigation-screen-patterns__group-header {
|
|
19
|
+
p {
|
|
20
|
+
color: $gray-600;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
h2 {
|
|
24
|
+
font-size: 11px;
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
text-transform: uppercase;
|
|
27
|
+
}
|
|
3
28
|
}
|
|
@@ -2,19 +2,41 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
5
7
|
|
|
6
|
-
const
|
|
8
|
+
const useTemplatePartsGroupedByArea = ( items ) => {
|
|
7
9
|
const allItems = items || [];
|
|
8
10
|
|
|
9
|
-
const
|
|
10
|
-
(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return accumulator;
|
|
14
|
-
},
|
|
15
|
-
{ header: [], footer: [], sidebar: [], uncategorized: [] }
|
|
11
|
+
const templatePartAreas = useSelect(
|
|
12
|
+
( select ) =>
|
|
13
|
+
select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
|
|
14
|
+
[]
|
|
16
15
|
);
|
|
17
16
|
|
|
17
|
+
// Create map of template areas ensuring that default areas are displayed before
|
|
18
|
+
// any custom registered template part areas.
|
|
19
|
+
const knownAreas = {
|
|
20
|
+
header: {},
|
|
21
|
+
footer: {},
|
|
22
|
+
sidebar: {},
|
|
23
|
+
uncategorized: {},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
templatePartAreas.forEach(
|
|
27
|
+
( templatePartArea ) =>
|
|
28
|
+
( knownAreas[ templatePartArea.area ] = {
|
|
29
|
+
...templatePartArea,
|
|
30
|
+
templateParts: [],
|
|
31
|
+
} )
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const groupedByArea = allItems.reduce( ( accumulator, item ) => {
|
|
35
|
+
const key = accumulator[ item.area ] ? item.area : 'uncategorized';
|
|
36
|
+
accumulator[ key ].templateParts.push( item );
|
|
37
|
+
return accumulator;
|
|
38
|
+
}, knownAreas );
|
|
39
|
+
|
|
18
40
|
return groupedByArea;
|
|
19
41
|
};
|
|
20
42
|
|
|
@@ -28,6 +50,6 @@ export default function useTemplatePartAreas() {
|
|
|
28
50
|
return {
|
|
29
51
|
hasTemplateParts: templateParts ? !! templateParts.length : false,
|
|
30
52
|
isLoading,
|
|
31
|
-
templatePartAreas:
|
|
53
|
+
templatePartAreas: useTemplatePartsGroupedByArea( templateParts ),
|
|
32
54
|
};
|
|
33
55
|
}
|
|
@@ -174,7 +174,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
174
174
|
className="edit-site-site-hub_toggle-command-center"
|
|
175
175
|
icon={ search }
|
|
176
176
|
onClick={ () => openCommandCenter() }
|
|
177
|
-
label={ __( 'Open command
|
|
177
|
+
label={ __( 'Open command palette' ) }
|
|
178
178
|
/>
|
|
179
179
|
) }
|
|
180
180
|
</HStack>
|
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { useState } from '@wordpress/element';
|
|
6
7
|
import { __, sprintf } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
DropdownMenu,
|
|
10
|
+
MenuGroup,
|
|
11
|
+
MenuItem,
|
|
12
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
13
|
+
} from '@wordpress/components';
|
|
8
14
|
import { moreVertical } from '@wordpress/icons';
|
|
9
15
|
import { store as noticesStore } from '@wordpress/notices';
|
|
10
16
|
|
|
@@ -84,17 +90,14 @@ export default function TemplateActions( {
|
|
|
84
90
|
template={ template }
|
|
85
91
|
onClose={ onClose }
|
|
86
92
|
/>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
isTertiary
|
|
90
|
-
onClick={ () => {
|
|
93
|
+
<DeleteMenuItem
|
|
94
|
+
onRemove={ () => {
|
|
91
95
|
removeTemplate( template );
|
|
92
96
|
onRemove?.();
|
|
93
97
|
onClose();
|
|
94
98
|
} }
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
</MenuItem>
|
|
99
|
+
isTemplate={ template.type === 'wp_template' }
|
|
100
|
+
/>
|
|
98
101
|
</>
|
|
99
102
|
) }
|
|
100
103
|
{ isRevertable && (
|
|
@@ -115,3 +118,30 @@ export default function TemplateActions( {
|
|
|
115
118
|
</DropdownMenu>
|
|
116
119
|
);
|
|
117
120
|
}
|
|
121
|
+
|
|
122
|
+
function DeleteMenuItem( { onRemove, isTemplate } ) {
|
|
123
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
124
|
+
return (
|
|
125
|
+
<>
|
|
126
|
+
<MenuItem
|
|
127
|
+
isDestructive
|
|
128
|
+
isTertiary
|
|
129
|
+
onClick={ () => setIsModalOpen( true ) }
|
|
130
|
+
>
|
|
131
|
+
{ __( 'Delete' ) }
|
|
132
|
+
</MenuItem>
|
|
133
|
+
<ConfirmDialog
|
|
134
|
+
isOpen={ isModalOpen }
|
|
135
|
+
onConfirm={ onRemove }
|
|
136
|
+
onCancel={ () => setIsModalOpen( false ) }
|
|
137
|
+
confirmButtonText={ __( 'Delete' ) }
|
|
138
|
+
>
|
|
139
|
+
{ isTemplate
|
|
140
|
+
? __( 'Are you sure you want to delete this template?' )
|
|
141
|
+
: __(
|
|
142
|
+
'Are you sure you want to delete this template part?'
|
|
143
|
+
) }
|
|
144
|
+
</ConfirmDialog>
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
@@ -31,7 +31,7 @@ export default function WelcomeGuidePage() {
|
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const heading = __( 'Editing
|
|
34
|
+
const heading = __( 'Editing a page' );
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
37
|
<Guide
|
|
@@ -63,7 +63,7 @@ export default function WelcomeGuidePage() {
|
|
|
63
63
|
</h1>
|
|
64
64
|
<p className="edit-site-welcome-guide__text">
|
|
65
65
|
{ __(
|
|
66
|
-
'
|
|
66
|
+
'It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.'
|
|
67
67
|
) }
|
|
68
68
|
</p>
|
|
69
69
|
</>
|
|
@@ -36,7 +36,7 @@ export default function WelcomeGuideTemplate() {
|
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const heading = __( 'Editing
|
|
39
|
+
const heading = __( 'Editing a template' );
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<Guide
|
|
@@ -70,7 +70,7 @@ export default function WelcomeGuideTemplate() {
|
|
|
70
70
|
</h1>
|
|
71
71
|
<p className="edit-site-welcome-guide__text">
|
|
72
72
|
{ __(
|
|
73
|
-
'
|
|
73
|
+
'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'
|
|
74
74
|
) }
|
|
75
75
|
</p>
|
|
76
76
|
</>
|
|
@@ -11,7 +11,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
11
11
|
*/
|
|
12
12
|
export const setCanvasMode =
|
|
13
13
|
( mode ) =>
|
|
14
|
-
( { registry, dispatch } ) => {
|
|
14
|
+
( { registry, dispatch, select } ) => {
|
|
15
15
|
registry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );
|
|
16
16
|
dispatch( {
|
|
17
17
|
type: 'SET_CANVAS_MODE',
|
|
@@ -26,6 +26,10 @@ export const setCanvasMode =
|
|
|
26
26
|
) {
|
|
27
27
|
dispatch.setIsListViewOpened( true );
|
|
28
28
|
}
|
|
29
|
+
// Switch focus away from editing the template when switching to view mode.
|
|
30
|
+
if ( mode === 'view' && select.isPage() ) {
|
|
31
|
+
dispatch.setHasPageContentFocus( true );
|
|
32
|
+
}
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
/**
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PAGE_CONTENT_BLOCK_TYPES = void 0;
|
|
7
|
-
const PAGE_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content'];
|
|
8
|
-
exports.PAGE_CONTENT_BLOCK_TYPES = PAGE_CONTENT_BLOCK_TYPES;
|
|
9
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-content-focus-manager/constants.js"],"names":["PAGE_CONTENT_BLOCK_TYPES"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAG,CACvC,iBADuC,EAEvC,0BAFuC,EAGvC,mBAHuC,CAAjC","sourcesContent":["export const PAGE_CONTENT_BLOCK_TYPES = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n];\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-content-focus-manager/constants.js"],"names":["PAGE_CONTENT_BLOCK_TYPES"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAG,CACvC,iBADuC,EAEvC,0BAFuC,EAGvC,mBAHuC,CAAjC","sourcesContent":["export const PAGE_CONTENT_BLOCK_TYPES = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n];\n"]}
|