@wordpress/edit-site 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-page/index.js +2 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/app/index.js +17 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/index.js +55 -69
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +39 -0
- package/build/components/editor/use-editor-title.js.map +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +4 -23
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +11 -16
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +2 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -0
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +23 -95
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -0
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +5 -5
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/pagination/index.js +17 -8
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build/components/sidebar-dataviews/dataview-item.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-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +38 -128
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +53 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/posts.js +34 -0
- package/build/posts.js.map +1 -0
- package/build/store/private-actions.js +33 -18
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -1
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +55 -69
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +31 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +4 -23
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -16
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +3 -2
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -0
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +27 -99
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -0
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/pagination/index.js +17 -8
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build-module/components/sidebar-dataviews/dataview-item.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-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -130
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +46 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +8 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +27 -0
- package/build-module/posts.js.map +1 -0
- package/build-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +59 -104
- package/build-style/style.css +59 -104
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +2 -1
- package/src/components/app/index.js +17 -1
- package/src/components/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +69 -103
- package/src/components/editor/style.scss +1 -5
- package/src/components/editor/use-editor-title.js +35 -0
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-revisions/index.js +4 -24
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +4 -8
- package/src/components/global-styles/shadows-edit-panel.js +1 -0
- package/src/components/global-styles/style.scss +1 -7
- package/src/components/global-styles/variations/variation.js +14 -19
- package/src/components/global-styles/variations/variations-color.js +12 -4
- package/src/components/global-styles/variations/variations-typography.js +5 -1
- package/src/components/global-styles-sidebar/index.js +2 -0
- package/src/components/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +41 -137
- package/src/components/layout/style.scss +18 -58
- package/src/components/page/header.js +1 -0
- package/src/components/page/style.scss +6 -0
- package/src/components/page-patterns/header.js +8 -2
- package/src/components/page-patterns/index.js +15 -12
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/pagination/index.js +21 -16
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- package/src/components/sidebar-dataviews/dataview-item.js +6 -2
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
- package/src/components/site-hub/index.js +55 -146
- package/src/components/site-hub/style.scss +1 -4
- package/src/components/site-icon/style.scss +0 -4
- package/src/hooks/commands/use-set-command-context.js +37 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -2
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
- package/src/index.js +10 -2
- package/src/posts.js +29 -0
- package/src/posts.scss +46 -0
- package/src/store/private-actions.js +58 -30
- package/build/components/block-editor/block-inspector-button.js +0 -57
- package/build/components/block-editor/block-inspector-button.js.map +0 -1
- package/build/components/block-editor/inserter-media-categories.js +0 -183
- package/build/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build/components/template-part-converter/convert-to-regular.js +0 -38
- package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -84
- package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build/components/template-part-converter/index.js +0 -67
- package/build/components/template-part-converter/index.js.map +0 -1
- package/build-module/components/block-editor/block-inspector-button.js +0 -50
- package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/block-editor/inserter-media-categories.js +0 -177
- package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
- package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build-module/components/template-part-converter/index.js +0 -59
- package/build-module/components/template-part-converter/index.js.map +0 -1
- package/src/components/block-editor/block-inspector-button.js +0 -60
- package/src/components/block-editor/inserter-media-categories.js +0 -227
- package/src/components/template-part-converter/convert-to-regular.js +0 -32
- package/src/components/template-part-converter/convert-to-template-part.js +0 -78
- package/src/components/template-part-converter/index.js +0 -59
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
5
5
|
import { useLink } from '../routes/link';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
TEMPLATE_PART_POST_TYPE,
|
|
8
|
+
TEMPLATE_PART_ALL_AREAS_CATEGORY,
|
|
9
|
+
PATTERN_DEFAULT_CATEGORY,
|
|
10
|
+
PATTERN_TYPES,
|
|
11
|
+
} from '../../utils/constants';
|
|
7
12
|
|
|
8
13
|
export default function CategoryItem( {
|
|
9
14
|
count,
|
|
@@ -14,7 +19,11 @@ export default function CategoryItem( {
|
|
|
14
19
|
type,
|
|
15
20
|
} ) {
|
|
16
21
|
const linkInfo = useLink( {
|
|
17
|
-
categoryId:
|
|
22
|
+
categoryId:
|
|
23
|
+
id !== TEMPLATE_PART_ALL_AREAS_CATEGORY &&
|
|
24
|
+
id !== PATTERN_DEFAULT_CATEGORY
|
|
25
|
+
? id
|
|
26
|
+
: undefined,
|
|
18
27
|
postType:
|
|
19
28
|
type === TEMPLATE_PART_POST_TYPE
|
|
20
29
|
? TEMPLATE_PART_POST_TYPE
|
|
@@ -106,8 +106,12 @@ export default function SidebarNavigationScreenPatterns( { backPath } ) {
|
|
|
106
106
|
const {
|
|
107
107
|
params: { postType, categoryId },
|
|
108
108
|
} = useLocation();
|
|
109
|
-
const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
|
|
110
109
|
const currentType = postType || PATTERN_TYPES.user;
|
|
110
|
+
const currentCategory =
|
|
111
|
+
categoryId ||
|
|
112
|
+
( currentType === PATTERN_TYPES.user
|
|
113
|
+
? PATTERN_DEFAULT_CATEGORY
|
|
114
|
+
: TEMPLATE_PART_ALL_AREAS_CATEGORY );
|
|
111
115
|
|
|
112
116
|
const { templatePartAreas, hasTemplateParts, isLoading } =
|
|
113
117
|
useTemplatePartAreas();
|
|
@@ -7,19 +7,11 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import {
|
|
11
|
-
Button,
|
|
12
|
-
__unstableMotion as motion,
|
|
13
|
-
__unstableAnimatePresence as AnimatePresence,
|
|
14
|
-
__experimentalHStack as HStack,
|
|
15
|
-
} from '@wordpress/components';
|
|
16
|
-
import { useReducedMotion } from '@wordpress/compose';
|
|
10
|
+
import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
17
11
|
import { __ } from '@wordpress/i18n';
|
|
18
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
19
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
21
13
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
22
|
-
import { memo } from '@wordpress/element';
|
|
14
|
+
import { memo, forwardRef } from '@wordpress/element';
|
|
23
15
|
import { search } from '@wordpress/icons';
|
|
24
16
|
import { store as commandsStore } from '@wordpress/commands';
|
|
25
17
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
@@ -32,14 +24,10 @@ import { store as editSiteStore } from '../../store';
|
|
|
32
24
|
import SiteIcon from '../site-icon';
|
|
33
25
|
import { unlock } from '../../lock-unlock';
|
|
34
26
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
( select ) => {
|
|
40
|
-
const { getCanvasMode, getSettings } = unlock(
|
|
41
|
-
select( editSiteStore )
|
|
42
|
-
);
|
|
27
|
+
const SiteHub = memo(
|
|
28
|
+
forwardRef( ( { isTransparent }, ref ) => {
|
|
29
|
+
const { dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => {
|
|
30
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
43
31
|
|
|
44
32
|
const {
|
|
45
33
|
getSite,
|
|
@@ -47,7 +35,6 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
|
|
|
47
35
|
} = select( coreStore );
|
|
48
36
|
const _site = getSite();
|
|
49
37
|
return {
|
|
50
|
-
canvasMode: getCanvasMode(),
|
|
51
38
|
dashboardLink:
|
|
52
39
|
getSettings().__experimentalDashboardLink || 'index.php',
|
|
53
40
|
homeUrl: getUnstableBase()?.home,
|
|
@@ -56,141 +43,63 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
|
|
|
56
43
|
? filterURLForDisplay( _site?.url )
|
|
57
44
|
: _site?.title,
|
|
58
45
|
};
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
63
|
-
|
|
64
|
-
const disableMotion = useReducedMotion();
|
|
65
|
-
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
66
|
-
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
67
|
-
const { setDeviceType } = useDispatch( editorStore );
|
|
68
|
-
const isBackToDashboardButton = canvasMode === 'view';
|
|
69
|
-
const siteIconButtonProps = isBackToDashboardButton
|
|
70
|
-
? {
|
|
71
|
-
href: dashboardLink,
|
|
72
|
-
label: __( 'Go to the Dashboard' ),
|
|
73
|
-
}
|
|
74
|
-
: {
|
|
75
|
-
href: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
|
|
76
|
-
role: 'button',
|
|
77
|
-
label: __( 'Open Navigation' ),
|
|
78
|
-
onClick: ( event ) => {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
if ( canvasMode === 'edit' ) {
|
|
81
|
-
clearSelectedBlock();
|
|
82
|
-
setDeviceType( 'Desktop' );
|
|
83
|
-
setCanvasMode( 'view' );
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
46
|
+
}, [] );
|
|
47
|
+
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
87
48
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
transition={ {
|
|
99
|
-
type: 'tween',
|
|
100
|
-
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
101
|
-
ease: 'easeOut',
|
|
102
|
-
} }
|
|
103
|
-
>
|
|
104
|
-
<HStack justify="flex-start" spacing="0">
|
|
105
|
-
<motion.div
|
|
106
|
-
className={ clsx(
|
|
107
|
-
'edit-site-site-hub__view-mode-toggle-container',
|
|
108
|
-
{
|
|
109
|
-
'has-transparent-background': isTransparent,
|
|
110
|
-
}
|
|
111
|
-
) }
|
|
112
|
-
layout
|
|
113
|
-
transition={ {
|
|
114
|
-
type: 'tween',
|
|
115
|
-
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
116
|
-
ease: 'easeOut',
|
|
117
|
-
} }
|
|
118
|
-
>
|
|
119
|
-
<Button
|
|
120
|
-
{ ...siteIconButtonProps }
|
|
121
|
-
className="edit-site-layout__view-mode-toggle"
|
|
49
|
+
return (
|
|
50
|
+
<div className="edit-site-site-hub">
|
|
51
|
+
<HStack justify="flex-start" spacing="0">
|
|
52
|
+
<div
|
|
53
|
+
className={ clsx(
|
|
54
|
+
'edit-site-site-hub__view-mode-toggle-container',
|
|
55
|
+
{
|
|
56
|
+
'has-transparent-background': isTransparent,
|
|
57
|
+
}
|
|
58
|
+
) }
|
|
122
59
|
>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
transition={ {
|
|
132
|
-
type: 'tween',
|
|
133
|
-
duration: disableMotion
|
|
134
|
-
? 0
|
|
135
|
-
: HUB_ANIMATION_DURATION,
|
|
136
|
-
ease: 'easeOut',
|
|
60
|
+
<Button
|
|
61
|
+
ref={ ref }
|
|
62
|
+
href={ dashboardLink }
|
|
63
|
+
label={ __( 'Go to the Dashboard' ) }
|
|
64
|
+
className="edit-site-layout__view-mode-toggle"
|
|
65
|
+
style={ {
|
|
66
|
+
transform: 'scale(0.5)',
|
|
67
|
+
borderRadius: 4,
|
|
137
68
|
} }
|
|
138
69
|
>
|
|
139
70
|
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
140
|
-
</
|
|
141
|
-
</
|
|
142
|
-
</motion.div>
|
|
71
|
+
</Button>
|
|
72
|
+
</div>
|
|
143
73
|
|
|
144
|
-
|
|
145
|
-
|
|
74
|
+
<HStack>
|
|
75
|
+
<div className="edit-site-site-hub__title">
|
|
76
|
+
<Button
|
|
77
|
+
variant="link"
|
|
78
|
+
href={ homeUrl }
|
|
79
|
+
target="_blank"
|
|
80
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
81
|
+
>
|
|
82
|
+
{ decodeEntities( siteTitle ) }
|
|
83
|
+
</Button>
|
|
84
|
+
</div>
|
|
146
85
|
<HStack
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
opacity: isTransparent ? 0 : 1,
|
|
151
|
-
} }
|
|
152
|
-
exit={ { opacity: 0 } }
|
|
153
|
-
transition={ {
|
|
154
|
-
type: 'tween',
|
|
155
|
-
duration: disableMotion ? 0 : 0.2,
|
|
156
|
-
ease: 'easeOut',
|
|
157
|
-
delay: canvasMode === 'view' ? 0.1 : 0,
|
|
158
|
-
} }
|
|
86
|
+
spacing={ 0 }
|
|
87
|
+
expanded={ false }
|
|
88
|
+
className="edit-site-site-hub__actions"
|
|
159
89
|
>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
) }
|
|
168
|
-
aria-label={ __(
|
|
169
|
-
'View site (opens in a new tab)'
|
|
170
|
-
) }
|
|
171
|
-
>
|
|
172
|
-
{ decodeEntities( siteTitle ) }
|
|
173
|
-
</Button>
|
|
174
|
-
</div>
|
|
175
|
-
<HStack
|
|
176
|
-
spacing={ 0 }
|
|
177
|
-
expanded={ false }
|
|
178
|
-
className="edit-site-site-hub__actions"
|
|
179
|
-
>
|
|
180
|
-
<Button
|
|
181
|
-
className="edit-site-site-hub_toggle-command-center"
|
|
182
|
-
icon={ search }
|
|
183
|
-
onClick={ () => openCommandCenter() }
|
|
184
|
-
label={ __( 'Open command palette' ) }
|
|
185
|
-
shortcut={ displayShortcut.primary( 'k' ) }
|
|
186
|
-
/>
|
|
187
|
-
</HStack>
|
|
90
|
+
<Button
|
|
91
|
+
className="edit-site-site-hub_toggle-command-center"
|
|
92
|
+
icon={ search }
|
|
93
|
+
onClick={ () => openCommandCenter() }
|
|
94
|
+
label={ __( 'Open command palette' ) }
|
|
95
|
+
shortcut={ displayShortcut.primary( 'k' ) }
|
|
96
|
+
/>
|
|
188
97
|
</HStack>
|
|
189
|
-
|
|
190
|
-
</
|
|
191
|
-
</
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
|
|
98
|
+
</HStack>
|
|
99
|
+
</HStack>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
} )
|
|
103
|
+
);
|
|
195
104
|
|
|
196
105
|
export default SiteHub;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
gap: $grid-unit-10;
|
|
6
|
+
margin-right: $grid-unit-15;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.edit-site-site-hub__actions {
|
|
@@ -14,10 +15,6 @@
|
|
|
14
15
|
width: $header-height;
|
|
15
16
|
flex-shrink: 0;
|
|
16
17
|
|
|
17
|
-
.edit-site-layout__view-mode-toggle-icon {
|
|
18
|
-
background: $gray-900;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
18
|
&.has-transparent-background .edit-site-layout__view-mode-toggle-icon {
|
|
22
19
|
background: transparent;
|
|
23
20
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
.edit-site-site-icon__icon {
|
|
2
2
|
fill: currentColor;
|
|
3
|
-
// Matches SiteIcon motion, smoothing out the transition.
|
|
4
|
-
transition: padding 0.3s ease-out;
|
|
5
|
-
@include reduce-motion("transition");
|
|
6
3
|
|
|
7
4
|
.edit-site-layout.is-full-canvas & {
|
|
8
5
|
// Make the WordPress icon not so big in full canvas.
|
|
@@ -13,7 +10,6 @@
|
|
|
13
10
|
.edit-site-site-icon__image {
|
|
14
11
|
width: 100%;
|
|
15
12
|
height: 100%;
|
|
16
|
-
border-radius: $radius-block-ui * 2;
|
|
17
13
|
object-fit: cover;
|
|
18
14
|
background: #333;
|
|
19
15
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { privateApis as commandsPrivateApis } from '@wordpress/commands';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as editSiteStore } from '../../store';
|
|
12
|
+
import { unlock } from '../../lock-unlock';
|
|
13
|
+
|
|
14
|
+
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* React hook used to set the correct command context based on the current state.
|
|
18
|
+
*/
|
|
19
|
+
export default function useSetCommandContext() {
|
|
20
|
+
const { hasBlockSelected, canvasMode } = useSelect( ( select ) => {
|
|
21
|
+
const { getCanvasMode } = unlock( select( editSiteStore ) );
|
|
22
|
+
const { getBlockSelectionStart } = select( blockEditorStore );
|
|
23
|
+
return {
|
|
24
|
+
canvasMode: getCanvasMode(),
|
|
25
|
+
hasBlockSelected: getBlockSelectionStart(),
|
|
26
|
+
};
|
|
27
|
+
}, [] );
|
|
28
|
+
// Sets the right context for the command palette
|
|
29
|
+
let commandContext = 'site-editor';
|
|
30
|
+
if ( canvasMode === 'edit' ) {
|
|
31
|
+
commandContext = 'entity-edit';
|
|
32
|
+
}
|
|
33
|
+
if ( hasBlockSelected ) {
|
|
34
|
+
commandContext = 'block-selection-edit';
|
|
35
|
+
}
|
|
36
|
+
useCommandContext( commandContext );
|
|
37
|
+
}
|
|
@@ -287,7 +287,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
287
287
|
// notification.
|
|
288
288
|
__unstableMarkNextChangeAsNotPersistent();
|
|
289
289
|
setAttributes( newBlockAttributes );
|
|
290
|
-
setUserConfig(
|
|
290
|
+
setUserConfig( newUserConfig, { undoIgnore: true } );
|
|
291
291
|
createSuccessNotice(
|
|
292
292
|
sprintf(
|
|
293
293
|
// translators: %s: Title of the block e.g. 'Heading'.
|
|
@@ -302,7 +302,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
302
302
|
onClick() {
|
|
303
303
|
__unstableMarkNextChangeAsNotPersistent();
|
|
304
304
|
setAttributes( attributes );
|
|
305
|
-
setUserConfig(
|
|
305
|
+
setUserConfig( userConfig, {
|
|
306
306
|
undoIgnore: true,
|
|
307
307
|
} );
|
|
308
308
|
},
|
|
@@ -339,6 +339,7 @@ function PushChangesToGlobalStylesControl( {
|
|
|
339
339
|
<Button
|
|
340
340
|
__next40pxDefaultSize
|
|
341
341
|
variant="secondary"
|
|
342
|
+
__experimentalIsFocusable
|
|
342
343
|
disabled={ changes.length === 0 }
|
|
343
344
|
onClick={ pushChanges }
|
|
344
345
|
>
|