@wordpress/edit-site 4.0.1-next.f435e9e01b.0 → 4.0.3-next.a55ed9455a.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 +1 -1
- package/build/components/add-new-template/new-template-part.js +4 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/app/index.js +20 -0
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +7 -3
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/editor/index.js +3 -18
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +11 -27
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +70 -0
- package/build/components/error-boundary/warning.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +7 -27
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +31 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +5 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +21 -4
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -2
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header/index.js +1 -1
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +9 -21
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/site-export.js +1 -1
- package/build/components/header/more-menu/site-export.js.map +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js +4 -8
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/table.js +9 -20
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +9 -3
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +15 -4
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -11
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +5 -5
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/welcome-guide/editor.js +6 -6
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/styles.js +6 -4
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/index.js +22 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +203 -163
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +3 -9
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +0 -44
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +33 -10
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +4 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/app/index.js +16 -0
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +6 -3
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/editor/index.js +4 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +9 -26
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +60 -0
- package/build-module/components/error-boundary/warning.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +8 -28
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +31 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +6 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +20 -4
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header/index.js +1 -1
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +11 -22
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/site-export.js +1 -1
- package/build-module/components/header/more-menu/site-export.js.map +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js +4 -8
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/table.js +9 -21
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +9 -3
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +12 -4
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -12
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +4 -4
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +5 -5
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +5 -4
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/index.js +20 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +181 -154
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +4 -9
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +0 -40
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +28 -10
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +101 -38
- package/build-style/style.css +101 -38
- package/package.json +33 -27
- package/src/components/add-new-template/new-template-part.js +7 -1
- package/src/components/app/index.js +19 -0
- package/src/components/editor/global-styles-renderer.js +7 -1
- package/src/components/editor/index.js +2 -20
- package/src/components/error-boundary/index.js +11 -28
- package/src/components/error-boundary/warning.js +59 -0
- package/src/components/global-styles/navigation-button.js +6 -25
- package/src/components/global-styles/screen-block-list.js +27 -2
- package/src/components/global-styles/screen-typography.js +1 -2
- package/src/components/global-styles/typography-panel.js +12 -5
- package/src/components/global-styles/use-global-styles-output.js +19 -3
- package/src/components/global-styles/utils.js +2 -2
- package/src/components/header/index.js +1 -1
- package/src/components/header/more-menu/index.js +12 -29
- package/src/components/header/more-menu/site-export.js +1 -1
- package/src/components/header/more-menu/welcome-guide-menu-item.js +3 -7
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/list/table.js +18 -23
- package/src/components/navigation-sidebar/navigation-panel/index.js +16 -11
- package/src/components/navigation-sidebar/navigation-toggle/index.js +13 -4
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +32 -31
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +1 -1
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -11
- package/src/components/sidebar/global-styles-sidebar.js +6 -3
- package/src/components/sidebar/style.scss +1 -1
- package/src/components/template-part-converter/convert-to-template-part.js +6 -1
- package/src/components/welcome-guide/editor.js +8 -4
- package/src/components/welcome-guide/styles.js +5 -3
- package/src/index.js +25 -7
- package/src/store/actions.js +180 -215
- package/src/store/index.js +2 -8
- package/src/store/reducer.js +0 -30
- package/src/store/selectors.js +37 -10
- package/src/store/test/actions.js +203 -92
- package/src/store/test/reducer.js +0 -22
- package/src/store/test/selectors.js +22 -53
- package/src/style.scss +0 -1
- package/build/components/header/feature-toggle/index.js +0 -66
- package/build/components/header/feature-toggle/index.js.map +0 -1
- package/build/components/routes/redirect-to-homepage.js +0 -87
- package/build/components/routes/redirect-to-homepage.js.map +0 -1
- package/build/store/defaults.js +0 -15
- package/build/store/defaults.js.map +0 -1
- package/build-module/components/header/feature-toggle/index.js +0 -52
- package/build-module/components/header/feature-toggle/index.js.map +0 -1
- package/build-module/components/routes/redirect-to-homepage.js +0 -75
- package/build-module/components/routes/redirect-to-homepage.js.map +0 -1
- package/build-module/store/defaults.js +0 -8
- package/build-module/store/defaults.js.map +0 -1
- package/src/components/header/feature-toggle/index.js +0 -55
- package/src/components/header/more-menu/style.scss +0 -29
- package/src/components/routes/redirect-to-homepage.js +0 -71
- package/src/store/defaults.js +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3-next.a55ed9455a.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,31 +27,33 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.0.
|
|
32
|
-
"@wordpress/block-editor": "^8.1
|
|
33
|
-
"@wordpress/block-library": "^7.0.
|
|
34
|
-
"@wordpress/blocks": "^11.2.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.1.
|
|
37
|
-
"@wordpress/core-data": "^4.1.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.1.
|
|
42
|
-
"@wordpress/hooks": "^3.3.
|
|
43
|
-
"@wordpress/html-entities": "^3.3.
|
|
44
|
-
"@wordpress/i18n": "^4.3.
|
|
45
|
-
"@wordpress/icons": "^
|
|
46
|
-
"@wordpress/interface": "^4.2.
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^3.1.
|
|
48
|
-
"@wordpress/keycodes": "^3.3.
|
|
49
|
-
"@wordpress/media-utils": "^3.1.
|
|
50
|
-
"@wordpress/notices": "^3.3.
|
|
51
|
-
"@wordpress/plugins": "^4.1.
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
30
|
+
"@wordpress/a11y": "^3.3.2-next.a55ed9455a.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.0.2-next.a55ed9455a.0",
|
|
32
|
+
"@wordpress/block-editor": "^8.2.1-next.a55ed9455a.0",
|
|
33
|
+
"@wordpress/block-library": "^7.0.3-next.a55ed9455a.0",
|
|
34
|
+
"@wordpress/blocks": "^11.2.3-next.a55ed9455a.0",
|
|
35
|
+
"@wordpress/components": "^19.6.1-next.a55ed9455a.0",
|
|
36
|
+
"@wordpress/compose": "^5.1.3-next.a55ed9455a.0",
|
|
37
|
+
"@wordpress/core-data": "^4.1.3-next.a55ed9455a.0",
|
|
38
|
+
"@wordpress/data": "^6.3.1-next.a55ed9455a.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.3.2-next.a55ed9455a.0",
|
|
40
|
+
"@wordpress/editor": "^12.3.1-next.a55ed9455a.0",
|
|
41
|
+
"@wordpress/element": "^4.1.3-next.a55ed9455a.0",
|
|
42
|
+
"@wordpress/hooks": "^3.3.2-next.a55ed9455a.0",
|
|
43
|
+
"@wordpress/html-entities": "^3.3.2-next.a55ed9455a.0",
|
|
44
|
+
"@wordpress/i18n": "^4.3.2-next.a55ed9455a.0",
|
|
45
|
+
"@wordpress/icons": "^7.0.2-next.a55ed9455a.0",
|
|
46
|
+
"@wordpress/interface": "^4.2.4-next.a55ed9455a.0",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^3.1.3-next.a55ed9455a.0",
|
|
48
|
+
"@wordpress/keycodes": "^3.3.2-next.a55ed9455a.0",
|
|
49
|
+
"@wordpress/media-utils": "^3.1.2-next.a55ed9455a.0",
|
|
50
|
+
"@wordpress/notices": "^3.3.3-next.a55ed9455a.0",
|
|
51
|
+
"@wordpress/plugins": "^4.1.4-next.a55ed9455a.0",
|
|
52
|
+
"@wordpress/preferences": "^1.0.0-prerelease",
|
|
53
|
+
"@wordpress/reusable-blocks": "^3.1.4-next.a55ed9455a.0",
|
|
54
|
+
"@wordpress/style-engine": "^0.2.1-next.a55ed9455a.0",
|
|
55
|
+
"@wordpress/url": "^3.4.2-next.a55ed9455a.0",
|
|
56
|
+
"@wordpress/viewport": "^4.1.3-next.a55ed9455a.0",
|
|
55
57
|
"classnames": "^2.3.1",
|
|
56
58
|
"downloadjs": "^1.4.7",
|
|
57
59
|
"history": "^5.1.0",
|
|
@@ -59,8 +61,12 @@
|
|
|
59
61
|
"react-autosize-textarea": "^7.1.0",
|
|
60
62
|
"rememo": "^3.0.0"
|
|
61
63
|
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"react": "^17.0.0",
|
|
66
|
+
"react-dom": "^17.0.0"
|
|
67
|
+
},
|
|
62
68
|
"publishConfig": {
|
|
63
69
|
"access": "public"
|
|
64
70
|
},
|
|
65
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "c5108185851b824d531bce55991a3589947e8551"
|
|
66
72
|
}
|
|
@@ -35,11 +35,17 @@ export default function NewTemplatePart( { postType } ) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
try {
|
|
38
|
+
// Currently template parts only allow latin chars.
|
|
39
|
+
// Fallback slug will receive suffix by default.
|
|
40
|
+
const cleanSlug =
|
|
41
|
+
kebabCase( title ).replace( /[^\w-]+/g, '' ) ||
|
|
42
|
+
'wp-custom-part';
|
|
43
|
+
|
|
38
44
|
const templatePart = await saveEntityRecord(
|
|
39
45
|
'postType',
|
|
40
46
|
'wp_template_part',
|
|
41
47
|
{
|
|
42
|
-
slug:
|
|
48
|
+
slug: cleanSlug,
|
|
43
49
|
title,
|
|
44
50
|
content: '',
|
|
45
51
|
area,
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { SlotFillProvider } from '@wordpress/components';
|
|
5
5
|
import { UnsavedChangesWarning } from '@wordpress/editor';
|
|
6
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
+
import { PluginArea } from '@wordpress/plugins';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Internal dependencies
|
|
@@ -14,6 +18,20 @@ import NavigationSidebar from '../navigation-sidebar';
|
|
|
14
18
|
import getIsListPage from '../../utils/get-is-list-page';
|
|
15
19
|
|
|
16
20
|
export default function EditSiteApp( { reboot } ) {
|
|
21
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
22
|
+
|
|
23
|
+
function onPluginAreaError( name ) {
|
|
24
|
+
createErrorNotice(
|
|
25
|
+
sprintf(
|
|
26
|
+
/* translators: %s: plugin name */
|
|
27
|
+
__(
|
|
28
|
+
'The "%s" plugin has encountered an error and cannot be rendered.'
|
|
29
|
+
),
|
|
30
|
+
name
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
return (
|
|
18
36
|
<SlotFillProvider>
|
|
19
37
|
<UnsavedChangesWarning />
|
|
@@ -29,6 +47,7 @@ export default function EditSiteApp( { reboot } ) {
|
|
|
29
47
|
) : (
|
|
30
48
|
<Editor onError={ reboot } />
|
|
31
49
|
) }
|
|
50
|
+
<PluginArea onError={ onPluginAreaError } />
|
|
32
51
|
{ /* Keep the instance of the sidebar to ensure focus will not be lost
|
|
33
52
|
* when navigating to other pages. */ }
|
|
34
53
|
<NavigationSidebar
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { filter } from 'lodash';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
@@ -25,7 +30,8 @@ function useGlobalStylesRenderer() {
|
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
const currentStoreSettings = getSettings();
|
|
28
|
-
const nonGlobalStyles =
|
|
33
|
+
const nonGlobalStyles = filter(
|
|
34
|
+
currentStoreSettings.styles,
|
|
29
35
|
( style ) => ! style.isGlobalStyles
|
|
30
36
|
);
|
|
31
37
|
updateSettings( {
|
|
@@ -16,13 +16,11 @@ import {
|
|
|
16
16
|
EditorSnackbars,
|
|
17
17
|
EntitiesSavedStates,
|
|
18
18
|
} from '@wordpress/editor';
|
|
19
|
-
import { __
|
|
20
|
-
import { PluginArea } from '@wordpress/plugins';
|
|
19
|
+
import { __ } from '@wordpress/i18n';
|
|
21
20
|
import {
|
|
22
21
|
ShortcutProvider,
|
|
23
22
|
store as keyboardShortcutsStore,
|
|
24
23
|
} from '@wordpress/keyboard-shortcuts';
|
|
25
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* Internal dependencies
|
|
@@ -111,7 +109,6 @@ function Editor( { onError } ) {
|
|
|
111
109
|
}, [] );
|
|
112
110
|
const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
|
|
113
111
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
114
|
-
const { createErrorNotice } = useDispatch( noticesStore );
|
|
115
112
|
|
|
116
113
|
const [
|
|
117
114
|
isEntitiesSavedStatesOpen,
|
|
@@ -167,7 +164,7 @@ function Editor( { onError } ) {
|
|
|
167
164
|
[ enableComplementaryArea ]
|
|
168
165
|
);
|
|
169
166
|
|
|
170
|
-
// Don't render the Editor until the settings are set and loaded
|
|
167
|
+
// Don't render the Editor until the settings are set and loaded.
|
|
171
168
|
const isReady =
|
|
172
169
|
settings?.siteUrl &&
|
|
173
170
|
templateType !== undefined &&
|
|
@@ -183,18 +180,6 @@ function Editor( { onError } ) {
|
|
|
183
180
|
return null;
|
|
184
181
|
};
|
|
185
182
|
|
|
186
|
-
function onPluginAreaError( name ) {
|
|
187
|
-
createErrorNotice(
|
|
188
|
-
sprintf(
|
|
189
|
-
/* translators: %s: plugin name */
|
|
190
|
-
__(
|
|
191
|
-
'The "%s" plugin has encountered an error and cannot be rendered.'
|
|
192
|
-
),
|
|
193
|
-
name
|
|
194
|
-
)
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
183
|
// Only announce the title once the editor is ready to prevent "Replace"
|
|
199
184
|
// action in <URlQueryController> from double-announcing.
|
|
200
185
|
useTitle( isReady && __( 'Editor (beta)' ) );
|
|
@@ -314,9 +299,6 @@ function Editor( { onError } ) {
|
|
|
314
299
|
/>
|
|
315
300
|
<WelcomeGuide />
|
|
316
301
|
<Popover.Slot />
|
|
317
|
-
<PluginArea
|
|
318
|
-
onError={ onPluginAreaError }
|
|
319
|
-
/>
|
|
320
302
|
</ErrorBoundary>
|
|
321
303
|
</BlockContextProvider>
|
|
322
304
|
</GlobalStylesProvider>
|
|
@@ -3,18 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component } from '@wordpress/element';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { Button } from '@wordpress/components';
|
|
7
|
-
import { Warning } from '@wordpress/block-editor';
|
|
8
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{ children }
|
|
15
|
-
</Button>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import ErrorBoundaryWarning from './warning';
|
|
18
11
|
|
|
19
12
|
export default class ErrorBoundary extends Component {
|
|
20
13
|
constructor() {
|
|
@@ -42,23 +35,13 @@ export default class ErrorBoundary extends Component {
|
|
|
42
35
|
}
|
|
43
36
|
|
|
44
37
|
return (
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
>
|
|
53
|
-
{ __( 'Attempt Recovery' ) }
|
|
54
|
-
</Button>,
|
|
55
|
-
<CopyButton key="copy-error" text={ error.stack }>
|
|
56
|
-
{ __( 'Copy Error' ) }
|
|
57
|
-
</CopyButton>,
|
|
58
|
-
] }
|
|
59
|
-
>
|
|
60
|
-
{ __( 'The editor has encountered an unexpected error.' ) }
|
|
61
|
-
</Warning>
|
|
38
|
+
<ErrorBoundaryWarning
|
|
39
|
+
message={ __(
|
|
40
|
+
'The editor has encountered an unexpected error.'
|
|
41
|
+
) }
|
|
42
|
+
error={ error }
|
|
43
|
+
reboot={ this.reboot }
|
|
44
|
+
/>
|
|
62
45
|
);
|
|
63
46
|
}
|
|
64
47
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { Button } from '@wordpress/components';
|
|
6
|
+
import { Warning } from '@wordpress/block-editor';
|
|
7
|
+
import { useCopyToClipboard } from '@wordpress/compose';
|
|
8
|
+
|
|
9
|
+
function CopyButton( { text, children } ) {
|
|
10
|
+
const ref = useCopyToClipboard( text );
|
|
11
|
+
return (
|
|
12
|
+
<Button variant="secondary" ref={ ref }>
|
|
13
|
+
{ children }
|
|
14
|
+
</Button>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function ErrorBoundaryWarning( {
|
|
19
|
+
message,
|
|
20
|
+
error,
|
|
21
|
+
reboot,
|
|
22
|
+
dashboardLink,
|
|
23
|
+
} ) {
|
|
24
|
+
const actions = [];
|
|
25
|
+
|
|
26
|
+
if ( reboot ) {
|
|
27
|
+
actions.push(
|
|
28
|
+
<Button key="recovery" onClick={ reboot } variant="secondary">
|
|
29
|
+
{ __( 'Attempt Recovery' ) }
|
|
30
|
+
</Button>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if ( error ) {
|
|
35
|
+
actions.push(
|
|
36
|
+
<CopyButton key="copy-error" text={ error.stack }>
|
|
37
|
+
{ __( 'Copy Error' ) }
|
|
38
|
+
</CopyButton>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if ( dashboardLink ) {
|
|
43
|
+
actions.push(
|
|
44
|
+
<Button
|
|
45
|
+
key="back-to-dashboard"
|
|
46
|
+
variant="secondary"
|
|
47
|
+
href={ dashboardLink }
|
|
48
|
+
>
|
|
49
|
+
{ __( 'Back to dashboard' ) }
|
|
50
|
+
</Button>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Warning className="editor-error-boundary" actions={ actions }>
|
|
56
|
+
{ message }
|
|
57
|
+
</Warning>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
__experimentalNavigatorButton as NavigatorButton,
|
|
6
|
+
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
6
7
|
__experimentalItem as Item,
|
|
7
8
|
FlexItem,
|
|
8
9
|
__experimentalHStack as HStack,
|
|
@@ -25,32 +26,12 @@ function GenericNavigationButton( { icon, children, ...props } ) {
|
|
|
25
26
|
);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
function NavigationButton(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const dataAttrName = 'data-navigator-focusable-id';
|
|
32
|
-
const dataAttrValue = path;
|
|
33
|
-
|
|
34
|
-
const dataAttrCssSelector = `[${ dataAttrName }="${ dataAttrValue }"]`;
|
|
35
|
-
|
|
36
|
-
const buttonProps = {
|
|
37
|
-
...props,
|
|
38
|
-
[ dataAttrName ]: dataAttrValue,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<GenericNavigationButton
|
|
43
|
-
onClick={ () =>
|
|
44
|
-
goTo( path, { focusTargetSelector: dataAttrCssSelector } )
|
|
45
|
-
}
|
|
46
|
-
{ ...buttonProps }
|
|
47
|
-
/>
|
|
48
|
-
);
|
|
29
|
+
function NavigationButton( props ) {
|
|
30
|
+
return <NavigatorButton as={ GenericNavigationButton } { ...props } />;
|
|
49
31
|
}
|
|
50
32
|
|
|
51
|
-
function NavigationBackButton(
|
|
52
|
-
|
|
53
|
-
return <GenericNavigationButton onClick={ goBack } { ...props } />;
|
|
33
|
+
function NavigationBackButton( props ) {
|
|
34
|
+
return <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;
|
|
54
35
|
}
|
|
55
36
|
|
|
56
37
|
export { NavigationButton, NavigationBackButton };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
5
6
|
import { __ } from '@wordpress/i18n';
|
|
6
7
|
import {
|
|
7
8
|
FlexItem,
|
|
@@ -19,6 +20,29 @@ import { useHasTypographyPanel } from './typography-panel';
|
|
|
19
20
|
import ScreenHeader from './header';
|
|
20
21
|
import { NavigationButton } from './navigation-button';
|
|
21
22
|
|
|
23
|
+
function useSortedBlockTypes() {
|
|
24
|
+
const blockItems = useSelect(
|
|
25
|
+
( select ) => select( blocksStore ).getBlockTypes(),
|
|
26
|
+
[]
|
|
27
|
+
);
|
|
28
|
+
// Ensure core blocks are prioritized in the returned results,
|
|
29
|
+
// because third party blocks can be registered earlier than
|
|
30
|
+
// the core blocks (usually by using the `init` action),
|
|
31
|
+
// thus affecting the display order.
|
|
32
|
+
// We don't sort reusable blocks as they are handled differently.
|
|
33
|
+
const groupByType = ( blocks, block ) => {
|
|
34
|
+
const { core, noncore } = blocks;
|
|
35
|
+
const type = block.name.startsWith( 'core/' ) ? core : noncore;
|
|
36
|
+
type.push( block );
|
|
37
|
+
return blocks;
|
|
38
|
+
};
|
|
39
|
+
const {
|
|
40
|
+
core: coreItems,
|
|
41
|
+
noncore: nonCoreItems,
|
|
42
|
+
} = blockItems.reduce( groupByType, { core: [], noncore: [] } );
|
|
43
|
+
return [ ...coreItems, ...nonCoreItems ];
|
|
44
|
+
}
|
|
45
|
+
|
|
22
46
|
function BlockMenuItem( { block } ) {
|
|
23
47
|
const hasTypographyPanel = useHasTypographyPanel( block.name );
|
|
24
48
|
const hasColorPanel = useHasColorPanel( block.name );
|
|
@@ -45,6 +69,7 @@ function BlockMenuItem( { block } ) {
|
|
|
45
69
|
}
|
|
46
70
|
|
|
47
71
|
function ScreenBlockList() {
|
|
72
|
+
const sortedBlockTypes = useSortedBlockTypes();
|
|
48
73
|
return (
|
|
49
74
|
<>
|
|
50
75
|
<ScreenHeader
|
|
@@ -53,7 +78,7 @@ function ScreenBlockList() {
|
|
|
53
78
|
'Customize the appearance of specific blocks and for the whole site.'
|
|
54
79
|
) }
|
|
55
80
|
/>
|
|
56
|
-
{
|
|
81
|
+
{ sortedBlockTypes.map( ( block ) => (
|
|
57
82
|
<BlockMenuItem
|
|
58
83
|
block={ block }
|
|
59
84
|
key={ 'menu-itemblock-' + block.name }
|
|
@@ -99,8 +99,7 @@ function ScreenTypography( { name } ) {
|
|
|
99
99
|
</VStack>
|
|
100
100
|
</div>
|
|
101
101
|
) }
|
|
102
|
-
|
|
103
|
-
{ /* no typography elements support yet for blocks */ }
|
|
102
|
+
{ /* No typography elements support yet for blocks. */ }
|
|
104
103
|
{ !! name && <TypographyPanel name={ name } element="text" /> }
|
|
105
104
|
</>
|
|
106
105
|
);
|
|
@@ -7,7 +7,11 @@ import {
|
|
|
7
7
|
__experimentalFontAppearanceControl as FontAppearanceControl,
|
|
8
8
|
__experimentalLetterSpacingControl as LetterSpacingControl,
|
|
9
9
|
} from '@wordpress/block-editor';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
PanelBody,
|
|
12
|
+
FontSizePicker,
|
|
13
|
+
__experimentalSpacer as Spacer,
|
|
14
|
+
} from '@wordpress/components';
|
|
11
15
|
|
|
12
16
|
/**
|
|
13
17
|
* Internal dependencies
|
|
@@ -143,10 +147,13 @@ export default function TypographyPanel( { name, element } ) {
|
|
|
143
147
|
/>
|
|
144
148
|
) }
|
|
145
149
|
{ hasLineHeightEnabled && (
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
<Spacer marginBottom={ 6 }>
|
|
151
|
+
<LineHeightControl
|
|
152
|
+
__nextHasNoMarginBottom={ true }
|
|
153
|
+
value={ lineHeight }
|
|
154
|
+
onChange={ setLineHeight }
|
|
155
|
+
/>
|
|
156
|
+
</Spacer>
|
|
150
157
|
) }
|
|
151
158
|
{ hasAppearanceControl && (
|
|
152
159
|
<FontAppearanceControl
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
getBlockTypes,
|
|
24
24
|
} from '@wordpress/blocks';
|
|
25
25
|
import { useEffect, useState, useContext } from '@wordpress/element';
|
|
26
|
+
import { getCSSRules } from '@wordpress/style-engine';
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Internal dependencies
|
|
@@ -146,11 +147,11 @@ function flattenTree( input = {}, prefix, token ) {
|
|
|
146
147
|
* @return {Array} An array of style declarations.
|
|
147
148
|
*/
|
|
148
149
|
function getStylesDeclarations( blockStyles = {} ) {
|
|
149
|
-
|
|
150
|
+
const output = reduce(
|
|
150
151
|
STYLE_PROPERTY,
|
|
151
|
-
( declarations, { value, properties }, key ) => {
|
|
152
|
+
( declarations, { value, properties, useEngine }, key ) => {
|
|
152
153
|
const pathToValue = value;
|
|
153
|
-
if ( first( pathToValue ) === 'elements' ) {
|
|
154
|
+
if ( first( pathToValue ) === 'elements' || useEngine ) {
|
|
154
155
|
return declarations;
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -188,6 +189,21 @@ function getStylesDeclarations( blockStyles = {} ) {
|
|
|
188
189
|
},
|
|
189
190
|
[]
|
|
190
191
|
);
|
|
192
|
+
|
|
193
|
+
// The goal is to move everything to server side generated engine styles
|
|
194
|
+
// This is temporary as we absorb more and more styles into the engine.
|
|
195
|
+
const extraRules = getCSSRules( blockStyles, { selector: 'self' } );
|
|
196
|
+
extraRules.forEach( ( rule ) => {
|
|
197
|
+
if ( rule.selector !== 'self' ) {
|
|
198
|
+
throw "This style can't be added as inline style";
|
|
199
|
+
}
|
|
200
|
+
const cssProperty = rule.key.startsWith( '--' )
|
|
201
|
+
? rule.key
|
|
202
|
+
: kebabCase( rule.key );
|
|
203
|
+
output.push( `${ cssProperty }: ${ compileStyleValue( rule.value ) }` );
|
|
204
|
+
} );
|
|
205
|
+
|
|
206
|
+
return output;
|
|
191
207
|
}
|
|
192
208
|
|
|
193
209
|
export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { get, find, isString } from 'lodash';
|
|
5
5
|
|
|
6
|
-
/* Supporting data */
|
|
6
|
+
/* Supporting data. */
|
|
7
7
|
export const ROOT_BLOCK_NAME = 'root';
|
|
8
8
|
export const ROOT_BLOCK_SELECTOR = 'body';
|
|
9
9
|
export const ROOT_BLOCK_SUPPORTS = [
|
|
@@ -103,7 +103,7 @@ function findInPresetsBy(
|
|
|
103
103
|
if ( presetProperty === 'slug' ) {
|
|
104
104
|
return presetObject;
|
|
105
105
|
}
|
|
106
|
-
//
|
|
106
|
+
// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
|
|
107
107
|
const highestPresetObjectWithSameSlug = findInPresetsBy(
|
|
108
108
|
features,
|
|
109
109
|
blockName,
|
|
@@ -91,7 +91,7 @@ export default function Header( {
|
|
|
91
91
|
|
|
92
92
|
const openInserter = useCallback( () => {
|
|
93
93
|
if ( isInserterOpen ) {
|
|
94
|
-
// Focusing the inserter button closes the inserter popover
|
|
94
|
+
// Focusing the inserter button closes the inserter popover.
|
|
95
95
|
inserterButton.current.focus();
|
|
96
96
|
} else {
|
|
97
97
|
setIsInserterOpened( true );
|
|
@@ -5,34 +5,21 @@ import { __, _x } from '@wordpress/i18n';
|
|
|
5
5
|
import { useReducer } from '@wordpress/element';
|
|
6
6
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
7
7
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
8
|
-
import { external
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
MenuItem,
|
|
13
|
-
VisuallyHidden,
|
|
14
|
-
} from '@wordpress/components';
|
|
15
|
-
import { ActionItem } from '@wordpress/interface';
|
|
8
|
+
import { external } from '@wordpress/icons';
|
|
9
|
+
import { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
10
|
+
import { ActionItem, MoreMenuDropdown } from '@wordpress/interface';
|
|
11
|
+
import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Internal dependencies
|
|
19
15
|
*/
|
|
20
16
|
import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
|
|
21
|
-
import FeatureToggle from '../feature-toggle';
|
|
22
17
|
import ToolsMoreMenuGroup from '../tools-more-menu-group';
|
|
23
18
|
import SiteExport from './site-export';
|
|
24
19
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
25
20
|
import CopyContentMenuItem from './copy-content-menu-item';
|
|
26
21
|
import ModeSwitcher from '../mode-switcher';
|
|
27
22
|
|
|
28
|
-
const POPOVER_PROPS = {
|
|
29
|
-
className: 'edit-site-more-menu__content',
|
|
30
|
-
position: 'bottom left',
|
|
31
|
-
};
|
|
32
|
-
const TOGGLE_PROPS = {
|
|
33
|
-
tooltipPosition: 'bottom',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
23
|
export default function MoreMenu() {
|
|
37
24
|
const [ isModalActive, toggleModal ] = useReducer(
|
|
38
25
|
( isActive ) => ! isActive,
|
|
@@ -43,18 +30,13 @@ export default function MoreMenu() {
|
|
|
43
30
|
|
|
44
31
|
return (
|
|
45
32
|
<>
|
|
46
|
-
<
|
|
47
|
-
className="edit-site-more-menu"
|
|
48
|
-
icon={ moreVertical }
|
|
49
|
-
label={ __( 'More tools & options' ) }
|
|
50
|
-
popoverProps={ POPOVER_PROPS }
|
|
51
|
-
toggleProps={ TOGGLE_PROPS }
|
|
52
|
-
>
|
|
33
|
+
<MoreMenuDropdown>
|
|
53
34
|
{ ( { onClose } ) => (
|
|
54
35
|
<>
|
|
55
36
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
56
|
-
<
|
|
57
|
-
|
|
37
|
+
<PreferenceToggleMenuItem
|
|
38
|
+
scope="core/edit-site"
|
|
39
|
+
name="fixedToolbar"
|
|
58
40
|
label={ __( 'Top toolbar' ) }
|
|
59
41
|
info={ __(
|
|
60
42
|
'Access all block and document tools in a single place'
|
|
@@ -66,8 +48,9 @@ export default function MoreMenu() {
|
|
|
66
48
|
'Top toolbar deactivated'
|
|
67
49
|
) }
|
|
68
50
|
/>
|
|
69
|
-
<
|
|
70
|
-
|
|
51
|
+
<PreferenceToggleMenuItem
|
|
52
|
+
scope="core/edit-site"
|
|
53
|
+
name="focusMode"
|
|
71
54
|
label={ __( 'Spotlight mode' ) }
|
|
72
55
|
info={ __( 'Focus on one block at a time' ) }
|
|
73
56
|
messageActivated={ __(
|
|
@@ -118,7 +101,7 @@ export default function MoreMenu() {
|
|
|
118
101
|
</MenuGroup>
|
|
119
102
|
</>
|
|
120
103
|
) }
|
|
121
|
-
</
|
|
104
|
+
</MoreMenuDropdown>
|
|
122
105
|
<KeyboardShortcutHelpModal
|
|
123
106
|
isModalActive={ isModalActive }
|
|
124
107
|
toggleModal={ toggleModal }
|
|
@@ -44,7 +44,7 @@ export default function SiteExport() {
|
|
|
44
44
|
role="menuitem"
|
|
45
45
|
icon={ download }
|
|
46
46
|
onClick={ handleExport }
|
|
47
|
-
info={ __( 'Download your templates and
|
|
47
|
+
info={ __( 'Download your templates and styles as a theme.' ) }
|
|
48
48
|
>
|
|
49
49
|
{ _x( 'Export', 'site exporter menu item' ) }
|
|
50
50
|
</MenuItem>
|
|
@@ -4,17 +4,13 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { useDispatch } from '@wordpress/data';
|
|
6
6
|
import { MenuItem } from '@wordpress/components';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editSiteStore } from '../../../store';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
8
|
|
|
13
9
|
export default function WelcomeGuideMenuItem() {
|
|
14
|
-
const {
|
|
10
|
+
const { toggle } = useDispatch( preferencesStore );
|
|
15
11
|
|
|
16
12
|
return (
|
|
17
|
-
<MenuItem onClick={ () =>
|
|
13
|
+
<MenuItem onClick={ () => toggle( 'core/edit-site', 'welcomeGuide' ) }>
|
|
18
14
|
{ __( 'Welcome Guide' ) }
|
|
19
15
|
</MenuItem>
|
|
20
16
|
);
|