@wordpress/edit-site 6.19.0 → 6.20.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-template/utils.js +1 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +19 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/site-preview.js +9 -10
- package/build/components/editor/site-preview.js.map +1 -1
- package/build/components/editor/use-editor-title.js +3 -2
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/global-styles/shadows-panel.js +19 -23
- package/build/components/global-styles/shadows-panel.js.map +1 -1
- package/build/components/layout/index.js +23 -15
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/header.js +1 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +3 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/sidebar/index.js +17 -11
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +28 -30
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-unsupported/index.js +24 -0
- package/build/components/sidebar-navigation-screen-unsupported/index.js.map +1 -0
- package/build/components/site-editor-routes/home.js +22 -5
- package/build/components/site-editor-routes/home.js.map +1 -1
- package/build/components/site-editor-routes/navigation-item.js +21 -5
- package/build/components/site-editor-routes/navigation-item.js.map +1 -1
- package/build/components/site-editor-routes/navigation.js +21 -5
- package/build/components/site-editor-routes/navigation.js.map +1 -1
- package/build/components/site-editor-routes/page-item.js +25 -9
- package/build/components/site-editor-routes/page-item.js.map +1 -1
- package/build/components/site-editor-routes/pages.js +32 -11
- package/build/components/site-editor-routes/pages.js.map +1 -1
- package/build/components/site-editor-routes/pattern-item.js +10 -3
- package/build/components/site-editor-routes/pattern-item.js.map +1 -1
- package/build/components/site-editor-routes/patterns.js +23 -24
- package/build/components/site-editor-routes/patterns.js.map +1 -1
- package/build/components/site-editor-routes/stylebook.js +25 -11
- package/build/components/site-editor-routes/stylebook.js.map +1 -1
- package/build/components/site-editor-routes/template-item.js +21 -5
- package/build/components/site-editor-routes/template-item.js.map +1 -1
- package/build/components/site-editor-routes/templates.js +27 -6
- package/build/components/site-editor-routes/templates.js.map +1 -1
- package/build/components/site-editor-routes/utils.js +20 -0
- package/build/components/site-editor-routes/utils.js.map +1 -0
- package/build/components/site-hub/index.js +37 -15
- package/build/components/site-hub/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +20 -3
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/site-preview.js +9 -10
- package/build-module/components/editor/site-preview.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +3 -2
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/global-styles/shadows-panel.js +20 -24
- package/build-module/components/global-styles/shadows-panel.js.map +1 -1
- package/build-module/components/layout/index.js +22 -14
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/header.js +1 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +3 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/sidebar/index.js +15 -10
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +28 -30
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-unsupported/index.js +17 -0
- package/build-module/components/sidebar-navigation-screen-unsupported/index.js.map +1 -0
- package/build-module/components/site-editor-routes/home.js +22 -5
- package/build-module/components/site-editor-routes/home.js.map +1 -1
- package/build-module/components/site-editor-routes/navigation-item.js +21 -5
- package/build-module/components/site-editor-routes/navigation-item.js.map +1 -1
- package/build-module/components/site-editor-routes/navigation.js +21 -5
- package/build-module/components/site-editor-routes/navigation.js.map +1 -1
- package/build-module/components/site-editor-routes/page-item.js +25 -9
- package/build-module/components/site-editor-routes/page-item.js.map +1 -1
- package/build-module/components/site-editor-routes/pages.js +32 -11
- package/build-module/components/site-editor-routes/pages.js.map +1 -1
- package/build-module/components/site-editor-routes/pattern-item.js +10 -3
- package/build-module/components/site-editor-routes/pattern-item.js.map +1 -1
- package/build-module/components/site-editor-routes/patterns.js +23 -24
- package/build-module/components/site-editor-routes/patterns.js.map +1 -1
- package/build-module/components/site-editor-routes/stylebook.js +25 -11
- package/build-module/components/site-editor-routes/stylebook.js.map +1 -1
- package/build-module/components/site-editor-routes/template-item.js +21 -5
- package/build-module/components/site-editor-routes/template-item.js.map +1 -1
- package/build-module/components/site-editor-routes/templates.js +27 -6
- package/build-module/components/site-editor-routes/templates.js.map +1 -1
- package/build-module/components/site-editor-routes/utils.js +14 -0
- package/build-module/components/site-editor-routes/utils.js.map +1 -0
- package/build-module/components/site-hub/index.js +37 -15
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-style/posts-rtl.css +7 -10
- package/build-style/posts.css +7 -10
- package/build-style/style-rtl.css +7 -11
- package/build-style/style.css +7 -11
- package/package.json +42 -42
- package/src/components/add-new-template/utils.js +1 -2
- package/src/components/app/index.js +18 -3
- package/src/components/editor/site-preview.js +9 -15
- package/src/components/editor/use-editor-title.js +6 -6
- package/src/components/global-styles/shadows-panel.js +25 -31
- package/src/components/global-styles/style.scss +0 -1
- package/src/components/layout/index.js +36 -22
- package/src/components/layout/style.scss +2 -0
- package/src/components/page/style.scss +1 -5
- package/src/components/page-patterns/header.js +1 -1
- package/src/components/page-patterns/use-patterns.js +7 -7
- package/src/components/sidebar/index.js +15 -13
- package/src/components/sidebar-navigation-screen-main/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +38 -40
- package/src/components/sidebar-navigation-screen-patterns/index.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -1
- package/src/components/sidebar-navigation-screen-unsupported/index.js +17 -0
- package/src/components/site-editor-routes/home.js +27 -3
- package/src/components/site-editor-routes/navigation-item.js +25 -5
- package/src/components/site-editor-routes/navigation.js +21 -3
- package/src/components/site-editor-routes/page-item.js +29 -9
- package/src/components/site-editor-routes/pages.js +30 -10
- package/src/components/site-editor-routes/pattern-item.js +9 -1
- package/src/components/site-editor-routes/patterns.js +22 -21
- package/src/components/site-editor-routes/stylebook.js +25 -11
- package/src/components/site-editor-routes/template-item.js +25 -3
- package/src/components/site-editor-routes/templates.js +26 -4
- package/src/components/site-editor-routes/utils.js +14 -0
- package/src/components/site-hub/index.js +49 -16
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -9,19 +9,39 @@ import { __ } from '@wordpress/i18n';
|
|
|
9
9
|
import Editor from '../editor';
|
|
10
10
|
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
11
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
|
|
12
13
|
|
|
13
14
|
export const pageItemRoute = {
|
|
14
15
|
name: 'page-item',
|
|
15
16
|
path: '/page/:postId',
|
|
16
17
|
areas: {
|
|
17
|
-
sidebar
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
sidebar( { siteData } ) {
|
|
19
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
20
|
+
return isBlockTheme ? (
|
|
21
|
+
<SidebarNavigationScreen
|
|
22
|
+
title={ __( 'Pages' ) }
|
|
23
|
+
backPath="/"
|
|
24
|
+
content={ <DataViewsSidebarContent postType="page" /> }
|
|
25
|
+
/>
|
|
26
|
+
) : (
|
|
27
|
+
<SidebarNavigationScreenUnsupported />
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
mobile( { siteData } ) {
|
|
31
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
32
|
+
return isBlockTheme ? (
|
|
33
|
+
<Editor />
|
|
34
|
+
) : (
|
|
35
|
+
<SidebarNavigationScreenUnsupported />
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
preview( { siteData } ) {
|
|
39
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
40
|
+
return isBlockTheme ? (
|
|
41
|
+
<Editor />
|
|
42
|
+
) : (
|
|
43
|
+
<SidebarNavigationScreenUnsupported />
|
|
44
|
+
);
|
|
45
|
+
},
|
|
26
46
|
},
|
|
27
47
|
};
|
|
@@ -9,6 +9,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
9
9
|
*/
|
|
10
10
|
import Editor from '../editor';
|
|
11
11
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
|
|
12
13
|
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
13
14
|
import PostList from '../post-list';
|
|
14
15
|
import { unlock } from '../../lock-unlock';
|
|
@@ -27,21 +28,40 @@ export const pagesRoute = {
|
|
|
27
28
|
name: 'pages',
|
|
28
29
|
path: '/page',
|
|
29
30
|
areas: {
|
|
30
|
-
sidebar
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
sidebar( { siteData } ) {
|
|
32
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
33
|
+
return isBlockTheme ? (
|
|
34
|
+
<SidebarNavigationScreen
|
|
35
|
+
title={ __( 'Pages' ) }
|
|
36
|
+
backPath="/"
|
|
37
|
+
content={ <DataViewsSidebarContent postType="page" /> }
|
|
38
|
+
/>
|
|
39
|
+
) : (
|
|
40
|
+
<SidebarNavigationScreenUnsupported />
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
content( { siteData } ) {
|
|
44
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
45
|
+
return isBlockTheme ? <PostList postType="page" /> : undefined;
|
|
46
|
+
},
|
|
47
|
+
preview( { query, siteData } ) {
|
|
48
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
49
|
+
if ( ! isBlockTheme ) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
39
52
|
const isListView =
|
|
40
53
|
( query.layout === 'list' || ! query.layout ) &&
|
|
41
54
|
query.isCustom !== 'true';
|
|
42
55
|
return isListView ? <Editor /> : undefined;
|
|
43
56
|
},
|
|
44
|
-
mobile
|
|
57
|
+
mobile( { siteData } ) {
|
|
58
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
59
|
+
return isBlockTheme ? (
|
|
60
|
+
<MobilePagesView />
|
|
61
|
+
) : (
|
|
62
|
+
<SidebarNavigationScreenUnsupported />
|
|
63
|
+
);
|
|
64
|
+
},
|
|
45
65
|
edit( { query } ) {
|
|
46
66
|
const hasQuickEdit =
|
|
47
67
|
( query.layout ?? 'list' ) !== 'list' && !! query.quickEdit;
|
|
@@ -3,12 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import Editor from '../editor';
|
|
5
5
|
import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
|
|
6
|
+
import { isClassicThemeWithStyleBookSupport } from './utils';
|
|
6
7
|
|
|
7
8
|
export const patternItemRoute = {
|
|
8
9
|
name: 'pattern-item',
|
|
9
10
|
path: '/wp_block/:postId',
|
|
10
11
|
areas: {
|
|
11
|
-
sidebar
|
|
12
|
+
sidebar( { siteData } ) {
|
|
13
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
14
|
+
const backPath =
|
|
15
|
+
isBlockTheme || isClassicThemeWithStyleBookSupport( siteData )
|
|
16
|
+
? '/'
|
|
17
|
+
: undefined;
|
|
18
|
+
return <SidebarNavigationScreenPatterns backPath={ backPath } />;
|
|
19
|
+
},
|
|
12
20
|
mobile: <Editor />,
|
|
13
21
|
preview: <Editor />,
|
|
14
22
|
},
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
4
|
import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
|
|
10
5
|
import PagePatterns from '../page-patterns';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const { useLocation } = unlock( routerPrivateApis );
|
|
14
|
-
|
|
15
|
-
function MobilePatternsView() {
|
|
16
|
-
const { query = {} } = useLocation();
|
|
17
|
-
const { categoryId } = query;
|
|
18
|
-
|
|
19
|
-
return !! categoryId ? (
|
|
20
|
-
<PagePatterns />
|
|
21
|
-
) : (
|
|
22
|
-
<SidebarNavigationScreenPatterns backPath="/" />
|
|
23
|
-
);
|
|
24
|
-
}
|
|
6
|
+
import { isClassicThemeWithStyleBookSupport } from './utils';
|
|
25
7
|
|
|
26
8
|
export const patternsRoute = {
|
|
27
9
|
name: 'patterns',
|
|
28
10
|
path: '/pattern',
|
|
29
11
|
areas: {
|
|
30
|
-
sidebar
|
|
12
|
+
sidebar( { siteData } ) {
|
|
13
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
14
|
+
const backPath =
|
|
15
|
+
isBlockTheme || isClassicThemeWithStyleBookSupport( siteData )
|
|
16
|
+
? '/'
|
|
17
|
+
: undefined;
|
|
18
|
+
return <SidebarNavigationScreenPatterns backPath={ backPath } />;
|
|
19
|
+
},
|
|
31
20
|
content: <PagePatterns />,
|
|
32
|
-
mobile
|
|
21
|
+
mobile( { siteData, query } ) {
|
|
22
|
+
const { categoryId } = query;
|
|
23
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
24
|
+
const backPath =
|
|
25
|
+
isBlockTheme || isClassicThemeWithStyleBookSupport( siteData )
|
|
26
|
+
? '/'
|
|
27
|
+
: undefined;
|
|
28
|
+
return !! categoryId ? (
|
|
29
|
+
<PagePatterns />
|
|
30
|
+
) : (
|
|
31
|
+
<SidebarNavigationScreenPatterns backPath={ backPath } />
|
|
32
|
+
);
|
|
33
|
+
},
|
|
33
34
|
},
|
|
34
35
|
};
|
|
@@ -7,22 +7,36 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
10
|
+
import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
|
|
10
11
|
import { StyleBookPreview } from '../style-book';
|
|
12
|
+
import { isClassicThemeWithStyleBookSupport } from './utils';
|
|
11
13
|
|
|
12
14
|
export const stylebookRoute = {
|
|
13
15
|
name: 'stylebook',
|
|
14
16
|
path: '/stylebook',
|
|
15
17
|
areas: {
|
|
16
|
-
sidebar
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
sidebar( { siteData } ) {
|
|
19
|
+
return isClassicThemeWithStyleBookSupport( siteData ) ? (
|
|
20
|
+
<SidebarNavigationScreen
|
|
21
|
+
title={ __( 'Styles' ) }
|
|
22
|
+
backPath="/"
|
|
23
|
+
description={ __(
|
|
24
|
+
`Preview your website's visual identity: colors, typography, and blocks.`
|
|
25
|
+
) }
|
|
26
|
+
/>
|
|
27
|
+
) : (
|
|
28
|
+
<SidebarNavigationScreenUnsupported />
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
preview( { siteData } ) {
|
|
32
|
+
return isClassicThemeWithStyleBookSupport( siteData ) ? (
|
|
33
|
+
<StyleBookPreview isStatic />
|
|
34
|
+
) : undefined;
|
|
35
|
+
},
|
|
36
|
+
mobile( { siteData } ) {
|
|
37
|
+
return isClassicThemeWithStyleBookSupport( siteData ) ? (
|
|
38
|
+
<StyleBookPreview isStatic />
|
|
39
|
+
) : undefined;
|
|
40
|
+
},
|
|
27
41
|
},
|
|
28
42
|
};
|
|
@@ -3,13 +3,35 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import Editor from '../editor';
|
|
5
5
|
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
6
|
+
import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
|
|
6
7
|
|
|
7
8
|
export const templateItemRoute = {
|
|
8
9
|
name: 'template-item',
|
|
9
10
|
path: '/wp_template/*postId',
|
|
10
11
|
areas: {
|
|
11
|
-
sidebar
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
sidebar( { siteData } ) {
|
|
13
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
14
|
+
return isBlockTheme ? (
|
|
15
|
+
<SidebarNavigationScreenTemplatesBrowse backPath="/" />
|
|
16
|
+
) : (
|
|
17
|
+
<SidebarNavigationScreenUnsupported />
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
mobile( { siteData } ) {
|
|
21
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
22
|
+
return isBlockTheme ? (
|
|
23
|
+
<Editor />
|
|
24
|
+
) : (
|
|
25
|
+
<SidebarNavigationScreenUnsupported />
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
preview( { siteData } ) {
|
|
29
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
30
|
+
return isBlockTheme ? (
|
|
31
|
+
<Editor />
|
|
32
|
+
) : (
|
|
33
|
+
<SidebarNavigationScreenUnsupported />
|
|
34
|
+
);
|
|
35
|
+
},
|
|
14
36
|
},
|
|
15
37
|
};
|
|
@@ -3,19 +3,41 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import Editor from '../editor';
|
|
5
5
|
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
6
|
+
import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
|
|
6
7
|
import PageTemplates from '../page-templates';
|
|
7
8
|
|
|
8
9
|
export const templatesRoute = {
|
|
9
10
|
name: 'templates',
|
|
10
11
|
path: '/template',
|
|
11
12
|
areas: {
|
|
12
|
-
sidebar
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
sidebar( { siteData } ) {
|
|
14
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
15
|
+
return isBlockTheme ? (
|
|
16
|
+
<SidebarNavigationScreenTemplatesBrowse backPath="/" />
|
|
17
|
+
) : (
|
|
18
|
+
<SidebarNavigationScreenUnsupported />
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
content( { siteData } ) {
|
|
22
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
23
|
+
return isBlockTheme ? <PageTemplates /> : undefined;
|
|
24
|
+
},
|
|
25
|
+
preview( { query, siteData } ) {
|
|
26
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
27
|
+
if ( ! isBlockTheme ) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
15
30
|
const isListView = query.layout === 'list';
|
|
16
31
|
return isListView ? <Editor /> : undefined;
|
|
17
32
|
},
|
|
18
|
-
mobile
|
|
33
|
+
mobile( { siteData } ) {
|
|
34
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
35
|
+
return isBlockTheme ? (
|
|
36
|
+
<PageTemplates />
|
|
37
|
+
) : (
|
|
38
|
+
<SidebarNavigationScreenUnsupported />
|
|
39
|
+
);
|
|
40
|
+
},
|
|
19
41
|
},
|
|
20
42
|
widths: {
|
|
21
43
|
content( { query } ) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the classic theme supports the stylebook.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} siteData - The site data provided by the site editor route area resolvers.
|
|
5
|
+
* @return {boolean} True if the stylebook is supported, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export function isClassicThemeWithStyleBookSupport( siteData ) {
|
|
8
|
+
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
9
|
+
const supportsEditorStyles =
|
|
10
|
+
siteData.currentTheme?.theme_supports[ 'editor-styles' ];
|
|
11
|
+
// This is a temp solution until the has_theme_json value is available for the current theme.
|
|
12
|
+
const hasThemeJson = siteData.editorSettings?.supportsLayout;
|
|
13
|
+
return ! isBlockTheme && ( supportsEditorStyles || hasThemeJson );
|
|
14
|
+
}
|
|
@@ -121,21 +121,65 @@ export const SiteHubMobile = memo(
|
|
|
121
121
|
const history = useHistory();
|
|
122
122
|
const { navigate } = useContext( SidebarNavigationContext );
|
|
123
123
|
|
|
124
|
-
const {
|
|
124
|
+
const {
|
|
125
|
+
dashboardLink,
|
|
126
|
+
homeUrl,
|
|
127
|
+
siteTitle,
|
|
128
|
+
isBlockTheme,
|
|
129
|
+
isClassicThemeWithStyleBookSupport,
|
|
130
|
+
} = useSelect( ( select ) => {
|
|
125
131
|
const { getSettings } = unlock( select( editSiteStore ) );
|
|
126
|
-
const { getEntityRecord } = select( coreStore );
|
|
132
|
+
const { getEntityRecord, getCurrentTheme } = select( coreStore );
|
|
127
133
|
const _site = getEntityRecord( 'root', 'site' );
|
|
134
|
+
const currentTheme = getCurrentTheme();
|
|
135
|
+
const settings = getSettings();
|
|
136
|
+
const supportsEditorStyles =
|
|
137
|
+
currentTheme.theme_supports[ 'editor-styles' ];
|
|
138
|
+
// This is a temp solution until the has_theme_json value is available for the current theme.
|
|
139
|
+
const hasThemeJson = settings.supportsLayout;
|
|
140
|
+
|
|
128
141
|
return {
|
|
129
|
-
dashboardLink:
|
|
142
|
+
dashboardLink: settings.__experimentalDashboardLink,
|
|
130
143
|
homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
|
|
131
144
|
siteTitle:
|
|
132
145
|
! _site?.title && !! _site?.url
|
|
133
146
|
? filterURLForDisplay( _site?.url )
|
|
134
147
|
: _site?.title,
|
|
148
|
+
isBlockTheme: currentTheme?.is_block_theme,
|
|
149
|
+
isClassicThemeWithStyleBookSupport:
|
|
150
|
+
! currentTheme?.is_block_theme &&
|
|
151
|
+
( supportsEditorStyles || hasThemeJson ),
|
|
135
152
|
};
|
|
136
153
|
}, [] );
|
|
137
154
|
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
138
|
-
|
|
155
|
+
|
|
156
|
+
let backPath;
|
|
157
|
+
|
|
158
|
+
// If the current path is not the root page, find a page to back to.
|
|
159
|
+
if ( path !== '/' ) {
|
|
160
|
+
if ( isBlockTheme || isClassicThemeWithStyleBookSupport ) {
|
|
161
|
+
// If the current theme is a block theme or a classic theme that supports StyleBook,
|
|
162
|
+
// back to the Design screen.
|
|
163
|
+
backPath = '/';
|
|
164
|
+
} else if ( path !== '/pattern' ) {
|
|
165
|
+
// If the current theme is a classic theme that does not support StyleBook,
|
|
166
|
+
// back to the Patterns page.
|
|
167
|
+
backPath = '/pattern';
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const backButtonProps = {
|
|
172
|
+
href: !! backPath ? undefined : dashboardLink,
|
|
173
|
+
label: !! backPath
|
|
174
|
+
? __( 'Go to Site Editor' )
|
|
175
|
+
: __( 'Go to the Dashboard' ),
|
|
176
|
+
onClick: !! backPath
|
|
177
|
+
? () => {
|
|
178
|
+
history.navigate( backPath );
|
|
179
|
+
navigate( 'back' );
|
|
180
|
+
}
|
|
181
|
+
: undefined,
|
|
182
|
+
};
|
|
139
183
|
|
|
140
184
|
return (
|
|
141
185
|
<div className="edit-site-site-hub">
|
|
@@ -156,18 +200,7 @@ export const SiteHubMobile = memo(
|
|
|
156
200
|
transform: 'scale(0.5)',
|
|
157
201
|
borderRadius: 4,
|
|
158
202
|
} }
|
|
159
|
-
{ ...
|
|
160
|
-
? {
|
|
161
|
-
href: dashboardLink,
|
|
162
|
-
label: __( 'Go to the Dashboard' ),
|
|
163
|
-
}
|
|
164
|
-
: {
|
|
165
|
-
onClick: () => {
|
|
166
|
-
history.navigate( '/' );
|
|
167
|
-
navigate( 'back' );
|
|
168
|
-
},
|
|
169
|
-
label: __( 'Go to Site Editor' ),
|
|
170
|
-
} ) }
|
|
203
|
+
{ ...backButtonProps }
|
|
171
204
|
>
|
|
172
205
|
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
173
206
|
</Button>
|