@wordpress/edit-site 5.10.0 → 5.11.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 +2 -0
- package/build/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +11 -21
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/new-template.js +98 -65
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +1 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +6 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +15 -40
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +10 -3
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/screen-block.js +80 -3
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +3 -10
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +16 -18
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -24
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +4 -4
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +6 -10
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/ui.js +9 -9
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +28 -103
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +14 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/hooks.js +54 -0
- package/build/components/layout/hooks.js.map +1 -0
- package/build/components/layout/index.js +45 -98
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -2
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +242 -0
- package/build/components/resizable-frame/index.js.map +1 -0
- package/build/components/revisions/index.js +2 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +4 -3
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +4 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js +1 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +24 -33
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +53 -103
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +87 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +36 -11
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +1 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +93 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +8 -4
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +105 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build/store/actions.js +5 -3
- package/build/store/actions.js.map +1 -1
- package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +13 -22
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/new-template.js +98 -67
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +1 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +7 -8
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +16 -43
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +7 -3
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +82 -4
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +3 -10
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +16 -19
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -24
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +4 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +7 -11
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/ui.js +10 -10
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +14 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/hooks.js +41 -0
- package/build-module/components/layout/hooks.js.map +1 -0
- package/build-module/components/layout/index.js +46 -101
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +6 -3
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +228 -0
- package/build-module/components/resizable-frame/index.js.map +1 -0
- package/build-module/components/revisions/index.js +2 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -3
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +21 -32
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -103
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +71 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +12 -71
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +35 -11
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +93 -20
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +8 -4
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build-module/store/actions.js +5 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +233 -210
- package/build-style/style.css +234 -210
- package/package.json +37 -37
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
- package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +13 -26
- package/src/components/add-new-template/new-template.js +139 -153
- package/src/components/add-new-template/style.scss +79 -66
- package/src/components/block-editor/index.js +2 -3
- package/src/components/create-template-part-modal/index.js +19 -25
- package/src/components/editor/index.js +16 -45
- package/src/components/editor/style.scss +21 -6
- package/src/components/editor-canvas-container/index.js +28 -19
- package/src/components/global-styles/screen-block.js +74 -3
- package/src/components/global-styles/screen-revisions/index.js +3 -11
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +33 -25
- package/src/components/global-styles/screen-revisions/style.scss +3 -2
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +16 -3
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -19
- package/src/components/global-styles/screen-root.js +5 -3
- package/src/components/global-styles/style-variations-container.js +13 -18
- package/src/components/global-styles/style.scss +3 -0
- package/src/components/global-styles/ui.js +11 -9
- package/src/components/header-edit-mode/document-actions/index.js +26 -129
- package/src/components/header-edit-mode/document-actions/style.scss +28 -59
- package/src/components/header-edit-mode/index.js +18 -0
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/hooks.js +46 -0
- package/src/components/layout/index.js +56 -125
- package/src/components/layout/style.scss +8 -2
- package/src/components/list/actions/index.js +12 -5
- package/src/components/list/style.scss +1 -0
- package/src/components/resizable-frame/index.js +253 -0
- package/src/components/resizable-frame/style.scss +69 -0
- package/src/components/revisions/index.js +1 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +2 -1
- package/src/components/sidebar/index.js +4 -4
- package/src/components/sidebar-edit-mode/template-revisions/index.js +1 -2
- package/src/components/sidebar-navigation-item/style.scss +9 -0
- package/src/components/sidebar-navigation-screen/style.scss +1 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
- package/src/components/sidebar-navigation-screen-main/index.js +35 -52
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -117
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +6 -72
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
- package/src/components/sidebar-navigation-screen-templates/index.js +53 -14
- package/src/components/site-hub/index.js +8 -9
- package/src/components/start-template-options/style.scss +20 -21
- package/src/components/style-book/index.js +132 -43
- package/src/components/style-book/style.scss +19 -0
- package/src/components/use-edited-entity-record/index.js +12 -3
- package/src/hooks/commands/use-edit-mode-commands.js +79 -0
- package/src/store/actions.js +4 -5
- package/src/store/test/utils.js +15 -5
- package/src/style.scss +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build/components/global-styles/border-panel.js +0 -135
- package/build/components/global-styles/border-panel.js.map +0 -1
- package/build/components/navigate-to-link/index.js +0 -51
- package/build/components/navigate-to-link/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build/components/template-details/edit-template-title.js +0 -42
- package/build/components/template-details/edit-template-title.js.map +0 -1
- package/build/components/template-details/index.js +0 -103
- package/build/components/template-details/index.js.map +0 -1
- package/build/components/template-details/template-areas.js +0 -166
- package/build/components/template-details/template-areas.js.map +0 -1
- package/build/components/template-details/template-part-area-selector.js +0 -48
- package/build/components/template-details/template-part-area-selector.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build-module/components/global-styles/border-panel.js +0 -125
- package/build-module/components/global-styles/border-panel.js.map +0 -1
- package/build-module/components/navigate-to-link/index.js +0 -39
- package/build-module/components/navigate-to-link/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build-module/components/template-details/edit-template-title.js +0 -33
- package/build-module/components/template-details/edit-template-title.js.map +0 -1
- package/build-module/components/template-details/index.js +0 -83
- package/build-module/components/template-details/index.js.map +0 -1
- package/build-module/components/template-details/template-areas.js +0 -145
- package/build-module/components/template-details/template-areas.js.map +0 -1
- package/build-module/components/template-details/template-part-area-selector.js +0 -36
- package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
- package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
- package/src/components/global-styles/border-panel.js +0 -114
- package/src/components/navigate-to-link/index.js +0 -46
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
- package/src/components/template-details/edit-template-title.js +0 -41
- package/src/components/template-details/index.js +0 -113
- package/src/components/template-details/style.scss +0 -72
- package/src/components/template-details/template-areas.js +0 -167
- package/src/components/template-details/template-part-area-selector.js +0 -39
|
@@ -11,6 +11,7 @@ import { useEntityRecords } from '@wordpress/core-data';
|
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
12
12
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
13
|
import { useViewportMatch } from '@wordpress/compose';
|
|
14
|
+
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
@@ -36,14 +37,31 @@ const config = {
|
|
|
36
37
|
},
|
|
37
38
|
wp_template_part: {
|
|
38
39
|
labels: {
|
|
39
|
-
title: __( '
|
|
40
|
-
loading: __( 'Loading
|
|
41
|
-
notFound: __( 'No
|
|
40
|
+
title: __( 'Library' ),
|
|
41
|
+
loading: __( 'Loading library' ),
|
|
42
|
+
notFound: __( 'No patterns found' ),
|
|
42
43
|
manage: __( 'Manage all template parts' ),
|
|
44
|
+
reusableBlocks: __( 'Manage reusable blocks' ),
|
|
43
45
|
description: __(
|
|
44
|
-
'
|
|
46
|
+
'Manage what patterns are available when editing your site.'
|
|
45
47
|
),
|
|
46
48
|
},
|
|
49
|
+
sortCallback: ( items ) => {
|
|
50
|
+
const groupedByArea = items.reduce(
|
|
51
|
+
( accumulator, item ) => {
|
|
52
|
+
const key = accumulator[ item.area ] ? item.area : 'rest';
|
|
53
|
+
accumulator[ key ].push( item );
|
|
54
|
+
return accumulator;
|
|
55
|
+
},
|
|
56
|
+
{ header: [], footer: [], sidebar: [], rest: [] }
|
|
57
|
+
);
|
|
58
|
+
return [
|
|
59
|
+
...groupedByArea.header,
|
|
60
|
+
...groupedByArea.footer,
|
|
61
|
+
...groupedByArea.sidebar,
|
|
62
|
+
...groupedByArea.rest,
|
|
63
|
+
];
|
|
64
|
+
},
|
|
47
65
|
},
|
|
48
66
|
};
|
|
49
67
|
|
|
@@ -73,17 +91,20 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
73
91
|
per_page: -1,
|
|
74
92
|
}
|
|
75
93
|
);
|
|
76
|
-
|
|
94
|
+
let sortedTemplates = templates ? [ ...templates ] : [];
|
|
77
95
|
sortedTemplates.sort( ( a, b ) =>
|
|
78
96
|
a.title.rendered.localeCompare( b.title.rendered )
|
|
79
97
|
);
|
|
98
|
+
if ( config[ postType ].sortCallback ) {
|
|
99
|
+
sortedTemplates = config[ postType ].sortCallback( sortedTemplates );
|
|
100
|
+
}
|
|
80
101
|
|
|
81
102
|
const browseAllLink = useLink( {
|
|
82
103
|
path: '/' + postType + '/all',
|
|
83
104
|
} );
|
|
84
105
|
|
|
85
106
|
const canCreate = ! isMobileViewport && ! isTemplatePartsMode;
|
|
86
|
-
|
|
107
|
+
const isTemplateList = postType === 'wp_template';
|
|
87
108
|
return (
|
|
88
109
|
<SidebarNavigationScreen
|
|
89
110
|
isRoot={ isTemplatePartsMode }
|
|
@@ -115,6 +136,10 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
115
136
|
postId={ template.id }
|
|
116
137
|
key={ template.id }
|
|
117
138
|
withChevron
|
|
139
|
+
icon={
|
|
140
|
+
! isTemplateList &&
|
|
141
|
+
getTemplatePartIcon( template.area )
|
|
142
|
+
}
|
|
118
143
|
>
|
|
119
144
|
{ decodeEntities(
|
|
120
145
|
template.title?.rendered ||
|
|
@@ -123,14 +148,28 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
123
148
|
</TemplateItem>
|
|
124
149
|
) ) }
|
|
125
150
|
{ ! isMobileViewport && (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
151
|
+
<>
|
|
152
|
+
<SidebarNavigationItem
|
|
153
|
+
className="edit-site-sidebar-navigation-screen-templates__see-all"
|
|
154
|
+
withChevron
|
|
155
|
+
{ ...browseAllLink }
|
|
156
|
+
>
|
|
157
|
+
{ config[ postType ].labels.manage }
|
|
158
|
+
</SidebarNavigationItem>
|
|
159
|
+
{ !! config[ postType ].labels
|
|
160
|
+
.reusableBlocks && (
|
|
161
|
+
<SidebarNavigationItem
|
|
162
|
+
as="a"
|
|
163
|
+
href="edit.php?post_type=wp_block"
|
|
164
|
+
withChevron
|
|
165
|
+
>
|
|
166
|
+
{
|
|
167
|
+
config[ postType ].labels
|
|
168
|
+
.reusableBlocks
|
|
169
|
+
}
|
|
170
|
+
</SidebarNavigationItem>
|
|
171
|
+
) }
|
|
172
|
+
</>
|
|
134
173
|
) }
|
|
135
174
|
</ItemGroup>
|
|
136
175
|
) }
|
|
@@ -150,15 +150,14 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
150
150
|
</motion.div>
|
|
151
151
|
</AnimatePresence>
|
|
152
152
|
</HStack>
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
) }
|
|
153
|
+
{ canvasMode === 'view' && (
|
|
154
|
+
<Button
|
|
155
|
+
className="edit-site-site-hub_toggle-command-center"
|
|
156
|
+
icon={ search }
|
|
157
|
+
onClick={ () => openCommandCenter() }
|
|
158
|
+
label={ __( 'Open command center' ) }
|
|
159
|
+
/>
|
|
160
|
+
) }
|
|
162
161
|
</HStack>
|
|
163
162
|
</motion.div>
|
|
164
163
|
);
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
.components-modal__content {
|
|
3
|
-
padding-bottom: 0;
|
|
4
|
-
}
|
|
1
|
+
$actions-height: 92px;
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
border-top: 1px solid $gray-300;
|
|
20
|
-
z-index: z-index(".edit-site-start-template-options__modal__actions");
|
|
21
|
-
}
|
|
3
|
+
.edit-site-start-template-options__modal {
|
|
4
|
+
.edit-site-start-template-options__modal__actions {
|
|
5
|
+
position: absolute;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: $actions-height;
|
|
9
|
+
background-color: $white;
|
|
10
|
+
margin-left: - $grid-unit-40;
|
|
11
|
+
margin-right: - $grid-unit-40;
|
|
12
|
+
padding-left: $grid-unit-40;
|
|
13
|
+
padding-right: $grid-unit-40;
|
|
14
|
+
border-top: 1px solid $gray-300;
|
|
15
|
+
z-index: z-index(".edit-site-start-template-options__modal__actions");
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
.block-editor-block-patterns-list {
|
|
25
|
-
|
|
19
|
+
// Since the actions container is positioned absolutely,
|
|
20
|
+
// this padding bottom ensures that the content wrapper will properly
|
|
21
|
+
// detect overflowing content and start showing scrollbars at the right
|
|
22
|
+
// moment. Without this padding, the content would render under the actions
|
|
23
|
+
// bar without causing the wrapper to show a scrollbar.
|
|
24
|
+
padding-bottom: $actions-height;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Disabled,
|
|
14
14
|
TabPanel,
|
|
15
15
|
} from '@wordpress/components';
|
|
16
|
+
|
|
16
17
|
import { __, sprintf } from '@wordpress/i18n';
|
|
17
18
|
import {
|
|
18
19
|
getCategories,
|
|
@@ -29,7 +30,8 @@ import {
|
|
|
29
30
|
} from '@wordpress/block-editor';
|
|
30
31
|
import { useSelect } from '@wordpress/data';
|
|
31
32
|
import { useResizeObserver } from '@wordpress/compose';
|
|
32
|
-
import { useMemo, memo } from '@wordpress/element';
|
|
33
|
+
import { useMemo, useState, memo } from '@wordpress/element';
|
|
34
|
+
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* Internal dependencies
|
|
@@ -161,7 +163,14 @@ function getExamples() {
|
|
|
161
163
|
return [ headingsExample, ...otherExamples ];
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
function StyleBook( {
|
|
166
|
+
function StyleBook( {
|
|
167
|
+
enableResizing = true,
|
|
168
|
+
isSelected,
|
|
169
|
+
onClick,
|
|
170
|
+
onSelect,
|
|
171
|
+
showCloseButton = true,
|
|
172
|
+
showTabs = true,
|
|
173
|
+
} ) {
|
|
165
174
|
const [ resizeObserver, sizes ] = useResizeObserver();
|
|
166
175
|
const [ textColor ] = useGlobalStyle( 'color.text' );
|
|
167
176
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
@@ -192,10 +201,16 @@ function StyleBook( { isSelected, onSelect } ) {
|
|
|
192
201
|
);
|
|
193
202
|
|
|
194
203
|
return (
|
|
195
|
-
<EditorCanvasContainer
|
|
204
|
+
<EditorCanvasContainer
|
|
205
|
+
enableResizing={ enableResizing }
|
|
206
|
+
closeButtonLabel={
|
|
207
|
+
showCloseButton ? __( 'Close Style Book' ) : null
|
|
208
|
+
}
|
|
209
|
+
>
|
|
196
210
|
<div
|
|
197
211
|
className={ classnames( 'edit-site-style-book', {
|
|
198
212
|
'is-wide': sizes.width > 600,
|
|
213
|
+
'is-button': !! onClick,
|
|
199
214
|
} ) }
|
|
200
215
|
style={ {
|
|
201
216
|
color: textColor,
|
|
@@ -203,53 +218,125 @@ function StyleBook( { isSelected, onSelect } ) {
|
|
|
203
218
|
} }
|
|
204
219
|
>
|
|
205
220
|
{ resizeObserver }
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
name="style-book-canvas"
|
|
214
|
-
tabIndex={ 0 }
|
|
215
|
-
>
|
|
216
|
-
<EditorStyles styles={ settings.styles } />
|
|
217
|
-
<style>
|
|
218
|
-
{
|
|
219
|
-
// Forming a "block formatting context" to prevent margin collapsing.
|
|
220
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
221
|
-
`.is-root-container { display: flow-root; }
|
|
222
|
-
body { position: relative; padding: 32px !important; }` +
|
|
223
|
-
STYLE_BOOK_IFRAME_STYLES
|
|
224
|
-
}
|
|
225
|
-
</style>
|
|
226
|
-
<Examples
|
|
227
|
-
className={ classnames(
|
|
228
|
-
'edit-site-style-book__examples',
|
|
229
|
-
{
|
|
230
|
-
'is-wide': sizes.width > 600,
|
|
231
|
-
}
|
|
232
|
-
) }
|
|
233
|
-
examples={ examples }
|
|
221
|
+
{ showTabs ? (
|
|
222
|
+
<TabPanel
|
|
223
|
+
className="edit-site-style-book__tab-panel"
|
|
224
|
+
tabs={ tabs }
|
|
225
|
+
>
|
|
226
|
+
{ ( tab ) => (
|
|
227
|
+
<StyleBookBody
|
|
234
228
|
category={ tab.name }
|
|
235
|
-
|
|
236
|
-
// translators: %s: Category of blocks, e.g. Text.
|
|
237
|
-
__(
|
|
238
|
-
'Examples of blocks in the %s category'
|
|
239
|
-
),
|
|
240
|
-
tab.title
|
|
241
|
-
) }
|
|
229
|
+
examples={ examples }
|
|
242
230
|
isSelected={ isSelected }
|
|
243
231
|
onSelect={ onSelect }
|
|
232
|
+
settings={ settings }
|
|
233
|
+
sizes={ sizes }
|
|
234
|
+
title={ tab.title }
|
|
244
235
|
/>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
236
|
+
) }
|
|
237
|
+
</TabPanel>
|
|
238
|
+
) : (
|
|
239
|
+
<StyleBookBody
|
|
240
|
+
examples={ examples }
|
|
241
|
+
isSelected={ isSelected }
|
|
242
|
+
onClick={ onClick }
|
|
243
|
+
onSelect={ onSelect }
|
|
244
|
+
settings={ settings }
|
|
245
|
+
sizes={ sizes }
|
|
246
|
+
/>
|
|
247
|
+
) }
|
|
248
248
|
</div>
|
|
249
249
|
</EditorCanvasContainer>
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
const StyleBookBody = ( {
|
|
254
|
+
category,
|
|
255
|
+
examples,
|
|
256
|
+
isSelected,
|
|
257
|
+
onClick,
|
|
258
|
+
onSelect,
|
|
259
|
+
settings,
|
|
260
|
+
sizes,
|
|
261
|
+
title,
|
|
262
|
+
} ) => {
|
|
263
|
+
const [ isFocused, setIsFocused ] = useState( false );
|
|
264
|
+
|
|
265
|
+
// The presence of an `onClick` prop indicates that the Style Book is being used as a button.
|
|
266
|
+
// In this case, add additional props to the iframe to make it behave like a button.
|
|
267
|
+
const buttonModeProps = {
|
|
268
|
+
role: 'button',
|
|
269
|
+
onFocus: () => setIsFocused( true ),
|
|
270
|
+
onBlur: () => setIsFocused( false ),
|
|
271
|
+
onKeyDown: ( event ) => {
|
|
272
|
+
if ( event.defaultPrevented ) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const { keyCode } = event;
|
|
276
|
+
if ( onClick && ( keyCode === ENTER || keyCode === SPACE ) ) {
|
|
277
|
+
event.preventDefault();
|
|
278
|
+
onClick( event );
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
onClick: ( event ) => {
|
|
282
|
+
if ( event.defaultPrevented ) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if ( onClick ) {
|
|
286
|
+
event.preventDefault();
|
|
287
|
+
onClick( event );
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
readonly: true,
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const buttonModeStyles = onClick
|
|
294
|
+
? 'body { cursor: pointer; } body * { pointer-events: none; }'
|
|
295
|
+
: '';
|
|
296
|
+
|
|
297
|
+
return (
|
|
298
|
+
<Iframe
|
|
299
|
+
className={ classnames( 'edit-site-style-book__iframe', {
|
|
300
|
+
'is-focused': isFocused && !! onClick,
|
|
301
|
+
'is-button': !! onClick,
|
|
302
|
+
} ) }
|
|
303
|
+
name="style-book-canvas"
|
|
304
|
+
tabIndex={ 0 }
|
|
305
|
+
{ ...( onClick ? buttonModeProps : {} ) }
|
|
306
|
+
>
|
|
307
|
+
<EditorStyles styles={ settings.styles } />
|
|
308
|
+
<style>
|
|
309
|
+
{
|
|
310
|
+
// Forming a "block formatting context" to prevent margin collapsing.
|
|
311
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
312
|
+
`.is-root-container { display: flow-root; }
|
|
313
|
+
body { position: relative; padding: 32px !important; }` +
|
|
314
|
+
STYLE_BOOK_IFRAME_STYLES +
|
|
315
|
+
buttonModeStyles
|
|
316
|
+
}
|
|
317
|
+
</style>
|
|
318
|
+
<Examples
|
|
319
|
+
className={ classnames( 'edit-site-style-book__examples', {
|
|
320
|
+
'is-wide': sizes.width > 600,
|
|
321
|
+
} ) }
|
|
322
|
+
examples={ examples }
|
|
323
|
+
category={ category }
|
|
324
|
+
label={
|
|
325
|
+
title
|
|
326
|
+
? sprintf(
|
|
327
|
+
// translators: %s: Category of blocks, e.g. Text.
|
|
328
|
+
__( 'Examples of blocks in the %s category' ),
|
|
329
|
+
title
|
|
330
|
+
)
|
|
331
|
+
: __( 'Examples of blocks' )
|
|
332
|
+
}
|
|
333
|
+
isSelected={ isSelected }
|
|
334
|
+
onSelect={ onSelect }
|
|
335
|
+
/>
|
|
336
|
+
</Iframe>
|
|
337
|
+
);
|
|
338
|
+
};
|
|
339
|
+
|
|
253
340
|
const Examples = memo(
|
|
254
341
|
( { className, examples, category, label, isSelected, onSelect } ) => {
|
|
255
342
|
const composite = useCompositeState( { orientation: 'vertical' } );
|
|
@@ -260,7 +347,9 @@ const Examples = memo(
|
|
|
260
347
|
aria-label={ label }
|
|
261
348
|
>
|
|
262
349
|
{ examples
|
|
263
|
-
.filter( ( example ) =>
|
|
350
|
+
.filter( ( example ) =>
|
|
351
|
+
category ? example.category === category : true
|
|
352
|
+
)
|
|
264
353
|
.map( ( example ) => (
|
|
265
354
|
<Example
|
|
266
355
|
key={ example.name }
|
|
@@ -270,7 +359,7 @@ const Examples = memo(
|
|
|
270
359
|
blocks={ example.blocks }
|
|
271
360
|
isSelected={ isSelected( example.name ) }
|
|
272
361
|
onClick={ () => {
|
|
273
|
-
onSelect( example.name );
|
|
362
|
+
onSelect?.( example.name );
|
|
274
363
|
} }
|
|
275
364
|
/>
|
|
276
365
|
) ) }
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
.edit-site-style-book {
|
|
2
|
+
// Ensure the style book fills the available vertical space.
|
|
3
|
+
// This is useful when the style book is used to fill a frame.
|
|
4
|
+
height: 100%;
|
|
5
|
+
&.is-button {
|
|
6
|
+
border-radius: $radius-block-ui * 4;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.edit-site-style-book__iframe {
|
|
11
|
+
&.is-button {
|
|
12
|
+
border-radius: $radius-block-ui * 4;
|
|
13
|
+
}
|
|
14
|
+
&.is-focused {
|
|
15
|
+
outline: calc(2 * var(--wp-admin-border-width-focus)) solid var(--wp-admin-theme-color);
|
|
16
|
+
outline-offset: calc(-2 * var(--wp-admin-border-width-focus));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
1
20
|
.edit-site-style-book__tab-panel {
|
|
2
21
|
.components-tab-panel__tabs {
|
|
3
22
|
background: $white;
|
|
@@ -12,11 +12,12 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
12
12
|
import { store as editSiteStore } from '../../store';
|
|
13
13
|
|
|
14
14
|
export default function useEditedEntityRecord( postType, postId ) {
|
|
15
|
-
const { record, title, description, isLoaded } = useSelect(
|
|
15
|
+
const { record, title, description, isLoaded, icon } = useSelect(
|
|
16
16
|
( select ) => {
|
|
17
17
|
const { getEditedPostType, getEditedPostId } =
|
|
18
18
|
select( editSiteStore );
|
|
19
|
-
const { getEditedEntityRecord } =
|
|
19
|
+
const { getEditedEntityRecord, hasFinishedResolution } =
|
|
20
|
+
select( coreStore );
|
|
20
21
|
const { __experimentalGetTemplateInfo: getTemplateInfo } =
|
|
21
22
|
select( editorStore );
|
|
22
23
|
const usedPostType = postType ?? getEditedPostType();
|
|
@@ -26,7 +27,13 @@ export default function useEditedEntityRecord( postType, postId ) {
|
|
|
26
27
|
usedPostType,
|
|
27
28
|
usedPostId
|
|
28
29
|
);
|
|
29
|
-
const _isLoaded =
|
|
30
|
+
const _isLoaded =
|
|
31
|
+
usedPostId &&
|
|
32
|
+
hasFinishedResolution( 'getEditedEntityRecord', [
|
|
33
|
+
'postType',
|
|
34
|
+
usedPostType,
|
|
35
|
+
usedPostId,
|
|
36
|
+
] );
|
|
30
37
|
const templateInfo = getTemplateInfo( _record );
|
|
31
38
|
|
|
32
39
|
return {
|
|
@@ -34,6 +41,7 @@ export default function useEditedEntityRecord( postType, postId ) {
|
|
|
34
41
|
title: templateInfo.title,
|
|
35
42
|
description: templateInfo.description,
|
|
36
43
|
isLoaded: _isLoaded,
|
|
44
|
+
icon: templateInfo.icon,
|
|
37
45
|
};
|
|
38
46
|
},
|
|
39
47
|
[ postType, postId ]
|
|
@@ -41,6 +49,7 @@ export default function useEditedEntityRecord( postType, postId ) {
|
|
|
41
49
|
|
|
42
50
|
return {
|
|
43
51
|
isLoaded,
|
|
52
|
+
icon,
|
|
44
53
|
record,
|
|
45
54
|
getTitle: () => ( title ? decodeEntities( title ) : null ),
|
|
46
55
|
getDescription: () =>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch } from '@wordpress/data';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { trash, backup } from '@wordpress/icons';
|
|
7
|
+
import { useCommandLoader } from '@wordpress/commands';
|
|
8
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { store as editSiteStore } from '../../store';
|
|
14
|
+
import useEditedEntityRecord from '../../components/use-edited-entity-record';
|
|
15
|
+
import isTemplateRemovable from '../../utils/is-template-removable';
|
|
16
|
+
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
17
|
+
import { unlock } from '../../private-apis';
|
|
18
|
+
|
|
19
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
20
|
+
|
|
21
|
+
function useEditModeCommandLoader() {
|
|
22
|
+
const { removeTemplate, revertTemplate } = useDispatch( editSiteStore );
|
|
23
|
+
const history = useHistory();
|
|
24
|
+
const { isLoaded, record: template } = useEditedEntityRecord();
|
|
25
|
+
const isRemovable =
|
|
26
|
+
isLoaded && !! template && isTemplateRemovable( template );
|
|
27
|
+
const isRevertable =
|
|
28
|
+
isLoaded && !! template && isTemplateRevertable( template );
|
|
29
|
+
|
|
30
|
+
const commands = [];
|
|
31
|
+
if ( isRemovable ) {
|
|
32
|
+
const label =
|
|
33
|
+
template.type === 'wp_template'
|
|
34
|
+
? __( 'Delete template' )
|
|
35
|
+
: __( 'Delete template part' );
|
|
36
|
+
commands.push( {
|
|
37
|
+
name: 'core/remove-template',
|
|
38
|
+
label,
|
|
39
|
+
icon: trash,
|
|
40
|
+
context: 'site-editor-edit',
|
|
41
|
+
callback: ( { close } ) => {
|
|
42
|
+
removeTemplate( template );
|
|
43
|
+
// Navigate to the template list
|
|
44
|
+
history.push( {
|
|
45
|
+
path: '/' + template.type,
|
|
46
|
+
} );
|
|
47
|
+
close();
|
|
48
|
+
},
|
|
49
|
+
} );
|
|
50
|
+
}
|
|
51
|
+
if ( isRevertable ) {
|
|
52
|
+
const label =
|
|
53
|
+
template.type === 'wp_template'
|
|
54
|
+
? __( 'Reset template' )
|
|
55
|
+
: __( 'Reset template part' );
|
|
56
|
+
commands.push( {
|
|
57
|
+
name: 'core/reset-template',
|
|
58
|
+
label,
|
|
59
|
+
icon: backup,
|
|
60
|
+
callback: ( { close } ) => {
|
|
61
|
+
revertTemplate( template );
|
|
62
|
+
close();
|
|
63
|
+
},
|
|
64
|
+
} );
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
isLoading: ! isLoaded,
|
|
69
|
+
commands,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function useEditModeCommands() {
|
|
74
|
+
useCommandLoader( {
|
|
75
|
+
name: 'core/edit-site/manipulate-document',
|
|
76
|
+
hook: useEditModeCommandLoader,
|
|
77
|
+
context: 'site-editor-edit',
|
|
78
|
+
} );
|
|
79
|
+
}
|
package/src/store/actions.js
CHANGED
|
@@ -146,7 +146,7 @@ export const removeTemplate =
|
|
|
146
146
|
__( '"%s" deleted.' ),
|
|
147
147
|
template.title.rendered
|
|
148
148
|
),
|
|
149
|
-
{ type: 'snackbar' }
|
|
149
|
+
{ type: 'snackbar', id: 'site-editor-template-deleted-success' }
|
|
150
150
|
);
|
|
151
151
|
} catch ( error ) {
|
|
152
152
|
const errorMessage =
|
|
@@ -365,6 +365,8 @@ export function setIsSaveViewOpened( isOpen ) {
|
|
|
365
365
|
export const revertTemplate =
|
|
366
366
|
( template, { allowUndo = true } = {} ) =>
|
|
367
367
|
async ( { registry } ) => {
|
|
368
|
+
const noticeId = 'edit-site-template-reverted';
|
|
369
|
+
registry.dispatch( noticesStore ).removeNotice( noticeId );
|
|
368
370
|
if ( ! isTemplateRevertable( template ) ) {
|
|
369
371
|
registry
|
|
370
372
|
.dispatch( noticesStore )
|
|
@@ -466,6 +468,7 @@ export const revertTemplate =
|
|
|
466
468
|
.dispatch( noticesStore )
|
|
467
469
|
.createSuccessNotice( __( 'Template reverted.' ), {
|
|
468
470
|
type: 'snackbar',
|
|
471
|
+
id: noticeId,
|
|
469
472
|
actions: [
|
|
470
473
|
{
|
|
471
474
|
label: __( 'Undo' ),
|
|
@@ -473,10 +476,6 @@ export const revertTemplate =
|
|
|
473
476
|
},
|
|
474
477
|
],
|
|
475
478
|
} );
|
|
476
|
-
} else {
|
|
477
|
-
registry
|
|
478
|
-
.dispatch( noticesStore )
|
|
479
|
-
.createSuccessNotice( __( 'Template reverted.' ) );
|
|
480
479
|
}
|
|
481
480
|
} catch ( error ) {
|
|
482
481
|
const errorMessage =
|
package/src/store/test/utils.js
CHANGED
|
@@ -145,9 +145,14 @@ describe( 'utils', () => {
|
|
|
145
145
|
).toEqual( FLATTENED_BLOCKS );
|
|
146
146
|
|
|
147
147
|
// The function has been called twice with the same params, so the cache size should be 1.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
/**
|
|
149
|
+
* TODO what should be done about this?
|
|
150
|
+
* Can it be tested another way?
|
|
151
|
+
* Is it necessary?
|
|
152
|
+
*/
|
|
153
|
+
// const [ , , originalSize ] =
|
|
154
|
+
// getFilteredTemplatePartBlocks.getCache();
|
|
155
|
+
// expect( originalSize ).toBe( 1 );
|
|
151
156
|
|
|
152
157
|
// Call the function again, with different params.
|
|
153
158
|
expect(
|
|
@@ -174,8 +179,13 @@ describe( 'utils', () => {
|
|
|
174
179
|
] );
|
|
175
180
|
|
|
176
181
|
// The function has been called with different params, so the cache size should now be 2.
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
/**
|
|
183
|
+
* TODO what should be done about this?
|
|
184
|
+
* Can it be tested another way?
|
|
185
|
+
* Is it necessary?
|
|
186
|
+
*/
|
|
187
|
+
// const [ , , finalSize ] = getFilteredTemplatePartBlocks.getCache();
|
|
188
|
+
// expect( finalSize ).toBe( 2 );
|
|
179
189
|
} );
|
|
180
190
|
} );
|
|
181
191
|
} );
|
package/src/style.scss
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
@import "./components/sidebar-edit-mode/settings-header/style.scss";
|
|
14
14
|
@import "./components/sidebar-edit-mode/template-card/style.scss";
|
|
15
15
|
@import "./components/editor/style.scss";
|
|
16
|
-
@import "./components/template-details/style.scss";
|
|
17
16
|
@import "./components/create-template-part-modal/style.scss";
|
|
18
17
|
@import "./components/secondary-sidebar/style.scss";
|
|
19
18
|
@import "./components/welcome-guide/style.scss";
|
|
@@ -35,6 +34,7 @@
|
|
|
35
34
|
@import "./components/site-icon/style.scss";
|
|
36
35
|
@import "./components/style-book/style.scss";
|
|
37
36
|
@import "./components/editor-canvas-container/style.scss";
|
|
37
|
+
@import "./components/resizable-frame/style.scss";
|
|
38
38
|
@import "./hooks/push-changes-to-global-styles/style.scss";
|
|
39
39
|
|
|
40
40
|
html #wpadminbar {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-generic-template-modal.js"],"names":["AddCustomGenericTemplateModal","onClose","createTemplate","isCreatingTemplate","title","setTitle","defaultTitle","isBusy","setIsBusy","onCreateTemplate","event","preventDefault","slug"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAWA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAGA,SAASA,6BAAT,OAII;AAAA,MAJoC;AACvCC,IAAAA,OADuC;AAEvCC,IAAAA,cAFuC;AAGvCC,IAAAA;AAHuC,GAIpC;AACH,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,EAAV,CAA5B;AACA,QAAMC,YAAY,GAAG,cAAI,iBAAJ,CAArB;AACA,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,KAAV,CAA9B;;AACA,iBAAeC,gBAAf,CAAiCC,KAAjC,EAAyC;AACxCA,IAAAA,KAAK,CAACC,cAAN;;AACA,QAAKJ,MAAL,EAAc;AACb;AACA;;AACDC,IAAAA,SAAS,CAAE,IAAF,CAAT;;AACA,QAAI;AACH,YAAMN,cAAc,CACnB;AACCU,QAAAA,IAAI,EACH,wBACA,uBAAWR,KAAK,IAAIE,YAApB,CAHF;AAICF,QAAAA,KAAK,EAAEA,KAAK,IAAIE;AAJjB,OADmB,EAOnB,KAPmB,CAApB;AASA,KAVD,SAUU;AACTE,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD;;AACD,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,wBAAJ,CADT;AAEC,IAAA,cAAc,EAAG,MAAM;AACtBP,MAAAA,OAAO;AACP,KAJF;AAKC,IAAA,gBAAgB,EAAC;AALlB,KAOGE,kBAAkB,IAAI,4BAAC,qCAAD,OAPzB,EAQC;AAAM,IAAA,QAAQ,EAAGM;AAAjB,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,uBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,KAAK,EAAGL,KAHT;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,WAAW,EAAGC,YALf;AAMC,IAAA,QAAQ,EAAGC,MANZ;AAOC,IAAA,IAAI,EAAG,cACN,kDADM;AAPR,IADD,EAYC,4BAAC,gCAAD;AACC,IAAA,SAAS,EAAC,kDADX;AAEC,IAAA,OAAO,EAAC;AAFT,KAIC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfN,MAAAA,OAAO;AACP;AAJF,KAMG,cAAI,QAAJ,CANH,CAJD,EAYC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGM,MAHV;AAIC,qBAAgBA;AAJjB,KAMG,cAAI,QAAJ,CANH,CAZD,CAZD,CADD,CARD,CADD;AA+CA;;eAEcP,6B","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\n\nfunction AddCustomGenericTemplateModal( {\n\tonClose,\n\tcreateTemplate,\n\tisCreatingTemplate,\n} ) {\n\tconst [ title, setTitle ] = useState( '' );\n\tconst defaultTitle = __( 'Custom Template' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\tasync function onCreateTemplate( event ) {\n\t\tevent.preventDefault();\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsBusy( true );\n\t\ttry {\n\t\t\tawait createTemplate(\n\t\t\t\t{\n\t\t\t\t\tslug:\n\t\t\t\t\t\t'wp-custom-template-' +\n\t\t\t\t\t\tkebabCase( title || defaultTitle ),\n\t\t\t\t\ttitle: title || defaultTitle,\n\t\t\t\t},\n\t\t\t\tfalse\n\t\t\t);\n\t\t} finally {\n\t\t\tsetIsBusy( false );\n\t\t}\n\t}\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\toverlayClassName=\"edit-site-custom-generic-template__modal\"\n\t\t>\n\t\t\t{ isCreatingTemplate && <TemplateActionsLoadingScreen /> }\n\t\t\t<form onSubmit={ onCreateTemplate }>\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ defaultTitle }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\".'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"edit-site-custom-generic-template__modal-actions\"\n\t\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomGenericTemplateModal;\n"]}
|