@wordpress/edit-site 3.0.14 → 3.0.18-next.33ec3857e2.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/build/components/add-new-template/new-template-part.js +29 -18
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +30 -23
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +51 -0
- package/build/components/app/index.js.map +1 -0
- package/build/components/block-editor/back-button.js +8 -20
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/index.js +2 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +1 -0
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +0 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +20 -8
- package/build/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build/components/editor/index.js +11 -30
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +81 -22
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +10 -10
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +9 -10
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +1 -1
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +6 -10
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +8 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +6 -10
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/ui.js +27 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/header/document-actions/index.js +3 -6
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/list/actions/index.js +1 -0
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/index.js +17 -15
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +4 -4
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -13
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +26 -24
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +3 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/routes/index.js +60 -0
- package/build/components/routes/index.js.map +1 -0
- package/build/components/routes/link.js +65 -0
- package/build/components/routes/link.js.map +1 -0
- package/build/components/routes/use-title.js +57 -0
- package/build/components/routes/use-title.js.map +1 -0
- package/build/components/sidebar/default-sidebar.js +4 -2
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/template-card/template-areas.js +7 -4
- package/build/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build/components/template-details/index.js +12 -10
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +27 -10
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/url-query-controller/index.js +41 -50
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -0
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +1 -28
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +18 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +29 -35
- package/build/index.js.map +1 -1
- package/build/plugins/index.js +3 -23
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/site-export.js +67 -0
- package/build/plugins/site-export.js.map +1 -0
- package/build/plugins/welcome-guide-menu-item.js +1 -7
- package/build/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build/store/actions.js +0 -27
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -14
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +7 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -31
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +23 -0
- package/build/utils/get-is-list-page.js.map +1 -0
- package/build/utils/history.js +35 -0
- package/build/utils/history.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +27 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +28 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +35 -0
- package/build-module/components/app/index.js.map +1 -0
- package/build-module/components/block-editor/back-button.js +8 -19
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +1 -0
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +0 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +17 -9
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -33
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +82 -23
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +10 -10
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +9 -11
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +7 -11
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +9 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +7 -11
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/ui.js +26 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +3 -6
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +1 -0
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/index.js +15 -15
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +4 -4
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +13 -13
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +24 -24
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +3 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/routes/index.js +47 -0
- package/build-module/components/routes/index.js.map +1 -0
- package/build-module/components/routes/link.js +51 -0
- package/build-module/components/routes/link.js.map +1 -0
- package/build-module/components/routes/use-title.js +44 -0
- package/build-module/components/routes/use-title.js.map +1 -0
- package/build-module/components/sidebar/default-sidebar.js +4 -2
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +9 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-areas.js +8 -4
- package/build-module/components/sidebar/template-card/template-areas.js.map +1 -1
- package/build-module/components/template-details/index.js +10 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +24 -9
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +7 -12
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +40 -49
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +7 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +2 -26
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +18 -2
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +28 -33
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -18
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/site-export.js +51 -0
- package/build-module/plugins/site-export.js.map +1 -0
- package/build-module/plugins/welcome-guide-menu-item.js +2 -7
- package/build-module/plugins/welcome-guide-menu-item.js.map +1 -1
- package/build-module/store/actions.js +0 -23
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -11
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +7 -16
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -27
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +16 -0
- package/build-module/utils/get-is-list-page.js.map +1 -0
- package/build-module/utils/history.js +25 -0
- package/build-module/utils/history.js.map +1 -0
- package/build-style/style-rtl.css +36 -61
- package/build-style/style.css +36 -61
- package/package.json +29 -28
- package/src/components/add-new-template/new-template-part.js +29 -11
- package/src/components/add-new-template/new-template.js +26 -12
- package/src/components/app/index.js +47 -0
- package/src/components/block-editor/back-button.js +6 -14
- package/src/components/block-editor/index.js +1 -0
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +10 -18
- package/src/components/create-template-part-modal/index.js +0 -2
- package/src/components/edit-template-part-menu-button/index.js +16 -5
- package/src/components/editor/index.js +105 -131
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/gradients-palette-panel.js +12 -12
- package/src/components/global-styles/screen-background-color.js +7 -10
- package/src/components/global-styles/screen-colors.js +1 -1
- package/src/components/global-styles/screen-link-color.js +6 -14
- package/src/components/global-styles/screen-root.js +17 -7
- package/src/components/global-styles/screen-text-color.js +6 -14
- package/src/components/global-styles/style.scss +6 -17
- package/src/components/global-styles/test/use-global-styles-output.js +7 -1
- package/src/components/global-styles/ui.js +50 -25
- package/src/components/global-styles/use-global-styles-output.js +0 -1
- package/src/components/header/document-actions/index.js +3 -9
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/style.scss +2 -1
- package/src/components/list/actions/index.js +1 -0
- package/src/components/list/index.js +11 -12
- package/src/components/list/style.scss +6 -11
- package/src/components/list/table.js +5 -5
- package/src/components/navigation-sidebar/index.js +18 -17
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -22
- package/src/components/navigation-sidebar/navigation-toggle/index.js +2 -0
- package/src/components/routes/index.js +53 -0
- package/src/components/routes/link.js +44 -0
- package/src/components/routes/use-title.js +56 -0
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +9 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/sidebar/template-card/template-areas.js +16 -4
- package/src/components/template-details/index.js +8 -6
- package/src/components/template-details/template-areas.js +31 -8
- package/src/components/template-part-converter/convert-to-template-part.js +4 -2
- package/src/components/url-query-controller/index.js +34 -45
- package/src/components/welcome-guide/editor.js +10 -1
- package/src/components/welcome-guide/index.js +6 -25
- package/src/components/welcome-guide/styles.js +20 -2
- package/src/index.js +33 -36
- package/src/plugins/index.js +2 -32
- package/src/plugins/site-export.js +52 -0
- package/src/plugins/welcome-guide-menu-item.js +2 -16
- package/src/store/actions.js +0 -23
- package/src/store/constants.js +0 -12
- package/src/store/reducer.js +12 -26
- package/src/store/selectors.js +1 -27
- package/src/store/test/reducer.js +22 -39
- package/src/store/test/selectors.js +3 -34
- package/src/utils/get-is-list-page.js +11 -0
- package/src/utils/history.js +35 -0
|
@@ -3,26 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Button } from '@wordpress/components';
|
|
5
5
|
import { arrowLeft } from '@wordpress/icons';
|
|
6
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
6
|
import { __ } from '@wordpress/i18n';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
|
-
import {
|
|
11
|
+
import { useLocation, useHistory } from '../routes';
|
|
13
12
|
|
|
14
13
|
function BackButton() {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
isTemplatePart: getEditedPostType() === 'wp_template_part',
|
|
22
|
-
previousTemplateId: getPreviousEditedPostId(),
|
|
23
|
-
};
|
|
24
|
-
}, [] );
|
|
25
|
-
const { goBack } = useDispatch( editSiteStore );
|
|
14
|
+
const location = useLocation();
|
|
15
|
+
const history = useHistory();
|
|
16
|
+
const isTemplatePart = location.params.postType === 'wp_template_part';
|
|
17
|
+
const previousTemplateId = location.state?.fromTemplateId;
|
|
26
18
|
|
|
27
19
|
if ( ! isTemplatePart || ! previousTemplateId ) {
|
|
28
20
|
return null;
|
|
@@ -33,7 +25,7 @@ function BackButton() {
|
|
|
33
25
|
className="edit-site-visual-editor__back-button"
|
|
34
26
|
icon={ arrowLeft }
|
|
35
27
|
onClick={ () => {
|
|
36
|
-
|
|
28
|
+
history.back();
|
|
37
29
|
} }
|
|
38
30
|
>
|
|
39
31
|
{ __( 'Back' ) }
|
|
@@ -124,6 +124,7 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
124
124
|
<BlockList
|
|
125
125
|
className="edit-site-block-editor__block-list wp-site-blocks"
|
|
126
126
|
__experimentalLayout={ LAYOUT }
|
|
127
|
+
renderAppender={ isTemplatePart ? false : undefined }
|
|
127
128
|
/>
|
|
128
129
|
</ResizableEditor>
|
|
129
130
|
|
|
@@ -19,18 +19,14 @@
|
|
|
19
19
|
align-items: center;
|
|
20
20
|
|
|
21
21
|
&.is-focus-mode {
|
|
22
|
-
padding:
|
|
22
|
+
padding: $grid-unit-60;
|
|
23
23
|
|
|
24
24
|
.edit-site-visual-editor__editor-canvas {
|
|
25
|
-
border-radius:
|
|
25
|
+
border-radius: $radius-block-ui;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.edit-site-visual-editor__editor-canvas {
|
|
31
|
-
border-radius: 2px 2px 0 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
.edit-site-visual-editor__back-button {
|
|
35
31
|
position: absolute;
|
|
36
32
|
top: $grid-unit-10;
|
|
@@ -55,30 +51,26 @@
|
|
|
55
51
|
bottom: 0;
|
|
56
52
|
padding: 0;
|
|
57
53
|
margin: auto 0;
|
|
58
|
-
width: $grid-unit-
|
|
54
|
+
width: $grid-unit-05;
|
|
59
55
|
height: $height;
|
|
60
56
|
appearance: none;
|
|
61
|
-
cursor:
|
|
57
|
+
cursor: ew-resize;
|
|
62
58
|
outline: none;
|
|
63
|
-
background: $gray-
|
|
64
|
-
border-radius:
|
|
59
|
+
background: $gray-600;
|
|
60
|
+
border-radius: 2px;
|
|
65
61
|
border: 0;
|
|
66
62
|
|
|
67
63
|
&.is-left {
|
|
68
|
-
left:
|
|
64
|
+
left: -$grid-unit-20;
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
&.is-right {
|
|
72
|
-
right:
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&:hover {
|
|
76
|
-
background: $gray-600;
|
|
68
|
+
right: -$grid-unit-20;
|
|
77
69
|
}
|
|
78
70
|
|
|
71
|
+
&:hover,
|
|
79
72
|
&:active {
|
|
80
|
-
|
|
81
|
-
background: $gray-600;
|
|
73
|
+
background: $gray-400;
|
|
82
74
|
}
|
|
83
75
|
|
|
84
76
|
&:focus {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import {
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
BlockSettingsMenuControls,
|
|
@@ -14,7 +14,8 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { useLocation } from '../routes';
|
|
18
|
+
import { useLink } from '../routes/link';
|
|
18
19
|
|
|
19
20
|
export default function EditTemplatePartMenuButton() {
|
|
20
21
|
return (
|
|
@@ -30,6 +31,7 @@ export default function EditTemplatePartMenuButton() {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function EditTemplatePartMenuItem( { selectedClientId, onClose } ) {
|
|
34
|
+
const { params } = useLocation();
|
|
33
35
|
const selectedTemplatePart = useSelect(
|
|
34
36
|
( select ) => {
|
|
35
37
|
const block = select( blockEditorStore ).getBlock(
|
|
@@ -50,7 +52,15 @@ function EditTemplatePartMenuItem( { selectedClientId, onClose } ) {
|
|
|
50
52
|
[ selectedClientId ]
|
|
51
53
|
);
|
|
52
54
|
|
|
53
|
-
const
|
|
55
|
+
const linkProps = useLink(
|
|
56
|
+
{
|
|
57
|
+
postId: selectedTemplatePart?.id,
|
|
58
|
+
postType: selectedTemplatePart?.type,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
fromTemplateId: params.postId,
|
|
62
|
+
}
|
|
63
|
+
);
|
|
54
64
|
|
|
55
65
|
if ( ! selectedTemplatePart ) {
|
|
56
66
|
return null;
|
|
@@ -58,8 +68,9 @@ function EditTemplatePartMenuItem( { selectedClientId, onClose } ) {
|
|
|
58
68
|
|
|
59
69
|
return (
|
|
60
70
|
<MenuItem
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
{ ...linkProps }
|
|
72
|
+
onClick={ ( event ) => {
|
|
73
|
+
linkProps.onClick( event );
|
|
63
74
|
onClose();
|
|
64
75
|
} }
|
|
65
76
|
>
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect, useState, useMemo, useCallback } from '@wordpress/element';
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
SlotFillProvider,
|
|
8
|
-
Popover,
|
|
9
|
-
Button,
|
|
10
|
-
Notice,
|
|
11
|
-
} from '@wordpress/components';
|
|
6
|
+
import { Popover, Button, Notice } from '@wordpress/components';
|
|
12
7
|
import { EntityProvider, store as coreStore } from '@wordpress/core-data';
|
|
13
8
|
import { BlockContextProvider, BlockBreadcrumb } from '@wordpress/block-editor';
|
|
14
9
|
import {
|
|
15
|
-
FullscreenMode,
|
|
16
10
|
InterfaceSkeleton,
|
|
17
11
|
ComplementaryArea,
|
|
18
12
|
store as interfaceStore,
|
|
@@ -21,8 +15,6 @@ import {
|
|
|
21
15
|
EditorNotices,
|
|
22
16
|
EditorSnackbars,
|
|
23
17
|
EntitiesSavedStates,
|
|
24
|
-
UnsavedChangesWarning,
|
|
25
|
-
store as editorStore,
|
|
26
18
|
} from '@wordpress/editor';
|
|
27
19
|
import { __ } from '@wordpress/i18n';
|
|
28
20
|
import { PluginArea } from '@wordpress/plugins';
|
|
@@ -47,13 +39,14 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
47
39
|
import { store as editSiteStore } from '../../store';
|
|
48
40
|
import { GlobalStylesRenderer } from './global-styles-renderer';
|
|
49
41
|
import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
|
|
42
|
+
import useTitle from '../routes/use-title';
|
|
50
43
|
|
|
51
44
|
const interfaceLabels = {
|
|
52
45
|
secondarySidebar: __( 'Block Library' ),
|
|
53
46
|
drawer: __( 'Navigation Sidebar' ),
|
|
54
47
|
};
|
|
55
48
|
|
|
56
|
-
function Editor( {
|
|
49
|
+
function Editor( { onError } ) {
|
|
57
50
|
const {
|
|
58
51
|
isInserterOpen,
|
|
59
52
|
isListViewOpen,
|
|
@@ -111,26 +104,7 @@ function Editor( { initialSettings, onError } ) {
|
|
|
111
104
|
).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),
|
|
112
105
|
};
|
|
113
106
|
}, [] );
|
|
114
|
-
const {
|
|
115
|
-
const { setPage, setIsInserterOpened, updateSettings } = useDispatch(
|
|
116
|
-
editSiteStore
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
useEffect( () => {
|
|
120
|
-
updateSettings( initialSettings );
|
|
121
|
-
}, [] );
|
|
122
|
-
|
|
123
|
-
// Keep the defaultTemplateTypes in the core/editor settings too,
|
|
124
|
-
// so that they can be selected with core/editor selectors in any editor.
|
|
125
|
-
// This is needed because edit-site doesn't initialize with EditorProvider,
|
|
126
|
-
// which internally uses updateEditorSettings as well.
|
|
127
|
-
const { defaultTemplateTypes, defaultTemplatePartAreas } = settings;
|
|
128
|
-
useEffect( () => {
|
|
129
|
-
updateEditorSettings( {
|
|
130
|
-
defaultTemplateTypes,
|
|
131
|
-
defaultTemplatePartAreas,
|
|
132
|
-
} );
|
|
133
|
-
}, [ defaultTemplateTypes, defaultTemplatePartAreas ] );
|
|
107
|
+
const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
|
|
134
108
|
|
|
135
109
|
const [
|
|
136
110
|
isEntitiesSavedStatesOpen,
|
|
@@ -189,120 +163,120 @@ function Editor( { initialSettings, onError } ) {
|
|
|
189
163
|
return null;
|
|
190
164
|
};
|
|
191
165
|
|
|
166
|
+
// Only announce the title once the editor is ready to prevent "Replace"
|
|
167
|
+
// action in <URlQueryController> from double-announcing.
|
|
168
|
+
useTitle( isReady && __( 'Editor (beta)' ) );
|
|
169
|
+
|
|
192
170
|
return (
|
|
193
171
|
<>
|
|
194
172
|
<URLQueryController />
|
|
195
173
|
{ isReady && (
|
|
196
174
|
<ShortcutProvider>
|
|
197
|
-
<
|
|
198
|
-
<EntityProvider
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
>
|
|
204
|
-
<
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
<
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
175
|
+
<EntityProvider kind="root" type="site">
|
|
176
|
+
<EntityProvider
|
|
177
|
+
kind="postType"
|
|
178
|
+
type={ templateType }
|
|
179
|
+
id={ entityId }
|
|
180
|
+
>
|
|
181
|
+
<GlobalStylesProvider>
|
|
182
|
+
<BlockContextProvider value={ blockContext }>
|
|
183
|
+
<GlobalStylesRenderer />
|
|
184
|
+
<ErrorBoundary onError={ onError }>
|
|
185
|
+
<KeyboardShortcuts.Register />
|
|
186
|
+
<SidebarComplementaryAreaFills />
|
|
187
|
+
<InterfaceSkeleton
|
|
188
|
+
labels={ interfaceLabels }
|
|
189
|
+
secondarySidebar={ secondarySidebar() }
|
|
190
|
+
sidebar={
|
|
191
|
+
sidebarIsOpened && (
|
|
192
|
+
<ComplementaryArea.Slot scope="core/edit-site" />
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
drawer={
|
|
196
|
+
<NavigationSidebar.Slot />
|
|
197
|
+
}
|
|
198
|
+
header={
|
|
199
|
+
<Header
|
|
200
|
+
openEntitiesSavedStates={
|
|
201
|
+
openEntitiesSavedStates
|
|
202
|
+
}
|
|
203
|
+
/>
|
|
204
|
+
}
|
|
205
|
+
notices={ <EditorSnackbars /> }
|
|
206
|
+
content={
|
|
207
|
+
<>
|
|
208
|
+
<EditorNotices />
|
|
209
|
+
{ template && (
|
|
210
|
+
<BlockEditor
|
|
211
|
+
setIsInserterOpen={
|
|
212
|
+
setIsInserterOpened
|
|
213
|
+
}
|
|
214
|
+
/>
|
|
215
|
+
) }
|
|
216
|
+
{ templateResolved &&
|
|
217
|
+
! template &&
|
|
218
|
+
settings?.siteUrl &&
|
|
219
|
+
entityId && (
|
|
220
|
+
<Notice
|
|
221
|
+
status="warning"
|
|
222
|
+
isDismissible={
|
|
223
|
+
false
|
|
224
|
+
}
|
|
225
|
+
>
|
|
226
|
+
{ __(
|
|
227
|
+
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
|
|
228
|
+
) }
|
|
229
|
+
</Notice>
|
|
230
|
+
) }
|
|
231
|
+
<KeyboardShortcuts
|
|
225
232
|
openEntitiesSavedStates={
|
|
226
233
|
openEntitiesSavedStates
|
|
227
234
|
}
|
|
228
235
|
/>
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
setIsInserterOpened
|
|
238
|
-
}
|
|
239
|
-
/>
|
|
240
|
-
) }
|
|
241
|
-
{ templateResolved &&
|
|
242
|
-
! template &&
|
|
243
|
-
settings?.siteUrl &&
|
|
244
|
-
entityId && (
|
|
245
|
-
<Notice
|
|
246
|
-
status="warning"
|
|
247
|
-
isDismissible={
|
|
248
|
-
false
|
|
249
|
-
}
|
|
250
|
-
>
|
|
251
|
-
{ __(
|
|
252
|
-
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
|
|
253
|
-
) }
|
|
254
|
-
</Notice>
|
|
255
|
-
) }
|
|
256
|
-
<KeyboardShortcuts
|
|
257
|
-
openEntitiesSavedStates={
|
|
258
|
-
openEntitiesSavedStates
|
|
236
|
+
</>
|
|
237
|
+
}
|
|
238
|
+
actions={
|
|
239
|
+
<>
|
|
240
|
+
{ isEntitiesSavedStatesOpen ? (
|
|
241
|
+
<EntitiesSavedStates
|
|
242
|
+
close={
|
|
243
|
+
closeEntitiesSavedStates
|
|
259
244
|
}
|
|
260
245
|
/>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
closeEntitiesSavedStates
|
|
246
|
+
) : (
|
|
247
|
+
<div className="edit-site-editor__toggle-save-panel">
|
|
248
|
+
<Button
|
|
249
|
+
variant="secondary"
|
|
250
|
+
className="edit-site-editor__toggle-save-panel-button"
|
|
251
|
+
onClick={
|
|
252
|
+
openEntitiesSavedStates
|
|
269
253
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
next: nextShortcut,
|
|
295
|
-
} }
|
|
296
|
-
/>
|
|
297
|
-
<WelcomeGuide />
|
|
298
|
-
<Popover.Slot />
|
|
299
|
-
<PluginArea />
|
|
300
|
-
</ErrorBoundary>
|
|
301
|
-
</BlockContextProvider>
|
|
302
|
-
</GlobalStylesProvider>
|
|
303
|
-
</EntityProvider>
|
|
254
|
+
aria-expanded={
|
|
255
|
+
false
|
|
256
|
+
}
|
|
257
|
+
>
|
|
258
|
+
{ __(
|
|
259
|
+
'Open save panel'
|
|
260
|
+
) }
|
|
261
|
+
</Button>
|
|
262
|
+
</div>
|
|
263
|
+
) }
|
|
264
|
+
</>
|
|
265
|
+
}
|
|
266
|
+
footer={ <BlockBreadcrumb /> }
|
|
267
|
+
shortcuts={ {
|
|
268
|
+
previous: previousShortcut,
|
|
269
|
+
next: nextShortcut,
|
|
270
|
+
} }
|
|
271
|
+
/>
|
|
272
|
+
<WelcomeGuide />
|
|
273
|
+
<Popover.Slot />
|
|
274
|
+
<PluginArea />
|
|
275
|
+
</ErrorBoundary>
|
|
276
|
+
</BlockContextProvider>
|
|
277
|
+
</GlobalStylesProvider>
|
|
304
278
|
</EntityProvider>
|
|
305
|
-
</
|
|
279
|
+
</EntityProvider>
|
|
306
280
|
</ShortcutProvider>
|
|
307
281
|
) }
|
|
308
282
|
</>
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
__experimentalColorGradientControl as ColorGradientControl,
|
|
8
8
|
} from '@wordpress/block-editor';
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
11
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
11
12
|
__experimentalUnitControl as UnitControl,
|
|
12
13
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
13
14
|
} from '@wordpress/components';
|
|
@@ -68,6 +69,18 @@ function useHasBorderWidthControl( name ) {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export default function BorderPanel( { name } ) {
|
|
72
|
+
// To better reflect if the user has customized a value we need to
|
|
73
|
+
// ensure the style value being checked is from the `user` origin.
|
|
74
|
+
const [ userBorderStyles ] = useStyle( 'border', name, 'user' );
|
|
75
|
+
const createHasValueCallback = ( feature ) => () =>
|
|
76
|
+
!! userBorderStyles?.[ feature ];
|
|
77
|
+
|
|
78
|
+
const createResetCallback = ( setStyle ) => () => setStyle( undefined );
|
|
79
|
+
|
|
80
|
+
const handleOnChange = ( setStyle ) => ( value ) => {
|
|
81
|
+
setStyle( value || undefined );
|
|
82
|
+
};
|
|
83
|
+
|
|
71
84
|
const units = useCustomUnits( {
|
|
72
85
|
availableUnits: useSetting( 'spacing.units' )[ 0 ] || [
|
|
73
86
|
'px',
|
|
@@ -77,70 +90,121 @@ export default function BorderPanel( { name } ) {
|
|
|
77
90
|
} );
|
|
78
91
|
|
|
79
92
|
// Border width.
|
|
80
|
-
const
|
|
93
|
+
const showBorderWidth = useHasBorderWidthControl( name );
|
|
81
94
|
const [ borderWidthValue, setBorderWidth ] = useStyle(
|
|
82
95
|
'border.width',
|
|
83
96
|
name
|
|
84
97
|
);
|
|
85
98
|
|
|
86
99
|
// Border style.
|
|
87
|
-
const
|
|
100
|
+
const showBorderStyle = useHasBorderStyleControl( name );
|
|
88
101
|
const [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );
|
|
89
102
|
|
|
90
103
|
// Border color.
|
|
104
|
+
const showBorderColor = useHasBorderColorControl( name );
|
|
105
|
+
const [ borderColor, setBorderColor ] = useStyle( 'border.color', name );
|
|
91
106
|
const [ colors = EMPTY_ARRAY ] = useSetting( 'color.palette' );
|
|
92
107
|
const disableCustomColors = ! useSetting( 'color.custom' )[ 0 ];
|
|
93
108
|
const disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];
|
|
94
|
-
const hasBorderColor = useHasBorderColorControl( name );
|
|
95
|
-
const [ borderColor, setBorderColor ] = useStyle( 'border.color', name );
|
|
96
109
|
|
|
97
110
|
// Border radius.
|
|
98
|
-
const
|
|
111
|
+
const showBorderRadius = useHasBorderRadiusControl( name );
|
|
99
112
|
const [ borderRadiusValues, setBorderRadius ] = useStyle(
|
|
100
113
|
'border.radius',
|
|
101
114
|
name
|
|
102
115
|
);
|
|
116
|
+
const hasBorderRadius = () => {
|
|
117
|
+
const borderValues = userBorderStyles?.radius;
|
|
118
|
+
if ( typeof borderValues === 'object' ) {
|
|
119
|
+
return Object.entries( borderValues ).some( Boolean );
|
|
120
|
+
}
|
|
121
|
+
return !! borderValues;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const resetAll = () => {
|
|
125
|
+
setBorderColor( undefined );
|
|
126
|
+
setBorderRadius( undefined );
|
|
127
|
+
setBorderStyle( undefined );
|
|
128
|
+
setBorderWidth( undefined );
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// When we set a border color or width ensure we have a style so the user
|
|
132
|
+
// can see a visible border.
|
|
133
|
+
const handleOnChangeWithStyle = ( setStyle ) => ( value ) => {
|
|
134
|
+
if ( !! value && ! borderStyle ) {
|
|
135
|
+
setBorderStyle( 'solid' );
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setStyle( value || undefined );
|
|
139
|
+
};
|
|
103
140
|
|
|
104
141
|
return (
|
|
105
|
-
<
|
|
106
|
-
{
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>
|
|
143
|
+
{ showBorderWidth && (
|
|
144
|
+
<ToolsPanelItem
|
|
145
|
+
className="single-column"
|
|
146
|
+
hasValue={ createHasValueCallback( 'width' ) }
|
|
147
|
+
label={ __( 'Width' ) }
|
|
148
|
+
onDeselect={ createResetCallback( setBorderWidth ) }
|
|
149
|
+
isShownByDefault={ true }
|
|
150
|
+
>
|
|
151
|
+
<UnitControl
|
|
152
|
+
value={ borderWidthValue }
|
|
153
|
+
label={ __( 'Width' ) }
|
|
154
|
+
min={ MIN_BORDER_WIDTH }
|
|
155
|
+
onChange={ handleOnChangeWithStyle( setBorderWidth ) }
|
|
156
|
+
units={ units }
|
|
157
|
+
/>
|
|
158
|
+
</ToolsPanelItem>
|
|
159
|
+
) }
|
|
160
|
+
{ showBorderStyle && (
|
|
161
|
+
<ToolsPanelItem
|
|
162
|
+
className="single-column"
|
|
163
|
+
hasValue={ createHasValueCallback( 'style' ) }
|
|
164
|
+
label={ __( 'Style' ) }
|
|
165
|
+
onDeselect={ createResetCallback( setBorderStyle ) }
|
|
166
|
+
isShownByDefault={ true }
|
|
167
|
+
>
|
|
168
|
+
<BorderStyleControl
|
|
169
|
+
value={ borderStyle }
|
|
170
|
+
onChange={ handleOnChange( setBorderStyle ) }
|
|
171
|
+
/>
|
|
172
|
+
</ToolsPanelItem>
|
|
126
173
|
) }
|
|
127
|
-
{
|
|
128
|
-
<
|
|
174
|
+
{ showBorderColor && (
|
|
175
|
+
<ToolsPanelItem
|
|
176
|
+
hasValue={ createHasValueCallback( 'color' ) }
|
|
129
177
|
label={ __( 'Color' ) }
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
178
|
+
onDeselect={ createResetCallback( setBorderColor ) }
|
|
179
|
+
isShownByDefault={ true }
|
|
180
|
+
>
|
|
181
|
+
<ColorGradientControl
|
|
182
|
+
label={ __( 'Color' ) }
|
|
183
|
+
colorValue={ borderColor }
|
|
184
|
+
colors={ colors }
|
|
185
|
+
gradients={ undefined }
|
|
186
|
+
disableCustomColors={ disableCustomColors }
|
|
187
|
+
disableCustomGradients={ disableCustomGradients }
|
|
188
|
+
onColorChange={ handleOnChangeWithStyle(
|
|
189
|
+
setBorderColor
|
|
190
|
+
) }
|
|
191
|
+
clearable={ false }
|
|
192
|
+
/>
|
|
193
|
+
</ToolsPanelItem>
|
|
137
194
|
) }
|
|
138
|
-
{
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
195
|
+
{ showBorderRadius && (
|
|
196
|
+
<ToolsPanelItem
|
|
197
|
+
hasValue={ hasBorderRadius }
|
|
198
|
+
label={ __( 'Radius' ) }
|
|
199
|
+
onDeselect={ createResetCallback( setBorderRadius ) }
|
|
200
|
+
isShownByDefault={ true }
|
|
201
|
+
>
|
|
202
|
+
<BorderRadiusControl
|
|
203
|
+
values={ borderRadiusValues }
|
|
204
|
+
onChange={ handleOnChange( setBorderRadius ) }
|
|
205
|
+
/>
|
|
206
|
+
</ToolsPanelItem>
|
|
143
207
|
) }
|
|
144
|
-
</
|
|
208
|
+
</ToolsPanel>
|
|
145
209
|
);
|
|
146
210
|
}
|