@wordpress/edit-site 3.0.27 → 4.0.1-next.f435e9e01b.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 +12 -0
- package/LICENSE.md +1 -1
- package/README.md +7 -1
- package/build/components/add-new-template/new-template-part.js +1 -4
- package/build/components/add-new-template/new-template-part.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/code-editor/code-editor-text-area.js +95 -0
- package/build/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build/components/code-editor/index.js +79 -0
- package/build/components/code-editor/index.js.map +1 -0
- package/build/components/editor/index.js +28 -8
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +27 -11
- package/build/components/error-boundary/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/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +1 -0
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +2 -7
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +35 -12
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -3
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +46 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +1 -3
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +0 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +0 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +0 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +0 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +22 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +138 -0
- package/build/components/global-styles/screen-style-variations.js.map +1 -0
- package/build/components/global-styles/screen-text-color.js +0 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +31 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header/index.js +12 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +78 -0
- package/build/components/header/mode-switcher/index.js.map +1 -0
- package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
- package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/header/more-menu/index.js +6 -2
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +17 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -4
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +3 -3
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/routes/redirect-to-homepage.js +3 -22
- package/build/components/routes/redirect-to-homepage.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- 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 +1 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +1 -4
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/index.js +2 -16
- package/build/index.js.map +1 -1
- package/build/store/actions.js +29 -9
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +11 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +1 -4
- package/build-module/components/add-new-template/new-template-part.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/code-editor/code-editor-text-area.js +83 -0
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build-module/components/code-editor/index.js +62 -0
- package/build-module/components/code-editor/index.js.map +1 -0
- package/build-module/components/editor/index.js +27 -9
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +26 -9
- package/build-module/components/error-boundary/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/context-menu.js +1 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +1 -1
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +35 -10
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -15
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +1 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +1 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +0 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +0 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +0 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -2
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +119 -0
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
- package/build-module/components/global-styles/screen-text-color.js +0 -2
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +29 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header/index.js +13 -5
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +65 -0
- package/build-module/components/header/mode-switcher/index.js.map +1 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/header/more-menu/index.js +4 -2
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +17 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +5 -4
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +3 -3
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/routes/redirect-to-homepage.js +3 -22
- package/build-module/components/routes/redirect-to-homepage.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- 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 +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +1 -4
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/index.js +2 -14
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +25 -9
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +148 -68
- package/build-style/style.css +148 -68
- package/package.json +28 -30
- package/src/components/add-new-template/new-template-part.js +1 -7
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +10 -18
- package/src/components/code-editor/code-editor-text-area.js +79 -0
- package/src/components/code-editor/index.js +65 -0
- package/src/components/code-editor/style.scss +100 -0
- package/src/components/editor/index.js +41 -10
- package/src/components/error-boundary/index.js +28 -11
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/context-menu.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +1 -2
- package/src/components/global-styles/header.js +3 -5
- package/src/components/global-styles/navigation-button.js +31 -10
- package/src/components/global-styles/palette.js +6 -2
- package/src/components/global-styles/preview.js +46 -18
- package/src/components/global-styles/screen-background-color.js +1 -3
- package/src/components/global-styles/screen-block-list.js +1 -2
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +0 -2
- package/src/components/global-styles/screen-colors.js +2 -3
- package/src/components/global-styles/screen-layout.js +1 -5
- package/src/components/global-styles/screen-link-color.js +0 -2
- package/src/components/global-styles/screen-root.js +32 -3
- package/src/components/global-styles/screen-style-variations.js +130 -0
- package/src/components/global-styles/screen-text-color.js +0 -2
- package/src/components/global-styles/screen-typography-element.js +0 -4
- package/src/components/global-styles/screen-typography.js +2 -3
- package/src/components/global-styles/style.scss +24 -25
- package/src/components/global-styles/ui.js +55 -25
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/index.js +10 -2
- package/src/components/header/mode-switcher/index.js +67 -0
- package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
- package/src/components/header/more-menu/index.js +4 -0
- package/src/components/header/style.scss +2 -1
- package/src/components/keyboard-shortcuts/index.js +17 -1
- package/src/components/list/actions/index.js +5 -4
- package/src/components/list/actions/rename-menu-item.js +3 -3
- package/src/components/routes/redirect-to-homepage.js +4 -27
- package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/components/secondary-sidebar/style.scss +0 -4
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +1 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/template-part-converter/convert-to-template-part.js +1 -6
- package/src/index.js +2 -18
- package/src/store/actions.js +25 -10
- package/src/store/defaults.js +1 -0
- package/src/store/reducer.js +6 -0
- package/src/store/selectors.js +11 -0
- package/src/store/test/actions.js +2 -2
- package/src/style.scss +1 -0
- package/build/components/error-boundary/warning.js +0 -70
- package/build/components/error-boundary/warning.js.map +0 -1
- package/build-module/components/error-boundary/warning.js +0 -60
- package/build-module/components/error-boundary/warning.js.map +0 -1
- package/src/components/error-boundary/warning.js +0 -59
|
@@ -39,14 +39,14 @@ export default function Actions( { template } ) {
|
|
|
39
39
|
template.id
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
createSuccessNotice( __( '
|
|
42
|
+
createSuccessNotice( __( 'Entity reverted.' ), {
|
|
43
43
|
type: 'snackbar',
|
|
44
44
|
} );
|
|
45
45
|
} catch ( error ) {
|
|
46
46
|
const errorMessage =
|
|
47
47
|
error.message && error.code !== 'unknown_error'
|
|
48
48
|
? error.message
|
|
49
|
-
: __( 'An error occurred while reverting the
|
|
49
|
+
: __( 'An error occurred while reverting the entity.' );
|
|
50
50
|
|
|
51
51
|
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
52
52
|
}
|
|
@@ -68,18 +68,19 @@ export default function Actions( { template } ) {
|
|
|
68
68
|
/>
|
|
69
69
|
<MenuItem
|
|
70
70
|
isDestructive
|
|
71
|
+
isTertiary
|
|
71
72
|
onClick={ () => {
|
|
72
73
|
removeTemplate( template );
|
|
73
74
|
onClose();
|
|
74
75
|
} }
|
|
75
76
|
>
|
|
76
|
-
{ __( 'Delete
|
|
77
|
+
{ __( 'Delete' ) }
|
|
77
78
|
</MenuItem>
|
|
78
79
|
</>
|
|
79
80
|
) }
|
|
80
81
|
{ isRevertable && (
|
|
81
82
|
<MenuItem
|
|
82
|
-
info={ __( 'Restore
|
|
83
|
+
info={ __( 'Restore to default state' ) }
|
|
83
84
|
onClick={ () => {
|
|
84
85
|
revertAndSaveTemplate();
|
|
85
86
|
onClose();
|
|
@@ -61,14 +61,14 @@ export default function RenameMenuItem( { template, onClose } ) {
|
|
|
61
61
|
throw lastError;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
createSuccessNotice( __( '
|
|
64
|
+
createSuccessNotice( __( 'Entity renamed.' ), {
|
|
65
65
|
type: 'snackbar',
|
|
66
66
|
} );
|
|
67
67
|
} catch ( error ) {
|
|
68
68
|
const errorMessage =
|
|
69
69
|
error.message && error.code !== 'unknown_error'
|
|
70
70
|
? error.message
|
|
71
|
-
: __( 'An error occurred while renaming the
|
|
71
|
+
: __( 'An error occurred while renaming the entity.' );
|
|
72
72
|
|
|
73
73
|
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
74
74
|
}
|
|
@@ -86,7 +86,7 @@ export default function RenameMenuItem( { template, onClose } ) {
|
|
|
86
86
|
</MenuItem>
|
|
87
87
|
{ isModalOpen && (
|
|
88
88
|
<Modal
|
|
89
|
-
title={ __( 'Rename
|
|
89
|
+
title={ __( 'Rename' ) }
|
|
90
90
|
closeLabel={ __( 'Close' ) }
|
|
91
91
|
onRequestClose={ () => {
|
|
92
92
|
setIsModalOpen( false );
|
|
@@ -20,17 +20,10 @@ function getNeedsHomepageRedirect( params ) {
|
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* Returns the postType and postId of the default homepage.
|
|
25
|
-
*
|
|
26
|
-
* @param {string} siteUrl The URL of the site.
|
|
27
|
-
* @return {Object} An object containing the postType and postId properties
|
|
28
|
-
* or `undefined` if a homepage could not be found.
|
|
29
|
-
*/
|
|
30
23
|
async function getHomepageParams( siteUrl ) {
|
|
31
24
|
const siteSettings = await apiFetch( { path: '/wp/v2/settings' } );
|
|
32
25
|
if ( ! siteSettings ) {
|
|
33
|
-
|
|
26
|
+
return;
|
|
34
27
|
}
|
|
35
28
|
|
|
36
29
|
const {
|
|
@@ -51,27 +44,11 @@ async function getHomepageParams( siteUrl ) {
|
|
|
51
44
|
// (packages/core-data/src/resolvers.js)
|
|
52
45
|
const template = await window
|
|
53
46
|
.fetch( addQueryArgs( siteUrl, { '_wp-find-template': true } ) )
|
|
54
|
-
.then( (
|
|
55
|
-
|
|
56
|
-
throw new Error(
|
|
57
|
-
`\`getHomepageParams\`: HTTP status error, ${ response.status } ${ response.statusText }`
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return response.json();
|
|
62
|
-
} )
|
|
63
|
-
.then( ( { data } ) => {
|
|
64
|
-
if ( data.message ) {
|
|
65
|
-
throw new Error(
|
|
66
|
-
`\`getHomepageParams\`: REST API error, ${ data.message }`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return data;
|
|
71
|
-
} );
|
|
47
|
+
.then( ( res ) => res.json() )
|
|
48
|
+
.then( ( { data } ) => data );
|
|
72
49
|
|
|
73
50
|
if ( ! template?.id ) {
|
|
74
|
-
|
|
51
|
+
return;
|
|
75
52
|
}
|
|
76
53
|
|
|
77
54
|
return {
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { Button } from '@wordpress/components';
|
|
5
|
+
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
6
6
|
import { __experimentalLibrary as Library } from '@wordpress/block-editor';
|
|
7
7
|
import { close } from '@wordpress/icons';
|
|
8
8
|
import {
|
|
9
9
|
useViewportMatch,
|
|
10
10
|
__experimentalUseDialog as useDialog,
|
|
11
11
|
} from '@wordpress/compose';
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
@@ -23,22 +25,30 @@ export default function InserterSidebar() {
|
|
|
23
25
|
);
|
|
24
26
|
|
|
25
27
|
const isMobile = useViewportMatch( 'medium', '<' );
|
|
28
|
+
const TagName = ! isMobile ? VisuallyHidden : 'div';
|
|
26
29
|
const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
|
|
27
30
|
onClose: () => setIsInserterOpened( false ),
|
|
31
|
+
focusOnMount: null,
|
|
28
32
|
} );
|
|
29
33
|
|
|
34
|
+
const libraryRef = useRef();
|
|
35
|
+
useEffect( () => {
|
|
36
|
+
libraryRef.current.focusSearch();
|
|
37
|
+
}, [] );
|
|
38
|
+
|
|
30
39
|
return (
|
|
31
40
|
<div
|
|
32
41
|
ref={ inserterDialogRef }
|
|
33
42
|
{ ...inserterDialogProps }
|
|
34
43
|
className="edit-site-editor__inserter-panel"
|
|
35
44
|
>
|
|
36
|
-
<
|
|
45
|
+
<TagName className="edit-site-editor__inserter-panel-header">
|
|
37
46
|
<Button
|
|
38
47
|
icon={ close }
|
|
48
|
+
label={ __( 'Close block inserter' ) }
|
|
39
49
|
onClick={ () => setIsInserterOpened( false ) }
|
|
40
50
|
/>
|
|
41
|
-
</
|
|
51
|
+
</TagName>
|
|
42
52
|
<div className="edit-site-editor__inserter-panel-content">
|
|
43
53
|
<Library
|
|
44
54
|
showInserterHelpPanel
|
|
@@ -48,6 +58,7 @@ export default function InserterSidebar() {
|
|
|
48
58
|
insertionPoint.insertionIndex
|
|
49
59
|
}
|
|
50
60
|
__experimentalFilterValue={ insertionPoint.filterValue }
|
|
61
|
+
ref={ libraryRef }
|
|
51
62
|
/>
|
|
52
63
|
</div>
|
|
53
64
|
</div>
|
|
@@ -32,7 +32,8 @@ export default function ListViewSidebar() {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
35
|
-
const
|
|
35
|
+
const headerFocusReturnRef = useFocusReturn();
|
|
36
|
+
const contentFocusReturnRef = useFocusReturn();
|
|
36
37
|
function closeOnEscape( event ) {
|
|
37
38
|
if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
|
|
38
39
|
setIsListViewOpened( false );
|
|
@@ -49,17 +50,23 @@ export default function ListViewSidebar() {
|
|
|
49
50
|
className="edit-site-editor__list-view-panel"
|
|
50
51
|
onKeyDown={ closeOnEscape }
|
|
51
52
|
>
|
|
52
|
-
<div
|
|
53
|
-
|
|
53
|
+
<div
|
|
54
|
+
className="edit-site-editor__list-view-panel-header"
|
|
55
|
+
ref={ headerFocusReturnRef }
|
|
56
|
+
>
|
|
57
|
+
<strong id={ labelId }>{ __( 'List View' ) }</strong>
|
|
54
58
|
<Button
|
|
55
59
|
icon={ closeSmall }
|
|
56
|
-
label={ __( 'Close
|
|
60
|
+
label={ __( 'Close List View Sidebar' ) }
|
|
57
61
|
onClick={ () => setIsListViewOpened( false ) }
|
|
58
62
|
/>
|
|
59
63
|
</div>
|
|
60
64
|
<div
|
|
61
65
|
className="edit-site-editor__list-view-panel-content"
|
|
62
|
-
ref={ useMergeRefs( [
|
|
66
|
+
ref={ useMergeRefs( [
|
|
67
|
+
contentFocusReturnRef,
|
|
68
|
+
focusOnMountRef,
|
|
69
|
+
] ) }
|
|
63
70
|
>
|
|
64
71
|
<ListView
|
|
65
72
|
onSelect={ selectEditorBlock }
|
|
@@ -15,6 +15,7 @@ export default function DefaultSidebar( {
|
|
|
15
15
|
closeLabel,
|
|
16
16
|
header,
|
|
17
17
|
headerClassName,
|
|
18
|
+
panelClassName,
|
|
18
19
|
} ) {
|
|
19
20
|
return (
|
|
20
21
|
<>
|
|
@@ -27,6 +28,7 @@ export default function DefaultSidebar( {
|
|
|
27
28
|
closeLabel={ closeLabel }
|
|
28
29
|
header={ header }
|
|
29
30
|
headerClassName={ headerClassName }
|
|
31
|
+
panelClassName={ panelClassName }
|
|
30
32
|
>
|
|
31
33
|
{ children }
|
|
32
34
|
</ComplementaryArea>
|
|
@@ -17,6 +17,23 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.edit-site-global-styles-sidebar {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
height: 100%;
|
|
24
|
+
|
|
25
|
+
&__panel,
|
|
26
|
+
&__navigator-provider {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
flex: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__navigator-screen {
|
|
33
|
+
flex: 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
20
37
|
.edit-site-global-styles-sidebar .interface-complementary-area-header .components-button.has-icon {
|
|
21
38
|
margin-left: 0;
|
|
22
39
|
}
|
|
@@ -25,20 +42,6 @@
|
|
|
25
42
|
margin-left: auto;
|
|
26
43
|
}
|
|
27
44
|
|
|
28
|
-
.edit-site-global-styles-sidebar__border-controls-row {
|
|
29
|
-
display: flex;
|
|
30
|
-
justify-content: space-between;
|
|
31
|
-
margin-bottom: $grid-unit-15;
|
|
32
|
-
|
|
33
|
-
> * {
|
|
34
|
-
width: calc(50% - #{ $grid-unit-10 });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.components-border-style-control__buttons {
|
|
38
|
-
margin-bottom: 0;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
45
|
.edit-site-global-styles-sidebar .components-navigation__menu-title-heading {
|
|
43
46
|
font-size: $default-font-size * 1.2;
|
|
44
47
|
font-weight: 500;
|
|
@@ -53,6 +56,10 @@
|
|
|
53
56
|
border: 0;
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
.edit-site-global-styles-sidebar .components-tools-panel-item.single-column {
|
|
60
|
+
grid-column: span 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
.edit-site-global-styles-sidebar__blocks-group {
|
|
57
64
|
padding-top: $grid-unit-30;
|
|
58
65
|
border-top: $border-width solid $gray-200;
|
|
@@ -30,16 +30,11 @@ export default function ConvertToTemplatePart( { clientIds, blocks } ) {
|
|
|
30
30
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
31
31
|
|
|
32
32
|
const onConvert = async ( { title, area } ) => {
|
|
33
|
-
// Currently template parts only allow latin chars.
|
|
34
|
-
// Fallback slug will receive suffix by default.
|
|
35
|
-
const cleanSlug =
|
|
36
|
-
kebabCase( title ).replace( /[^\w-]+/g, '' ) || 'wp-custom-part';
|
|
37
|
-
|
|
38
33
|
const templatePart = await saveEntityRecord(
|
|
39
34
|
'postType',
|
|
40
35
|
'wp_template_part',
|
|
41
36
|
{
|
|
42
|
-
slug:
|
|
37
|
+
slug: kebabCase( title ),
|
|
43
38
|
title,
|
|
44
39
|
content: serialize( blocks ),
|
|
45
40
|
area,
|
package/src/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
__experimentalFetchUrlData as fetchUrlData,
|
|
14
14
|
} from '@wordpress/core-data';
|
|
15
15
|
import { store as editorStore } from '@wordpress/editor';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
17
16
|
import { store as viewportStore } from '@wordpress/viewport';
|
|
18
17
|
import { getQueryArgs } from '@wordpress/url';
|
|
19
18
|
|
|
@@ -25,7 +24,6 @@ import { store as editSiteStore } from './store';
|
|
|
25
24
|
import EditSiteApp from './components/app';
|
|
26
25
|
import getIsListPage from './utils/get-is-list-page';
|
|
27
26
|
import redirectToHomepage from './components/routes/redirect-to-homepage';
|
|
28
|
-
import ErrorBoundaryWarning from './components/error-boundary/warning';
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* Reinitializes the editor after the user chooses to reboot the editor after
|
|
@@ -40,21 +38,7 @@ export async function reinitializeEditor( target, settings ) {
|
|
|
40
38
|
// define what's being edited. When visiting via the dashboard link, these
|
|
41
39
|
// won't be present. Do a client side redirect to the 'homepage' if that's
|
|
42
40
|
// the case.
|
|
43
|
-
|
|
44
|
-
await redirectToHomepage( settings.siteUrl );
|
|
45
|
-
} catch ( error ) {
|
|
46
|
-
render(
|
|
47
|
-
<ErrorBoundaryWarning
|
|
48
|
-
message={ __(
|
|
49
|
-
'The editor is unable to find a block template for the homepage.'
|
|
50
|
-
) }
|
|
51
|
-
error={ error }
|
|
52
|
-
dashboardLink="index.php"
|
|
53
|
-
/>,
|
|
54
|
-
target
|
|
55
|
-
);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
41
|
+
await redirectToHomepage( settings.siteUrl );
|
|
58
42
|
|
|
59
43
|
// This will be a no-op if the target doesn't have any React nodes.
|
|
60
44
|
unmountComponentAtNode( target );
|
|
@@ -106,7 +90,7 @@ export function initializeEditor( id, settings ) {
|
|
|
106
90
|
|
|
107
91
|
dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
|
|
108
92
|
registerCoreBlocks();
|
|
109
|
-
if ( process.env.
|
|
93
|
+
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
110
94
|
__experimentalRegisterExperimentalCoreBlocks( {
|
|
111
95
|
enableFSEBlocks: true,
|
|
112
96
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -9,6 +9,8 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
9
9
|
import { store as noticesStore } from '@wordpress/notices';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
12
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
13
|
+
import { speak } from '@wordpress/a11y';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
@@ -138,7 +140,7 @@ export function* removeTemplate( template ) {
|
|
|
138
140
|
'createSuccessNotice',
|
|
139
141
|
sprintf(
|
|
140
142
|
/* translators: The template/part's name. */
|
|
141
|
-
__( '"%s"
|
|
143
|
+
__( '"%s" deleted.' ),
|
|
142
144
|
template.title.rendered
|
|
143
145
|
),
|
|
144
146
|
{ type: 'snackbar' }
|
|
@@ -206,20 +208,14 @@ export function* setPage( page ) {
|
|
|
206
208
|
page.context.postType || 'post',
|
|
207
209
|
page.context.postId
|
|
208
210
|
);
|
|
209
|
-
|
|
210
|
-
page.path = getPathAndQueryString( entity
|
|
211
|
+
// If the entity is undefined for some reason, path will resolve to "/"
|
|
212
|
+
page.path = getPathAndQueryString( entity?.link );
|
|
211
213
|
}
|
|
212
|
-
const
|
|
214
|
+
const { id: templateId, slug: templateSlug } = yield controls.resolveSelect(
|
|
213
215
|
coreStore,
|
|
214
216
|
'__experimentalGetTemplateForLink',
|
|
215
217
|
page.path
|
|
216
218
|
);
|
|
217
|
-
|
|
218
|
-
if ( ! template ) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const { id: templateId, slug: templateSlug } = template;
|
|
223
219
|
yield {
|
|
224
220
|
type: 'SET_PAGE',
|
|
225
221
|
page: ! templateSlug
|
|
@@ -492,3 +488,22 @@ export function* closeGeneralSidebar() {
|
|
|
492
488
|
editSiteStoreName
|
|
493
489
|
);
|
|
494
490
|
}
|
|
491
|
+
|
|
492
|
+
export function* switchEditorMode( mode ) {
|
|
493
|
+
yield {
|
|
494
|
+
type: 'SWITCH_MODE',
|
|
495
|
+
mode,
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// Unselect blocks when we switch to a non visual mode.
|
|
499
|
+
if ( mode !== 'visual' ) {
|
|
500
|
+
yield controls.dispatch( blockEditorStore.name, 'clearSelectedBlock' );
|
|
501
|
+
}
|
|
502
|
+
const messages = {
|
|
503
|
+
visual: __( 'Visual editor selected' ),
|
|
504
|
+
mosaic: __( 'Mosaic view selected' ),
|
|
505
|
+
};
|
|
506
|
+
if ( messages[ mode ] ) {
|
|
507
|
+
speak( messages[ mode ], 'assertive' );
|
|
508
|
+
}
|
|
509
|
+
}
|
package/src/store/defaults.js
CHANGED
package/src/store/reducer.js
CHANGED
|
@@ -29,6 +29,12 @@ export const preferences = combineReducers( {
|
|
|
29
29
|
return state;
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
editorMode( state = PREFERENCES_DEFAULTS.editorMode, action ) {
|
|
33
|
+
if ( action.type === 'SWITCH_MODE' ) {
|
|
34
|
+
return action.mode;
|
|
35
|
+
}
|
|
36
|
+
return state;
|
|
37
|
+
},
|
|
32
38
|
} );
|
|
33
39
|
|
|
34
40
|
/**
|
package/src/store/selectors.js
CHANGED
|
@@ -327,3 +327,14 @@ export const getCurrentTemplateTemplateParts = createRegistrySelector(
|
|
|
327
327
|
.filter( ( { templatePart } ) => !! templatePart );
|
|
328
328
|
}
|
|
329
329
|
);
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Returns the current editing mode.
|
|
333
|
+
*
|
|
334
|
+
* @param {Object} state Global application state.
|
|
335
|
+
*
|
|
336
|
+
* @return {string} Editing mode.
|
|
337
|
+
*/
|
|
338
|
+
export function getEditorMode( state ) {
|
|
339
|
+
return state.preferences.editorMode || 'visual';
|
|
340
|
+
}
|
|
@@ -95,10 +95,10 @@ describe( 'actions', () => {
|
|
|
95
95
|
selectorName: '__experimentalGetTemplateForLink',
|
|
96
96
|
args: [ page.path ],
|
|
97
97
|
} );
|
|
98
|
-
expect( it.next( { id: '
|
|
98
|
+
expect( it.next( { id: 'emptytheme//single' } ).value ).toEqual( {
|
|
99
99
|
type: 'SET_PAGE',
|
|
100
100
|
page,
|
|
101
|
-
templateId: '
|
|
101
|
+
templateId: 'emptytheme//single',
|
|
102
102
|
} );
|
|
103
103
|
expect( it.next().done ).toBe( true );
|
|
104
104
|
} );
|
package/src/style.scss
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@import "../../interface/src/style.scss";
|
|
2
2
|
|
|
3
3
|
@import "./components/block-editor/style.scss";
|
|
4
|
+
@import "./components/code-editor/style.scss";
|
|
4
5
|
@import "./components/global-styles/style.scss";
|
|
5
6
|
@import "./components/header/style.scss";
|
|
6
7
|
@import "./components/header/document-actions/style.scss";
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = ErrorBoundaryWarning;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
-
|
|
16
|
-
var _compose = require("@wordpress/compose");
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
function CopyButton(_ref) {
|
|
22
|
-
let {
|
|
23
|
-
text,
|
|
24
|
-
children
|
|
25
|
-
} = _ref;
|
|
26
|
-
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
27
|
-
return (0, _element.createElement)(_components.Button, {
|
|
28
|
-
variant: "secondary",
|
|
29
|
-
ref: ref
|
|
30
|
-
}, children);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function ErrorBoundaryWarning(_ref2) {
|
|
34
|
-
let {
|
|
35
|
-
message,
|
|
36
|
-
error,
|
|
37
|
-
reboot,
|
|
38
|
-
dashboardLink
|
|
39
|
-
} = _ref2;
|
|
40
|
-
const actions = [];
|
|
41
|
-
|
|
42
|
-
if (reboot) {
|
|
43
|
-
actions.push((0, _element.createElement)(_components.Button, {
|
|
44
|
-
key: "recovery",
|
|
45
|
-
onClick: reboot,
|
|
46
|
-
variant: "secondary"
|
|
47
|
-
}, (0, _i18n.__)('Attempt Recovery')));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (error) {
|
|
51
|
-
actions.push((0, _element.createElement)(CopyButton, {
|
|
52
|
-
key: "copy-error",
|
|
53
|
-
text: error.stack
|
|
54
|
-
}, (0, _i18n.__)('Copy Error')));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (dashboardLink) {
|
|
58
|
-
actions.push((0, _element.createElement)(_components.Button, {
|
|
59
|
-
key: "back-to-dashboard",
|
|
60
|
-
variant: "secondary",
|
|
61
|
-
href: dashboardLink
|
|
62
|
-
}, (0, _i18n.__)('Back to dashboard')));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (0, _element.createElement)(_blockEditor.Warning, {
|
|
66
|
-
className: "editor-error-boundary",
|
|
67
|
-
actions: actions
|
|
68
|
-
}, message);
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/warning.js"],"names":["CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","reboot","dashboardLink","actions","push","stack"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,SAASA,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAG,iCAAoBF,IAApB,CAAZ;AACA,SACC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAEc,SAASE,oBAAT,QAKX;AAAA,MAL0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,KAF6C;AAG7CC,IAAAA,MAH6C;AAI7CC,IAAAA;AAJ6C,GAK1C;AACH,QAAMC,OAAO,GAAG,EAAhB;;AAEA,MAAKF,MAAL,EAAc;AACbE,IAAAA,OAAO,CAACC,IAAR,CACC,4BAAC,kBAAD;AAAQ,MAAA,GAAG,EAAC,UAAZ;AAAuB,MAAA,OAAO,EAAGH,MAAjC;AAA0C,MAAA,OAAO,EAAC;AAAlD,OACG,cAAI,kBAAJ,CADH,CADD;AAKA;;AAED,MAAKD,KAAL,EAAa;AACZG,IAAAA,OAAO,CAACC,IAAR,CACC,4BAAC,UAAD;AAAY,MAAA,GAAG,EAAC,YAAhB;AAA6B,MAAA,IAAI,EAAGJ,KAAK,CAACK;AAA1C,OACG,cAAI,YAAJ,CADH,CADD;AAKA;;AAED,MAAKH,aAAL,EAAqB;AACpBC,IAAAA,OAAO,CAACC,IAAR,CACC,4BAAC,kBAAD;AACC,MAAA,GAAG,EAAC,mBADL;AAEC,MAAA,OAAO,EAAC,WAFT;AAGC,MAAA,IAAI,EAAGF;AAHR,OAKG,cAAI,mBAAJ,CALH,CADD;AASA;;AAED,SACC,4BAAC,oBAAD;AAAS,IAAA,SAAS,EAAC,uBAAnB;AAA2C,IAAA,OAAO,EAAGC;AAArD,KACGJ,OADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default function ErrorBoundaryWarning( {\n\tmessage,\n\terror,\n\treboot,\n\tdashboardLink,\n} ) {\n\tconst actions = [];\n\n\tif ( reboot ) {\n\t\tactions.push(\n\t\t\t<Button key=\"recovery\" onClick={ reboot } variant=\"secondary\">\n\t\t\t\t{ __( 'Attempt Recovery' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\tif ( error ) {\n\t\tactions.push(\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>\n\t\t);\n\t}\n\n\tif ( dashboardLink ) {\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\tkey=\"back-to-dashboard\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\thref={ dashboardLink }\n\t\t\t>\n\t\t\t\t{ __( 'Back to dashboard' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n"]}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { Button } from '@wordpress/components';
|
|
8
|
-
import { Warning } from '@wordpress/block-editor';
|
|
9
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
10
|
-
|
|
11
|
-
function CopyButton(_ref) {
|
|
12
|
-
let {
|
|
13
|
-
text,
|
|
14
|
-
children
|
|
15
|
-
} = _ref;
|
|
16
|
-
const ref = useCopyToClipboard(text);
|
|
17
|
-
return createElement(Button, {
|
|
18
|
-
variant: "secondary",
|
|
19
|
-
ref: ref
|
|
20
|
-
}, children);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default function ErrorBoundaryWarning(_ref2) {
|
|
24
|
-
let {
|
|
25
|
-
message,
|
|
26
|
-
error,
|
|
27
|
-
reboot,
|
|
28
|
-
dashboardLink
|
|
29
|
-
} = _ref2;
|
|
30
|
-
const actions = [];
|
|
31
|
-
|
|
32
|
-
if (reboot) {
|
|
33
|
-
actions.push(createElement(Button, {
|
|
34
|
-
key: "recovery",
|
|
35
|
-
onClick: reboot,
|
|
36
|
-
variant: "secondary"
|
|
37
|
-
}, __('Attempt Recovery')));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (error) {
|
|
41
|
-
actions.push(createElement(CopyButton, {
|
|
42
|
-
key: "copy-error",
|
|
43
|
-
text: error.stack
|
|
44
|
-
}, __('Copy Error')));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (dashboardLink) {
|
|
48
|
-
actions.push(createElement(Button, {
|
|
49
|
-
key: "back-to-dashboard",
|
|
50
|
-
variant: "secondary",
|
|
51
|
-
href: dashboardLink
|
|
52
|
-
}, __('Back to dashboard')));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return createElement(Warning, {
|
|
56
|
-
className: "editor-error-boundary",
|
|
57
|
-
actions: actions
|
|
58
|
-
}, message);
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/warning.js"],"names":["__","Button","Warning","useCopyToClipboard","CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","reboot","dashboardLink","actions","push","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;;AAEA,SAASC,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAGJ,kBAAkB,CAAEE,IAAF,CAA9B;AACA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,eAAe,SAASE,oBAAT,QAKX;AAAA,MAL0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,KAF6C;AAG7CC,IAAAA,MAH6C;AAI7CC,IAAAA;AAJ6C,GAK1C;AACH,QAAMC,OAAO,GAAG,EAAhB;;AAEA,MAAKF,MAAL,EAAc;AACbE,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AAAQ,MAAA,GAAG,EAAC,UAAZ;AAAuB,MAAA,OAAO,EAAGH,MAAjC;AAA0C,MAAA,OAAO,EAAC;AAAlD,OACGX,EAAE,CAAE,kBAAF,CADL,CADD;AAKA;;AAED,MAAKU,KAAL,EAAa;AACZG,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,UAAD;AAAY,MAAA,GAAG,EAAC,YAAhB;AAA6B,MAAA,IAAI,EAAGJ,KAAK,CAACK;AAA1C,OACGf,EAAE,CAAE,YAAF,CADL,CADD;AAKA;;AAED,MAAKY,aAAL,EAAqB;AACpBC,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AACC,MAAA,GAAG,EAAC,mBADL;AAEC,MAAA,OAAO,EAAC,WAFT;AAGC,MAAA,IAAI,EAAGF;AAHR,OAKGZ,EAAE,CAAE,mBAAF,CALL,CADD;AASA;;AAED,SACC,cAAC,OAAD;AAAS,IAAA,SAAS,EAAC,uBAAnB;AAA2C,IAAA,OAAO,EAAGa;AAArD,KACGJ,OADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default function ErrorBoundaryWarning( {\n\tmessage,\n\terror,\n\treboot,\n\tdashboardLink,\n} ) {\n\tconst actions = [];\n\n\tif ( reboot ) {\n\t\tactions.push(\n\t\t\t<Button key=\"recovery\" onClick={ reboot } variant=\"secondary\">\n\t\t\t\t{ __( 'Attempt Recovery' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\tif ( error ) {\n\t\tactions.push(\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>\n\t\t);\n\t}\n\n\tif ( dashboardLink ) {\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\tkey=\"back-to-dashboard\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\thref={ dashboardLink }\n\t\t\t>\n\t\t\t\t{ __( 'Back to dashboard' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n"]}
|