@wordpress/edit-site 5.12.6 → 5.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +10 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +8 -4
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +84 -60
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +21 -13
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +67 -27
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +99 -126
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/index.js +1 -0
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +1 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +2 -35
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +68 -43
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-hub/index.js +2 -2
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/template-actions/index.js +25 -7
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +9 -6
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/welcome-guide/page.js +2 -2
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +2 -2
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +1 -2
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +7 -4
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +85 -66
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +22 -15
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/page-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +70 -31
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +100 -127
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +1 -0
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -33
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +71 -44
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-hub/index.js +2 -2
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/template-actions/index.js +26 -8
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +8 -6
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -2
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +2 -2
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +1 -2
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +149 -50
- package/build-style/style.css +149 -50
- package/package.json +19 -19
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/use-site-editor-settings.js +8 -4
- package/src/components/create-pattern-modal/index.js +6 -3
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/header-edit-mode/document-actions/style.scss +12 -0
- package/src/components/header-edit-mode/index.js +17 -9
- package/src/components/layout/index.js +1 -1
- package/src/components/layout/style.scss +0 -11
- package/src/components/page/header.js +1 -1
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +187 -132
- package/src/components/page-patterns/grid.js +35 -22
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/patterns-list.js +89 -47
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +86 -26
- package/src/components/page-patterns/use-patterns.js +99 -176
- package/src/components/page-template-parts/index.js +1 -1
- package/src/components/page-templates/index.js +1 -1
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +19 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +56 -39
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
- package/src/components/sidebar-navigation-screen-page/status-label.js +2 -36
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +3 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +79 -75
- package/src/components/sidebar-navigation-screen-patterns/style.scss +23 -1
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/site-hub/index.js +2 -2
- package/src/components/template-actions/index.js +40 -9
- package/src/components/template-actions/rename-menu-item.js +8 -6
- package/src/components/welcome-guide/page.js +2 -2
- package/src/components/welcome-guide/template.js +2 -2
- package/src/hooks/commands/use-edit-mode-commands.js +0 -1
- package/src/hooks/push-changes-to-global-styles/index.js +8 -1
- package/src/store/private-actions.js +5 -1
- package/src/style.scss +10 -12
- package/src/utils/use-activate-theme.js +1 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/src/components/page-content-focus-manager/constants.js +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.8",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,40 +29,40 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.35.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
34
|
-
"@wordpress/blocks": "^12.12.
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
36
|
-
"@wordpress/components": "^25.1.
|
|
32
|
+
"@wordpress/block-editor": "^12.3.6",
|
|
33
|
+
"@wordpress/block-library": "^8.12.8",
|
|
34
|
+
"@wordpress/blocks": "^12.12.3",
|
|
35
|
+
"@wordpress/commands": "^0.6.6",
|
|
36
|
+
"@wordpress/components": "^25.1.6",
|
|
37
37
|
"@wordpress/compose": "^6.12.1",
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
40
|
-
"@wordpress/data": "^9.5.
|
|
38
|
+
"@wordpress/core-commands": "^0.4.6",
|
|
39
|
+
"@wordpress/core-data": "^6.12.6",
|
|
40
|
+
"@wordpress/data": "^9.5.3",
|
|
41
41
|
"@wordpress/date": "^4.35.1",
|
|
42
42
|
"@wordpress/deprecated": "^3.35.1",
|
|
43
43
|
"@wordpress/dom": "^3.35.1",
|
|
44
|
-
"@wordpress/editor": "^13.12.
|
|
44
|
+
"@wordpress/editor": "^13.12.6",
|
|
45
45
|
"@wordpress/element": "^5.12.1",
|
|
46
46
|
"@wordpress/escape-html": "^2.35.1",
|
|
47
47
|
"@wordpress/hooks": "^3.35.1",
|
|
48
48
|
"@wordpress/html-entities": "^3.35.1",
|
|
49
49
|
"@wordpress/i18n": "^4.35.1",
|
|
50
50
|
"@wordpress/icons": "^9.26.2",
|
|
51
|
-
"@wordpress/interface": "^5.12.
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^4.12.
|
|
51
|
+
"@wordpress/interface": "^5.12.6",
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^4.12.3",
|
|
53
53
|
"@wordpress/keycodes": "^3.35.1",
|
|
54
54
|
"@wordpress/media-utils": "^4.26.1",
|
|
55
|
-
"@wordpress/notices": "^4.3.
|
|
56
|
-
"@wordpress/plugins": "^6.3.
|
|
57
|
-
"@wordpress/preferences": "^3.12.
|
|
55
|
+
"@wordpress/notices": "^4.3.3",
|
|
56
|
+
"@wordpress/plugins": "^6.3.6",
|
|
57
|
+
"@wordpress/preferences": "^3.12.6",
|
|
58
58
|
"@wordpress/primitives": "^3.33.1",
|
|
59
59
|
"@wordpress/private-apis": "^0.17.1",
|
|
60
|
-
"@wordpress/reusable-blocks": "^4.12.
|
|
60
|
+
"@wordpress/reusable-blocks": "^4.12.6",
|
|
61
61
|
"@wordpress/router": "^0.4.1",
|
|
62
62
|
"@wordpress/style-engine": "^1.18.1",
|
|
63
63
|
"@wordpress/url": "^3.36.1",
|
|
64
|
-
"@wordpress/viewport": "^5.12.
|
|
65
|
-
"@wordpress/widgets": "^3.12.
|
|
64
|
+
"@wordpress/viewport": "^5.12.3",
|
|
65
|
+
"@wordpress/widgets": "^3.12.6",
|
|
66
66
|
"@wordpress/wordcount": "^3.35.1",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"classnames": "^2.3.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "86ecd96b3bcada6b4cc35bb2455b3029cebb0ff3"
|
|
88
88
|
}
|
|
@@ -88,7 +88,7 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
|
|
|
88
88
|
enableResizing ? 'min-height:0!important;' : ''
|
|
89
89
|
}}body{position:relative; ${
|
|
90
90
|
canvasMode === 'view'
|
|
91
|
-
? 'cursor: pointer; height: 100vh'
|
|
91
|
+
? 'cursor: pointer; min-height: 100vh;'
|
|
92
92
|
: ''
|
|
93
93
|
}}}`
|
|
94
94
|
}</style>
|
|
@@ -12,11 +12,13 @@ import { unlock } from '../../lock-unlock';
|
|
|
12
12
|
import inserterMediaCategories from './inserter-media-categories';
|
|
13
13
|
|
|
14
14
|
export default function useSiteEditorSettings( templateType ) {
|
|
15
|
-
const { storedSettings } = useSelect( ( select ) => {
|
|
16
|
-
const { getSettings } = unlock(
|
|
17
|
-
|
|
15
|
+
const { storedSettings, canvasMode } = useSelect( ( select ) => {
|
|
16
|
+
const { getSettings, getCanvasMode } = unlock(
|
|
17
|
+
select( editSiteStore )
|
|
18
|
+
);
|
|
18
19
|
return {
|
|
19
20
|
storedSettings: getSettings(),
|
|
21
|
+
canvasMode: getCanvasMode(),
|
|
20
22
|
};
|
|
21
23
|
}, [] );
|
|
22
24
|
|
|
@@ -70,6 +72,7 @@ export default function useSiteEditorSettings( templateType ) {
|
|
|
70
72
|
const {
|
|
71
73
|
__experimentalAdditionalBlockPatterns,
|
|
72
74
|
__experimentalAdditionalBlockPatternCategories,
|
|
75
|
+
focusMode,
|
|
73
76
|
...restStoredSettings
|
|
74
77
|
} = storedSettings;
|
|
75
78
|
|
|
@@ -86,6 +89,7 @@ export default function useSiteEditorSettings( templateType ) {
|
|
|
86
89
|
// active for all entities.
|
|
87
90
|
templateLock: false,
|
|
88
91
|
template: false,
|
|
92
|
+
focusMode: canvasMode === 'view' && focusMode ? false : focusMode,
|
|
89
93
|
};
|
|
90
|
-
}, [ storedSettings, blockPatterns, blockPatternCategories ] );
|
|
94
|
+
}, [ storedSettings, blockPatterns, blockPatternCategories, canvasMode ] );
|
|
91
95
|
}
|
|
@@ -14,6 +14,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
14
14
|
import { useState } from '@wordpress/element';
|
|
15
15
|
import { store as noticesStore } from '@wordpress/notices';
|
|
16
16
|
import { useDispatch } from '@wordpress/data';
|
|
17
|
+
import { serialize } from '@wordpress/blocks';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -21,9 +22,11 @@ import { useDispatch } from '@wordpress/data';
|
|
|
21
22
|
import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-patterns/utils';
|
|
22
23
|
|
|
23
24
|
export default function CreatePatternModal( {
|
|
25
|
+
blocks = [],
|
|
24
26
|
closeModal,
|
|
25
27
|
onCreate,
|
|
26
28
|
onError,
|
|
29
|
+
title,
|
|
27
30
|
} ) {
|
|
28
31
|
const [ name, setName ] = useState( '' );
|
|
29
32
|
const [ syncType, setSyncType ] = useState( SYNC_TYPES.unsynced );
|
|
@@ -52,11 +55,11 @@ export default function CreatePatternModal( {
|
|
|
52
55
|
'wp_block',
|
|
53
56
|
{
|
|
54
57
|
title: name || __( 'Untitled Pattern' ),
|
|
55
|
-
content: '',
|
|
58
|
+
content: blocks?.length ? serialize( blocks ) : '',
|
|
56
59
|
status: 'publish',
|
|
57
60
|
meta:
|
|
58
61
|
syncType === SYNC_TYPES.unsynced
|
|
59
|
-
? {
|
|
62
|
+
? { wp_pattern_sync_status: syncType }
|
|
60
63
|
: undefined,
|
|
61
64
|
},
|
|
62
65
|
{ throwOnError: true }
|
|
@@ -76,7 +79,7 @@ export default function CreatePatternModal( {
|
|
|
76
79
|
|
|
77
80
|
return (
|
|
78
81
|
<Modal
|
|
79
|
-
title={ __( 'Create pattern' ) }
|
|
82
|
+
title={ title || __( 'Create pattern' ) }
|
|
80
83
|
onRequestClose={ closeModal }
|
|
81
84
|
overlayClassName="edit-site-create-pattern-modal"
|
|
82
85
|
>
|
|
@@ -91,15 +91,16 @@ function Palette( { name } ) {
|
|
|
91
91
|
</HStack>
|
|
92
92
|
</NavigationButtonAsItem>
|
|
93
93
|
</ItemGroup>
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
{ window.__experimentalEnableColorRandomizer &&
|
|
95
|
+
themeColors?.length > 0 && (
|
|
96
|
+
<Button
|
|
97
|
+
variant="secondary"
|
|
98
|
+
icon={ shuffle }
|
|
99
|
+
onClick={ randomizeThemeColors }
|
|
100
|
+
>
|
|
101
|
+
{ __( 'Randomize colors' ) }
|
|
102
|
+
</Button>
|
|
103
|
+
) }
|
|
103
104
|
</VStack>
|
|
104
105
|
);
|
|
105
106
|
}
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
color: currentColor;
|
|
17
17
|
background: $gray-200;
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
@include break-medium() {
|
|
21
|
+
width: 50%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include break-large() {
|
|
25
|
+
width: min(100%, 450px);
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
.edit-site-document-actions__command {
|
|
@@ -32,6 +40,10 @@
|
|
|
32
40
|
overflow: hidden;
|
|
33
41
|
grid-column: 2 / 3;
|
|
34
42
|
|
|
43
|
+
.block-editor-block-icon {
|
|
44
|
+
min-width: $grid-unit-30;
|
|
45
|
+
}
|
|
46
|
+
|
|
35
47
|
h1 {
|
|
36
48
|
white-space: nowrap;
|
|
37
49
|
overflow: hidden;
|
|
@@ -108,6 +108,9 @@ export default function HeaderEditMode() {
|
|
|
108
108
|
};
|
|
109
109
|
}, [] );
|
|
110
110
|
|
|
111
|
+
const { get: getPreference } = useSelect( preferencesStore );
|
|
112
|
+
const hasFixedToolbar = getPreference( editSiteStore.name, 'fixedToolbar' );
|
|
113
|
+
|
|
111
114
|
const {
|
|
112
115
|
__experimentalSetPreviewDeviceType: setPreviewDeviceType,
|
|
113
116
|
setIsInserterOpened,
|
|
@@ -213,14 +216,18 @@ export default function HeaderEditMode() {
|
|
|
213
216
|
) }
|
|
214
217
|
{ isLargeViewport && (
|
|
215
218
|
<>
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
{ ! hasFixedToolbar && (
|
|
220
|
+
<ToolbarItem
|
|
221
|
+
as={ ToolSelector }
|
|
222
|
+
showTooltip={ ! showIconLabels }
|
|
223
|
+
variant={
|
|
224
|
+
showIconLabels
|
|
225
|
+
? 'tertiary'
|
|
226
|
+
: undefined
|
|
227
|
+
}
|
|
228
|
+
disabled={ ! isVisualMode }
|
|
229
|
+
/>
|
|
230
|
+
) }
|
|
224
231
|
<ToolbarItem
|
|
225
232
|
as={ UndoButton }
|
|
226
233
|
showTooltip={ ! showIconLabels }
|
|
@@ -257,7 +264,8 @@ export default function HeaderEditMode() {
|
|
|
257
264
|
/>
|
|
258
265
|
) }
|
|
259
266
|
{ isZoomedOutViewExperimentEnabled &&
|
|
260
|
-
! isDistractionFree &&
|
|
267
|
+
! isDistractionFree &&
|
|
268
|
+
! hasFixedToolbar && (
|
|
261
269
|
<ToolbarItem
|
|
262
270
|
as={ Button }
|
|
263
271
|
className="edit-site-header-edit-mode__zoom-out-view-toggle"
|
|
@@ -143,7 +143,7 @@ export default function Layout() {
|
|
|
143
143
|
headerAnimationState = canvasMode; // edit, view, init
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
// Sets the right context for the command
|
|
146
|
+
// Sets the right context for the command palette
|
|
147
147
|
const commandContext =
|
|
148
148
|
canvasMode === 'edit' && isEditorPage
|
|
149
149
|
? 'site-editor-edit'
|
|
@@ -4,17 +4,6 @@
|
|
|
4
4
|
color: $gray-400;
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
7
|
-
|
|
8
|
-
// Expand the fixed block toolbar to cover the document title control.
|
|
9
|
-
.block-editor-block-contextual-toolbar {
|
|
10
|
-
@include break-medium() {
|
|
11
|
-
&.is-fixed {
|
|
12
|
-
// the combined with of the tools at the right of the header and the margin left
|
|
13
|
-
width: calc(100% - 240px - #{$grid-unit-80} - #{$grid-unit-70});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
7
|
}
|
|
19
8
|
|
|
20
9
|
.edit-site-layout__hub {
|
|
@@ -18,7 +18,7 @@ export default function Header( { title, subTitle, actions } ) {
|
|
|
18
18
|
<HStack as="header" alignment="left" className="edit-site-page-header">
|
|
19
19
|
<FlexBlock className="edit-site-page-header__page-title">
|
|
20
20
|
<Heading
|
|
21
|
-
as="
|
|
21
|
+
as="h2"
|
|
22
22
|
level={ 4 }
|
|
23
23
|
className="edit-site-page-header__title"
|
|
24
24
|
>
|
|
@@ -10,16 +10,22 @@ import { useEffect } from '@wordpress/element';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { unlock } from '../../lock-unlock';
|
|
13
|
-
import { PAGE_CONTENT_BLOCK_TYPES } from './constants';
|
|
14
13
|
|
|
15
14
|
const { useBlockEditingMode } = unlock( blockEditorPrivateApis );
|
|
16
15
|
|
|
16
|
+
const PAGE_CONTENT_BLOCK_TYPES = [
|
|
17
|
+
'core/post-title',
|
|
18
|
+
'core/post-featured-image',
|
|
19
|
+
'core/post-content',
|
|
20
|
+
];
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Component that when rendered, makes it so that the site editor allows only
|
|
19
24
|
* page content to be edited.
|
|
20
25
|
*/
|
|
21
26
|
export default function DisableNonPageContentBlocks() {
|
|
22
27
|
useDisableNonPageContentBlocks();
|
|
28
|
+
return null;
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
/**
|
|
@@ -43,8 +49,11 @@ export function useDisableNonPageContentBlocks() {
|
|
|
43
49
|
|
|
44
50
|
const withDisableNonPageContentBlocks = createHigherOrderComponent(
|
|
45
51
|
( BlockEdit ) => ( props ) => {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
52
|
+
const isDescendentOfQueryLoop = !! props.context.queryId;
|
|
53
|
+
const isPageContent =
|
|
54
|
+
PAGE_CONTENT_BLOCK_TYPES.includes( props.name ) &&
|
|
55
|
+
! isDescendentOfQueryLoop;
|
|
56
|
+
const mode = isPageContent ? 'contentOnly' : undefined;
|
|
48
57
|
useBlockEditingMode( mode );
|
|
49
58
|
return <BlockEdit { ...props } />;
|
|
50
59
|
},
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { MenuItem } from '@wordpress/components';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import {
|
|
15
|
+
TEMPLATE_PARTS,
|
|
16
|
+
PATTERNS,
|
|
17
|
+
SYNC_TYPES,
|
|
18
|
+
USER_PATTERNS,
|
|
19
|
+
USER_PATTERN_CATEGORY,
|
|
20
|
+
} from './utils';
|
|
21
|
+
import {
|
|
22
|
+
useExistingTemplateParts,
|
|
23
|
+
getUniqueTemplatePartTitle,
|
|
24
|
+
getCleanTemplatePartSlug,
|
|
25
|
+
} from '../../utils/template-part-create';
|
|
26
|
+
import { unlock } from '../../lock-unlock';
|
|
27
|
+
|
|
28
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
29
|
+
|
|
30
|
+
function getPatternMeta( item ) {
|
|
31
|
+
if ( item.type === PATTERNS ) {
|
|
32
|
+
return { wp_pattern_sync_status: SYNC_TYPES.unsynced };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const syncStatus = item.reusableBlock.wp_pattern_sync_status;
|
|
36
|
+
const isUnsynced = syncStatus === SYNC_TYPES.unsynced;
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
...item.reusableBlock.meta,
|
|
40
|
+
wp_pattern_sync_status: isUnsynced ? syncStatus : undefined,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default function DuplicateMenuItem( {
|
|
45
|
+
categoryId,
|
|
46
|
+
item,
|
|
47
|
+
label = __( 'Duplicate' ),
|
|
48
|
+
onClose,
|
|
49
|
+
} ) {
|
|
50
|
+
const { saveEntityRecord } = useDispatch( coreStore );
|
|
51
|
+
const { createErrorNotice, createSuccessNotice } =
|
|
52
|
+
useDispatch( noticesStore );
|
|
53
|
+
|
|
54
|
+
const history = useHistory();
|
|
55
|
+
const existingTemplateParts = useExistingTemplateParts();
|
|
56
|
+
|
|
57
|
+
async function createTemplatePart() {
|
|
58
|
+
try {
|
|
59
|
+
const copiedTitle = sprintf(
|
|
60
|
+
/* translators: %s: Existing template part title */
|
|
61
|
+
__( '%s (Copy)' ),
|
|
62
|
+
item.title
|
|
63
|
+
);
|
|
64
|
+
const title = getUniqueTemplatePartTitle(
|
|
65
|
+
copiedTitle,
|
|
66
|
+
existingTemplateParts
|
|
67
|
+
);
|
|
68
|
+
const slug = getCleanTemplatePartSlug( title );
|
|
69
|
+
const { area, content } = item.templatePart;
|
|
70
|
+
|
|
71
|
+
const result = await saveEntityRecord(
|
|
72
|
+
'postType',
|
|
73
|
+
'wp_template_part',
|
|
74
|
+
{ slug, title, content, area },
|
|
75
|
+
{ throwOnError: true }
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
createSuccessNotice(
|
|
79
|
+
sprintf(
|
|
80
|
+
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
|
|
81
|
+
__( '"%s" created.' ),
|
|
82
|
+
title
|
|
83
|
+
),
|
|
84
|
+
{
|
|
85
|
+
type: 'snackbar',
|
|
86
|
+
id: 'edit-site-patterns-success',
|
|
87
|
+
actions: [
|
|
88
|
+
{
|
|
89
|
+
label: __( 'Edit' ),
|
|
90
|
+
onClick: () =>
|
|
91
|
+
history.push( {
|
|
92
|
+
postType: TEMPLATE_PARTS,
|
|
93
|
+
postId: result?.id,
|
|
94
|
+
categoryType: TEMPLATE_PARTS,
|
|
95
|
+
categoryId,
|
|
96
|
+
} ),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
onClose();
|
|
103
|
+
} catch ( error ) {
|
|
104
|
+
const errorMessage =
|
|
105
|
+
error.message && error.code !== 'unknown_error'
|
|
106
|
+
? error.message
|
|
107
|
+
: __(
|
|
108
|
+
'An error occurred while creating the template part.'
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
createErrorNotice( errorMessage, {
|
|
112
|
+
type: 'snackbar',
|
|
113
|
+
id: 'edit-site-patterns-error',
|
|
114
|
+
} );
|
|
115
|
+
onClose();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function createPattern() {
|
|
120
|
+
try {
|
|
121
|
+
const isThemePattern = item.type === PATTERNS;
|
|
122
|
+
const title = sprintf(
|
|
123
|
+
/* translators: %s: Existing pattern title */
|
|
124
|
+
__( '%s (Copy)' ),
|
|
125
|
+
item.title
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const result = await saveEntityRecord(
|
|
129
|
+
'postType',
|
|
130
|
+
'wp_block',
|
|
131
|
+
{
|
|
132
|
+
content: isThemePattern
|
|
133
|
+
? item.content
|
|
134
|
+
: item.reusableBlock.content,
|
|
135
|
+
meta: getPatternMeta( item ),
|
|
136
|
+
status: 'publish',
|
|
137
|
+
title,
|
|
138
|
+
},
|
|
139
|
+
{ throwOnError: true }
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const actionLabel = isThemePattern
|
|
143
|
+
? __( 'View my patterns' )
|
|
144
|
+
: __( 'Edit' );
|
|
145
|
+
|
|
146
|
+
const newLocation = isThemePattern
|
|
147
|
+
? {
|
|
148
|
+
categoryType: USER_PATTERNS,
|
|
149
|
+
categoryId: USER_PATTERN_CATEGORY,
|
|
150
|
+
path: '/patterns',
|
|
151
|
+
}
|
|
152
|
+
: {
|
|
153
|
+
categoryType: USER_PATTERNS,
|
|
154
|
+
categoryId: USER_PATTERN_CATEGORY,
|
|
155
|
+
postType: USER_PATTERNS,
|
|
156
|
+
postId: result?.id,
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
createSuccessNotice(
|
|
160
|
+
sprintf(
|
|
161
|
+
// translators: %s: The new pattern's title e.g. 'Call to action (copy)'.
|
|
162
|
+
__( '"%s" added to my patterns.' ),
|
|
163
|
+
title
|
|
164
|
+
),
|
|
165
|
+
{
|
|
166
|
+
type: 'snackbar',
|
|
167
|
+
id: 'edit-site-patterns-success',
|
|
168
|
+
actions: [
|
|
169
|
+
{
|
|
170
|
+
label: actionLabel,
|
|
171
|
+
onClick: () => history.push( newLocation ),
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
onClose();
|
|
178
|
+
} catch ( error ) {
|
|
179
|
+
const errorMessage =
|
|
180
|
+
error.message && error.code !== 'unknown_error'
|
|
181
|
+
? error.message
|
|
182
|
+
: __( 'An error occurred while creating the pattern.' );
|
|
183
|
+
|
|
184
|
+
createErrorNotice( errorMessage, {
|
|
185
|
+
type: 'snackbar',
|
|
186
|
+
id: 'edit-site-patterns-error',
|
|
187
|
+
} );
|
|
188
|
+
onClose();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const createItem =
|
|
193
|
+
item.type === TEMPLATE_PARTS ? createTemplatePart : createPattern;
|
|
194
|
+
|
|
195
|
+
return <MenuItem onClick={ createItem }>{ label }</MenuItem>;
|
|
196
|
+
}
|