@wordpress/edit-site 5.12.9 → 5.12.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-page/index.js +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +10 -2
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +10 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/layout/index.js +33 -25
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -15
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +1 -1
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +2 -1
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +13 -5
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/resizable-frame/index.js +3 -4
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +10 -14
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +16 -7
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +78 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -2
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +10 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/layout/index.js +33 -25
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +1 -1
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -2
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +13 -5
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +3 -4
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +10 -14
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +16 -7
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +74 -20
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-style/style-rtl.css +14 -16
- package/build-style/style.css +14 -16
- package/package.json +21 -21
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +8 -2
- package/src/components/editor/index.js +15 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/layout/index.js +54 -45
- package/src/components/layout/style.scss +1 -1
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -21
- package/src/components/page-patterns/grid-item.js +1 -1
- package/src/components/page-patterns/patterns-list.js +16 -6
- package/src/components/page-patterns/use-patterns.js +12 -5
- package/src/components/resizable-frame/index.js +2 -3
- package/src/components/resizable-frame/style.scss +0 -17
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-navigation-screen-patterns/index.js +10 -13
- package/src/components/sidebar-navigation-screen-patterns/style.scss +5 -7
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/site-hub/index.js +21 -7
- package/src/components/site-hub/style.scss +9 -2
- package/src/hooks/commands/use-common-commands.js +56 -23
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
|
@@ -61,9 +61,6 @@ function TemplatePartGroup( { areas, currentArea, currentType } ) {
|
|
|
61
61
|
function ThemePatternsGroup( { categories, currentCategory, currentType } ) {
|
|
62
62
|
return (
|
|
63
63
|
<>
|
|
64
|
-
<div className="edit-site-sidebar-navigation-screen-patterns__group-header">
|
|
65
|
-
<Heading level={ 2 }>{ __( 'Theme patterns' ) }</Heading>
|
|
66
|
-
</div>
|
|
67
64
|
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
68
65
|
{ categories.map( ( category ) => (
|
|
69
66
|
<CategoryItem
|
|
@@ -117,9 +114,6 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
117
114
|
const templatePartsLink = useLink( { path: '/wp_template_part/all' } );
|
|
118
115
|
const footer = ! isMobileViewport ? (
|
|
119
116
|
<ItemGroup>
|
|
120
|
-
<SidebarNavigationItem withChevron { ...templatePartsLink }>
|
|
121
|
-
{ __( 'Manage all template parts' ) }
|
|
122
|
-
</SidebarNavigationItem>
|
|
123
117
|
<SidebarNavigationItem
|
|
124
118
|
as="a"
|
|
125
119
|
href="edit.php?post_type=wp_block"
|
|
@@ -127,6 +121,9 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
127
121
|
>
|
|
128
122
|
{ __( 'Manage all of my patterns' ) }
|
|
129
123
|
</SidebarNavigationItem>
|
|
124
|
+
<SidebarNavigationItem withChevron { ...templatePartsLink }>
|
|
125
|
+
{ __( 'Manage all template parts' ) }
|
|
126
|
+
</SidebarNavigationItem>
|
|
130
127
|
</ItemGroup>
|
|
131
128
|
) : undefined;
|
|
132
129
|
|
|
@@ -172,13 +169,6 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
172
169
|
}
|
|
173
170
|
/>
|
|
174
171
|
</ItemGroup>
|
|
175
|
-
{ hasTemplateParts && (
|
|
176
|
-
<TemplatePartGroup
|
|
177
|
-
areas={ templatePartAreas }
|
|
178
|
-
currentArea={ currentCategory }
|
|
179
|
-
currentType={ currentType }
|
|
180
|
-
/>
|
|
181
|
-
) }
|
|
182
172
|
{ hasPatterns && (
|
|
183
173
|
<ThemePatternsGroup
|
|
184
174
|
categories={ patternCategories }
|
|
@@ -186,6 +176,13 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
186
176
|
currentType={ currentType }
|
|
187
177
|
/>
|
|
188
178
|
) }
|
|
179
|
+
{ hasTemplateParts && (
|
|
180
|
+
<TemplatePartGroup
|
|
181
|
+
areas={ templatePartAreas }
|
|
182
|
+
currentArea={ currentCategory }
|
|
183
|
+
currentType={ currentType }
|
|
184
|
+
/>
|
|
185
|
+
) }
|
|
189
186
|
</>
|
|
190
187
|
) }
|
|
191
188
|
</>
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
.edit-site-sidebar-navigation-screen-patterns__group {
|
|
2
|
-
margin-bottom: $grid-unit-
|
|
3
|
-
|
|
4
|
-
&:
|
|
2
|
+
margin-bottom: $grid-unit-30;
|
|
3
|
+
|
|
4
|
+
&:last-of-type {
|
|
5
5
|
border-bottom: 0;
|
|
6
6
|
padding-bottom: 0;
|
|
7
7
|
margin-bottom: 0;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
&:first-of-type {
|
|
11
|
-
margin-bottom: $grid-unit-40;
|
|
12
|
-
}
|
|
13
9
|
}
|
|
14
10
|
|
|
15
11
|
.edit-site-sidebar-navigation-screen-patterns__group-header {
|
|
12
|
+
margin-top: $grid-unit-20;
|
|
13
|
+
|
|
16
14
|
p {
|
|
17
15
|
color: $gray-600;
|
|
18
16
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useMemo } from '@wordpress/element';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -11,6 +12,10 @@ import useThemePatterns from './use-theme-patterns';
|
|
|
11
12
|
|
|
12
13
|
export default function usePatternCategories() {
|
|
13
14
|
const defaultCategories = useDefaultPatternCategories();
|
|
15
|
+
defaultCategories.push( {
|
|
16
|
+
name: 'uncategorized',
|
|
17
|
+
label: __( 'Uncategorized' ),
|
|
18
|
+
} );
|
|
14
19
|
const themePatterns = useThemePatterns();
|
|
15
20
|
|
|
16
21
|
const patternCategories = useMemo( () => {
|
|
@@ -31,6 +36,10 @@ export default function usePatternCategories() {
|
|
|
31
36
|
categoryMap[ category ].count += 1;
|
|
32
37
|
}
|
|
33
38
|
} );
|
|
39
|
+
// If the pattern has no categories, add it to uncategorized.
|
|
40
|
+
if ( ! pattern.categories?.length ) {
|
|
41
|
+
categoryMap.uncategorized.count += 1;
|
|
42
|
+
}
|
|
34
43
|
} );
|
|
35
44
|
|
|
36
45
|
// Filter categories so we only have those containing patterns.
|
|
@@ -36,7 +36,8 @@ export default function useThemePatterns() {
|
|
|
36
36
|
( pattern ) =>
|
|
37
37
|
! CORE_PATTERN_SOURCES.includes( pattern.source )
|
|
38
38
|
)
|
|
39
|
-
.filter( filterOutDuplicatesByName )
|
|
39
|
+
.filter( filterOutDuplicatesByName )
|
|
40
|
+
.filter( ( pattern ) => pattern.inserter !== false ),
|
|
40
41
|
[ blockPatterns, restBlockPatterns ]
|
|
41
42
|
);
|
|
42
43
|
|
|
@@ -31,7 +31,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
31
31
|
|
|
32
32
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
33
33
|
|
|
34
|
-
const SiteHub = forwardRef( (
|
|
34
|
+
const SiteHub = forwardRef( ( { isTransparent, ...restProps }, ref ) => {
|
|
35
35
|
const { canvasMode, dashboardLink, homeUrl } = useSelect( ( select ) => {
|
|
36
36
|
const { getCanvasMode, getSettings } = unlock(
|
|
37
37
|
select( editSiteStore )
|
|
@@ -85,8 +85,11 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
85
85
|
return (
|
|
86
86
|
<motion.div
|
|
87
87
|
ref={ ref }
|
|
88
|
-
{ ...
|
|
89
|
-
className={ classnames(
|
|
88
|
+
{ ...restProps }
|
|
89
|
+
className={ classnames(
|
|
90
|
+
'edit-site-site-hub',
|
|
91
|
+
restProps.className
|
|
92
|
+
) }
|
|
90
93
|
initial={ false }
|
|
91
94
|
transition={ {
|
|
92
95
|
type: 'tween',
|
|
@@ -105,7 +108,12 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
105
108
|
spacing="0"
|
|
106
109
|
>
|
|
107
110
|
<motion.div
|
|
108
|
-
className=
|
|
111
|
+
className={ classnames(
|
|
112
|
+
'edit-site-site-hub__view-mode-toggle-container',
|
|
113
|
+
{
|
|
114
|
+
'has-transparent-background': isTransparent,
|
|
115
|
+
}
|
|
116
|
+
) }
|
|
109
117
|
layout
|
|
110
118
|
transition={ {
|
|
111
119
|
type: 'tween',
|
|
@@ -149,7 +157,10 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
149
157
|
exit={ {
|
|
150
158
|
opacity: 0,
|
|
151
159
|
} }
|
|
152
|
-
className=
|
|
160
|
+
className={ classnames(
|
|
161
|
+
'edit-site-site-hub__site-title',
|
|
162
|
+
{ 'is-transparent': isTransparent }
|
|
163
|
+
) }
|
|
153
164
|
transition={ {
|
|
154
165
|
type: 'tween',
|
|
155
166
|
duration: disableMotion ? 0 : 0.2,
|
|
@@ -164,7 +175,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
164
175
|
<Button
|
|
165
176
|
href={ homeUrl }
|
|
166
177
|
target="_blank"
|
|
167
|
-
label={ __( 'View site' ) }
|
|
178
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
168
179
|
aria-label={ __(
|
|
169
180
|
'View site (opens in a new tab)'
|
|
170
181
|
) }
|
|
@@ -175,7 +186,10 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
175
186
|
</HStack>
|
|
176
187
|
{ canvasMode === 'view' && (
|
|
177
188
|
<Button
|
|
178
|
-
className=
|
|
189
|
+
className={ classnames(
|
|
190
|
+
'edit-site-site-hub_toggle-command-center',
|
|
191
|
+
{ 'is-transparent': isTransparent }
|
|
192
|
+
) }
|
|
179
193
|
icon={ search }
|
|
180
194
|
onClick={ () => openCommandCenter() }
|
|
181
195
|
label={ __( 'Open command palette' ) }
|
|
@@ -11,17 +11,20 @@
|
|
|
11
11
|
.edit-site-site-hub__site-title,
|
|
12
12
|
.edit-site-site-hub_toggle-command-center {
|
|
13
13
|
transition: opacity ease 0.1s;
|
|
14
|
+
|
|
15
|
+
&.is-transparent {
|
|
16
|
+
opacity: 0 !important;
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
.edit-site-site-hub__site-view-link {
|
|
17
21
|
flex-grow: 0;
|
|
22
|
+
margin-right: var(--wp-admin-border-width-focus);
|
|
18
23
|
@include break-mobile() {
|
|
19
24
|
opacity: 0;
|
|
20
25
|
transition: opacity 0.2s ease-in-out;
|
|
21
26
|
}
|
|
22
27
|
&:focus {
|
|
23
|
-
outline: none;
|
|
24
|
-
box-shadow: none;
|
|
25
28
|
opacity: 1;
|
|
26
29
|
}
|
|
27
30
|
svg {
|
|
@@ -44,6 +47,10 @@
|
|
|
44
47
|
width: $header-height;
|
|
45
48
|
flex-shrink: 0;
|
|
46
49
|
background: $gray-900;
|
|
50
|
+
|
|
51
|
+
&.has-transparent-background {
|
|
52
|
+
background: transparent;
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
.edit-site-site-hub__text-content {
|
|
@@ -11,15 +11,17 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
11
11
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { store as noticesStore } from '@wordpress/notices';
|
|
14
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
17
18
|
*/
|
|
18
19
|
import { unlock } from '../../lock-unlock';
|
|
19
20
|
import { store as editSiteStore } from '../../store';
|
|
21
|
+
import getIsListPage from '../../utils/get-is-list-page';
|
|
20
22
|
|
|
21
23
|
const { useGlobalStylesReset } = unlock( blockEditorPrivateApis );
|
|
22
|
-
const { useHistory } = unlock( routerPrivateApis );
|
|
24
|
+
const { useHistory, useLocation } = unlock( routerPrivateApis );
|
|
23
25
|
|
|
24
26
|
function useGlobalStylesResetCommands() {
|
|
25
27
|
const [ canReset, onReset ] = useGlobalStylesReset();
|
|
@@ -48,9 +50,12 @@ function useGlobalStylesResetCommands() {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
function useGlobalStylesOpenCssCommands() {
|
|
51
|
-
const { openGeneralSidebar, setEditorCanvasContainerView } =
|
|
52
|
-
useDispatch( editSiteStore )
|
|
53
|
-
);
|
|
53
|
+
const { openGeneralSidebar, setEditorCanvasContainerView, setCanvasMode } =
|
|
54
|
+
unlock( useDispatch( editSiteStore ) );
|
|
55
|
+
const { params } = useLocation();
|
|
56
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
57
|
+
const isListPage = getIsListPage( params, isMobileViewport );
|
|
58
|
+
const isEditorPage = ! isListPage;
|
|
54
59
|
const history = useHistory();
|
|
55
60
|
const { canEditCSS } = useSelect( ( select ) => {
|
|
56
61
|
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
@@ -66,6 +71,7 @@ function useGlobalStylesOpenCssCommands() {
|
|
|
66
71
|
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
67
72
|
};
|
|
68
73
|
}, [] );
|
|
74
|
+
const { getCanvasMode } = unlock( useSelect( editSiteStore ) );
|
|
69
75
|
|
|
70
76
|
const commands = useMemo( () => {
|
|
71
77
|
if ( ! canEditCSS ) {
|
|
@@ -79,10 +85,15 @@ function useGlobalStylesOpenCssCommands() {
|
|
|
79
85
|
icon: styles,
|
|
80
86
|
callback: ( { close } ) => {
|
|
81
87
|
close();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
if ( ! isEditorPage ) {
|
|
89
|
+
history.push( {
|
|
90
|
+
path: '/wp_global_styles',
|
|
91
|
+
canvas: 'edit',
|
|
92
|
+
} );
|
|
93
|
+
}
|
|
94
|
+
if ( isEditorPage && getCanvasMode() !== 'edit' ) {
|
|
95
|
+
setCanvasMode( 'edit' );
|
|
96
|
+
}
|
|
86
97
|
openGeneralSidebar( 'edit-site/global-styles' );
|
|
87
98
|
setEditorCanvasContainerView( 'global-styles-css' );
|
|
88
99
|
},
|
|
@@ -93,6 +104,9 @@ function useGlobalStylesOpenCssCommands() {
|
|
|
93
104
|
openGeneralSidebar,
|
|
94
105
|
setEditorCanvasContainerView,
|
|
95
106
|
canEditCSS,
|
|
107
|
+
isEditorPage,
|
|
108
|
+
getCanvasMode,
|
|
109
|
+
setCanvasMode,
|
|
96
110
|
] );
|
|
97
111
|
return {
|
|
98
112
|
isLoading: false,
|
|
@@ -101,9 +115,13 @@ function useGlobalStylesOpenCssCommands() {
|
|
|
101
115
|
}
|
|
102
116
|
|
|
103
117
|
export function useCommonCommands() {
|
|
104
|
-
const { openGeneralSidebar, setEditorCanvasContainerView } =
|
|
105
|
-
useDispatch( editSiteStore )
|
|
106
|
-
);
|
|
118
|
+
const { openGeneralSidebar, setEditorCanvasContainerView, setCanvasMode } =
|
|
119
|
+
unlock( useDispatch( editSiteStore ) );
|
|
120
|
+
const { params } = useLocation();
|
|
121
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
122
|
+
const isListPage = getIsListPage( params, isMobileViewport );
|
|
123
|
+
const isEditorPage = ! isListPage;
|
|
124
|
+
const { getCanvasMode } = unlock( useSelect( editSiteStore ) );
|
|
107
125
|
const { set } = useDispatch( preferencesStore );
|
|
108
126
|
const { createInfoNotice } = useDispatch( noticesStore );
|
|
109
127
|
const history = useHistory();
|
|
@@ -127,10 +145,15 @@ export function useCommonCommands() {
|
|
|
127
145
|
icon: backup,
|
|
128
146
|
callback: ( { close } ) => {
|
|
129
147
|
close();
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
148
|
+
if ( ! isEditorPage ) {
|
|
149
|
+
history.push( {
|
|
150
|
+
path: '/wp_global_styles',
|
|
151
|
+
canvas: 'edit',
|
|
152
|
+
} );
|
|
153
|
+
}
|
|
154
|
+
if ( isEditorPage && getCanvasMode() !== 'edit' ) {
|
|
155
|
+
setCanvasMode( 'edit' );
|
|
156
|
+
}
|
|
134
157
|
openGeneralSidebar( 'edit-site/global-styles' );
|
|
135
158
|
setEditorCanvasContainerView( 'global-styles-revisions' );
|
|
136
159
|
},
|
|
@@ -141,10 +164,15 @@ export function useCommonCommands() {
|
|
|
141
164
|
label: __( 'Open styles' ),
|
|
142
165
|
callback: ( { close } ) => {
|
|
143
166
|
close();
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
if ( ! isEditorPage ) {
|
|
168
|
+
history.push( {
|
|
169
|
+
path: '/wp_global_styles',
|
|
170
|
+
canvas: 'edit',
|
|
171
|
+
} );
|
|
172
|
+
}
|
|
173
|
+
if ( isEditorPage && getCanvasMode() !== 'edit' ) {
|
|
174
|
+
setCanvasMode( 'edit' );
|
|
175
|
+
}
|
|
148
176
|
if ( isDistractionFree ) {
|
|
149
177
|
set( editSiteStore.name, 'distractionFree', false );
|
|
150
178
|
createInfoNotice( __( 'Distraction free mode turned off.' ), {
|
|
@@ -161,10 +189,15 @@ export function useCommonCommands() {
|
|
|
161
189
|
label: __( 'Learn about styles' ),
|
|
162
190
|
callback: ( { close } ) => {
|
|
163
191
|
close();
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
192
|
+
if ( ! isEditorPage ) {
|
|
193
|
+
history.push( {
|
|
194
|
+
path: '/wp_global_styles',
|
|
195
|
+
canvas: 'edit',
|
|
196
|
+
} );
|
|
197
|
+
}
|
|
198
|
+
if ( isEditorPage && getCanvasMode() !== 'edit' ) {
|
|
199
|
+
setCanvasMode( 'edit' );
|
|
200
|
+
}
|
|
168
201
|
openGeneralSidebar( 'edit-site/global-styles' );
|
|
169
202
|
set( 'core/edit-site', 'welcomeGuideStyles', true );
|
|
170
203
|
// sometimes there's a focus loss that happens after some time
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-actions/delete-page-menu-item.js"],"names":["DeletePageMenuItem","postId","onRemove","isModalOpen","setIsModalOpen","createSuccessNotice","createErrorNotice","noticesStore","deleteEntityRecord","coreStore","page","select","getEntityRecord","removePage","throwOnError","title","rendered","type","id","error","errorMessage","message","code"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AAZA;AACA;AACA;AAYe,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA7B,EAAoD;AAClE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,KAAV,CAAxC;AACA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACL,uBAAaC,cAAb,CADD;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,eAAb,CAA/B;AACA,QAAMC,IAAI,GAAG,qBACVC,MAAF,IACCA,MAAM,CAAEF,eAAF,CAAN,CAAoBG,eAApB,CAAqC,UAArC,EAAiD,MAAjD,EAAyDX,MAAzD,CAFW,EAGZ,CAAEA,MAAF,CAHY,CAAb;;AAKA,iBAAeY,UAAf,GAA4B;AAC3B,QAAI;AACH,YAAML,kBAAkB,CACvB,UADuB,EAEvB,MAFuB,EAGvBP,MAHuB,EAIvB,EAJuB,EAKvB;AAAEa,QAAAA,YAAY,EAAE;AAAhB,OALuB,CAAxB;AAOAT,MAAAA,mBAAmB,CAClB;AACC;AACA,oBAAI,eAAJ,CAFD,EAGC,kCAAgBK,IAAI,CAACK,KAAL,CAAWC,QAA3B,CAHD,CADkB,EAMlB;AACCC,QAAAA,IAAI,EAAE,UADP;AAECC,QAAAA,EAAE,EAAE;AAFL,OANkB,CAAnB;AAWAhB,MAAAA,QAAQ;AACR,KApBD,CAoBE,OAAQiB,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG,cAAI,4CAAJ,CAHJ;AAKAf,MAAAA,iBAAiB,CAAEc,YAAF,EAAgB;AAAEH,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA,KA3BD,SA2BU;AACTb,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AACD;;AACD,SACC,qDACC,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAG,MAAMA,cAAc,CAAE,IAAF,CAAxC;AAAmD,IAAA,aAAa;AAAhE,KACG,cAAI,QAAJ,CADH,CADD,EAIC,4BAAC,uCAAD;AACC,IAAA,MAAM,EAAGD,WADV;AAEC,IAAA,SAAS,EAAGU,UAFb;AAGC,IAAA,QAAQ,EAAG,MAAMT,cAAc,CAAE,KAAF;AAHhC,KAKG,cAAI,4CAAJ,CALH,CAJD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function DeletePageMenuItem( { postId, onRemove } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst page = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', 'page', postId ),\n\t\t[ postId ]\n\t);\n\tasync function removePage() {\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tpostId,\n\t\t\t\t{},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( page.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-page-removed',\n\t\t\t\t}\n\t\t\t);\n\t\t\tonRemove?.();\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t} finally {\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) } isDestructive>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ removePage }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t>\n\t\t\t\t{ __( 'Are you sure you want to delete this page?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-actions/delete-page-menu-item.js"],"names":["useDispatch","useSelect","decodeEntities","useState","store","coreStore","__","sprintf","MenuItem","__experimentalConfirmDialog","ConfirmDialog","noticesStore","DeletePageMenuItem","postId","onRemove","isModalOpen","setIsModalOpen","createSuccessNotice","createErrorNotice","deleteEntityRecord","page","select","getEntityRecord","removePage","throwOnError","title","rendered","type","id","error","errorMessage","message","code"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,QADD,EAECC,2BAA2B,IAAIC,aAFhC,QAGO,uBAHP;AAIA,SAASN,KAAK,IAAIO,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,kBAAT,CAA6B;AAAEC,EAAAA,MAAF;AAAUC,EAAAA;AAAV,CAA7B,EAAoD;AAClE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCb,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAEc,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACLlB,WAAW,CAAEW,YAAF,CADZ;AAEA,QAAM;AAAEQ,IAAAA;AAAF,MAAyBnB,WAAW,CAAEK,SAAF,CAA1C;AACA,QAAMe,IAAI,GAAGnB,SAAS,CACnBoB,MAAF,IACCA,MAAM,CAAEhB,SAAF,CAAN,CAAoBiB,eAApB,CAAqC,UAArC,EAAiD,MAAjD,EAAyDT,MAAzD,CAFoB,EAGrB,CAAEA,MAAF,CAHqB,CAAtB;;AAKA,iBAAeU,UAAf,GAA4B;AAC3B,QAAI;AACH,YAAMJ,kBAAkB,CACvB,UADuB,EAEvB,MAFuB,EAGvBN,MAHuB,EAIvB,EAJuB,EAKvB;AAAEW,QAAAA,YAAY,EAAE;AAAhB,OALuB,CAAxB;AAOAP,MAAAA,mBAAmB,CAClBV,OAAO;AACN;AACAD,MAAAA,EAAE,CAAE,eAAF,CAFI,EAGNJ,cAAc,CAAEkB,IAAI,CAACK,KAAL,CAAWC,QAAb,CAHR,CADW,EAMlB;AACCC,QAAAA,IAAI,EAAE,UADP;AAECC,QAAAA,EAAE,EAAE;AAFL,OANkB,CAAnB;AAWAd,MAAAA,QAAQ;AACR,KApBD,CAoBE,OAAQe,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEGzB,EAAE,CAAE,4CAAF,CAHN;AAKAY,MAAAA,iBAAiB,CAAEY,YAAF,EAAgB;AAAEH,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA,KA3BD,SA2BU;AACTX,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AACD;;AACD,SACC,8BACC,cAAC,QAAD;AAAU,IAAA,OAAO,EAAG,MAAMA,cAAc,CAAE,IAAF,CAAxC;AAAmD,IAAA,aAAa;AAAhE,KACGV,EAAE,CAAE,QAAF,CADL,CADD,EAIC,cAAC,aAAD;AACC,IAAA,MAAM,EAAGS,WADV;AAEC,IAAA,SAAS,EAAGQ,UAFb;AAGC,IAAA,QAAQ,EAAG,MAAMP,cAAc,CAAE,KAAF;AAHhC,KAKGV,EAAE,CAAE,4CAAF,CALL,CAJD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function DeletePageMenuItem( { postId, onRemove } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\tconst page = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', 'page', postId ),\n\t\t[ postId ]\n\t);\n\tasync function removePage() {\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\tpostId,\n\t\t\t\t{},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( page.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-page-removed',\n\t\t\t\t}\n\t\t\t);\n\t\t\tonRemove?.();\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t} finally {\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) } isDestructive>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ removePage }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t>\n\t\t\t\t{ __( 'Are you sure you want to delete this page?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"]}
|