@wordpress/edit-site 6.2.0 → 6.3.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 → add-new-post}/index.js +21 -17
- package/build/components/add-new-post/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +5 -3
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +21 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +0 -5
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -40
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +47 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block.js +14 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +5 -1
- package/build/components/global-styles/screen-layout.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 -2
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +0 -2
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +4 -4
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +4 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +14 -28
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -2
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +20 -41
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/index.js +43 -39
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +29 -4
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +22 -55
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +18 -19
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +4 -4
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +11 -17
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/{page-pages/index.js → posts-app/posts-list.js} +135 -40
- package/build/components/posts-app/posts-list.js.map +1 -0
- package/build/components/posts-app/router.js +85 -0
- package/build/components/posts-app/router.js.map +1 -0
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +98 -84
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/site-hub/index.js +81 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -1
- 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 +65 -42
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +57 -2
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/{add-new-page → add-new-post}/index.js +21 -17
- package/build-module/components/add-new-post/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +21 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +0 -5
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -38
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +39 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +15 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +5 -1
- package/build-module/components/global-styles/screen-layout.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 -2
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +6 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +0 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +5 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +4 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +16 -29
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +14 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +20 -41
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/index.js +44 -40
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +28 -4
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -56
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +18 -19
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +4 -4
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +11 -17
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +134 -39
- package/build-module/components/posts-app/posts-list.js.map +1 -0
- package/build-module/components/posts-app/router.js +77 -0
- package/build-module/components/posts-app/router.js.map +1 -0
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +96 -83
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +5 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/site-hub/index.js +81 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
- 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 +61 -38
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +7 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +57 -2
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +108 -28
- package/build-style/posts.css +108 -28
- package/build-style/style-rtl.css +112 -144
- package/build-style/style.css +112 -144
- package/package.json +41 -41
- package/src/components/{add-new-page → add-new-post}/index.js +28 -22
- package/src/components/block-editor/use-site-editor-settings.js +33 -28
- package/src/components/editor/index.js +21 -5
- package/src/components/global-styles/background-panel.js +0 -8
- package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
- package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/src/components/global-styles/font-library-modal/style.scss +17 -10
- package/src/components/global-styles/hooks.js +0 -41
- package/src/components/global-styles/preview-typography.js +39 -0
- package/src/components/global-styles/screen-block.js +22 -0
- package/src/components/global-styles/screen-layout.js +5 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/shadows-edit-panel.js +1 -2
- package/src/components/global-styles/style-variations-container.js +10 -7
- package/src/components/global-styles/typography-elements.js +0 -4
- package/src/components/global-styles/variations/variation.js +5 -5
- package/src/components/global-styles/variations/variations-color.js +5 -3
- package/src/components/global-styles/variations/variations-typography.js +15 -32
- package/src/components/global-styles-sidebar/index.js +2 -2
- package/src/components/layout/index.js +13 -4
- package/src/components/layout/router.js +20 -36
- package/src/components/layout/style.scss +12 -0
- package/src/components/page-patterns/index.js +47 -56
- package/src/components/page-patterns/search-items.js +37 -3
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-patterns/use-patterns.js +43 -82
- package/src/components/page-templates/index.js +17 -19
- package/src/components/page-templates/style.scss +1 -6
- package/src/components/pagination/index.js +4 -4
- package/src/components/posts-app/index.js +9 -11
- package/src/components/{page-pages/index.js → posts-app/posts-list.js} +126 -39
- package/src/components/posts-app/router.js +69 -0
- package/src/components/{page-pages → posts-app}/style.scss +22 -8
- package/src/components/revisions/index.js +9 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/sidebar-dataviews/add-new-view.js +2 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/src/components/sidebar-dataviews/default-views.js +110 -97
- package/src/components/sidebar-dataviews/index.js +3 -3
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
- package/src/components/site-hub/index.js +84 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
- package/src/index.js +8 -1
- package/src/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +1 -2
- package/build/components/add-new-page/index.js.map +0 -1
- package/build/components/page-pages/index.js.map +0 -1
- package/build/components/table/index.js +0 -35
- package/build/components/table/index.js.map +0 -1
- package/build-module/components/add-new-page/index.js.map +0 -1
- package/build-module/components/page-pages/index.js.map +0 -1
- package/build-module/components/table/index.js +0 -30
- package/build-module/components/table/index.js.map +0 -1
- package/src/components/table/index.js +0 -33
- package/src/components/table/style.scss +0 -38
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalGrid as Grid,
|
|
6
|
-
__experimentalVStack as HStack,
|
|
7
6
|
__experimentalVStack as VStack,
|
|
8
7
|
} from '@wordpress/components';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
|
|
13
|
+
import StylesPreviewTypography from '../preview-typography';
|
|
14
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
16
15
|
import Variation from './variation';
|
|
17
16
|
import Subtitle from '../subtitle';
|
|
18
17
|
|
|
19
18
|
export default function TypographyVariations( { title, gap = 2 } ) {
|
|
20
|
-
const
|
|
19
|
+
const propertiesToFilter = [ 'typography' ];
|
|
20
|
+
const typographyVariations =
|
|
21
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( propertiesToFilter );
|
|
21
22
|
|
|
22
23
|
// Return null if there is only one variation (the default).
|
|
23
24
|
if ( typographyVariations?.length <= 1 ) {
|
|
@@ -32,40 +33,22 @@ export default function TypographyVariations( { title, gap = 2 } ) {
|
|
|
32
33
|
gap={ gap }
|
|
33
34
|
className="edit-site-global-styles-style-variations-container"
|
|
34
35
|
>
|
|
35
|
-
{ typographyVariations
|
|
36
|
-
|
|
37
|
-
typographyVariations.map( ( variation, index ) => (
|
|
36
|
+
{ typographyVariations.map( ( variation, index ) => {
|
|
37
|
+
return (
|
|
38
38
|
<Variation
|
|
39
39
|
key={ index }
|
|
40
40
|
variation={ variation }
|
|
41
|
-
|
|
41
|
+
properties={ propertiesToFilter }
|
|
42
42
|
showTooltip
|
|
43
43
|
>
|
|
44
|
-
{ (
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
{ ( { ratio, key } ) => (
|
|
50
|
-
<HStack
|
|
51
|
-
key={ key }
|
|
52
|
-
spacing={ 10 * ratio }
|
|
53
|
-
justify="center"
|
|
54
|
-
style={ {
|
|
55
|
-
height: '100%',
|
|
56
|
-
overflow: 'hidden',
|
|
57
|
-
} }
|
|
58
|
-
>
|
|
59
|
-
<TypographyExample
|
|
60
|
-
variation={ variation }
|
|
61
|
-
fontSize={ 85 * ratio }
|
|
62
|
-
/>
|
|
63
|
-
</HStack>
|
|
64
|
-
) }
|
|
65
|
-
</PreviewIframe>
|
|
44
|
+
{ () => (
|
|
45
|
+
<StylesPreviewTypography
|
|
46
|
+
variation={ variation }
|
|
47
|
+
/>
|
|
66
48
|
) }
|
|
67
49
|
</Variation>
|
|
68
|
-
)
|
|
50
|
+
);
|
|
51
|
+
} ) }
|
|
69
52
|
</Grid>
|
|
70
53
|
</VStack>
|
|
71
54
|
);
|
|
@@ -152,7 +152,7 @@ export default function GlobalStylesSidebar() {
|
|
|
152
152
|
isPressed={
|
|
153
153
|
isStyleBookOpened || isRevisionsStyleBookOpened
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
accessibleWhenDisabled
|
|
156
156
|
disabled={ shouldClearCanvasContainerView }
|
|
157
157
|
onClick={ toggleStyleBook }
|
|
158
158
|
size="compact"
|
|
@@ -163,7 +163,7 @@ export default function GlobalStylesSidebar() {
|
|
|
163
163
|
label={ __( 'Revisions' ) }
|
|
164
164
|
icon={ backup }
|
|
165
165
|
onClick={ toggleRevisions }
|
|
166
|
-
|
|
166
|
+
accessibleWhenDisabled
|
|
167
167
|
disabled={ ! hasRevisions }
|
|
168
168
|
isPressed={
|
|
169
169
|
isRevisionsOpened || isRevisionsStyleBookOpened
|
|
@@ -34,16 +34,16 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
|
|
|
34
34
|
*/
|
|
35
35
|
import ErrorBoundary from '../error-boundary';
|
|
36
36
|
import { store as editSiteStore } from '../../store';
|
|
37
|
-
import SiteHub from '../site-hub';
|
|
37
|
+
import { default as SiteHub, SiteHubMobile } from '../site-hub';
|
|
38
38
|
import ResizableFrame from '../resizable-frame';
|
|
39
39
|
import { unlock } from '../../lock-unlock';
|
|
40
|
-
import SavePanel from '../save-panel';
|
|
41
40
|
import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
|
|
42
41
|
import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
|
|
43
42
|
import { useIsSiteEditorLoading } from './hooks';
|
|
44
43
|
import useMovingAnimation from './animation';
|
|
45
44
|
import SidebarContent from '../sidebar';
|
|
46
45
|
import SaveHub from '../save-hub';
|
|
46
|
+
import SavePanel from '../save-panel';
|
|
47
47
|
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
|
|
48
48
|
|
|
49
49
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
@@ -163,6 +163,7 @@ export default function Layout( { route } ) {
|
|
|
163
163
|
{ areas.sidebar }
|
|
164
164
|
</SidebarContent>
|
|
165
165
|
<SaveHub />
|
|
166
|
+
<SavePanel />
|
|
166
167
|
</motion.div>
|
|
167
168
|
) }
|
|
168
169
|
</AnimatePresence>
|
|
@@ -173,6 +174,16 @@ export default function Layout( { route } ) {
|
|
|
173
174
|
|
|
174
175
|
{ isMobileViewport && areas.mobile && (
|
|
175
176
|
<div className="edit-site-layout__mobile">
|
|
177
|
+
{ canvasMode !== 'edit' && (
|
|
178
|
+
<SidebarContent routeKey={ routeKey }>
|
|
179
|
+
<SiteHubMobile
|
|
180
|
+
ref={ toggleRef }
|
|
181
|
+
isTransparent={
|
|
182
|
+
isResizableFrameOversized
|
|
183
|
+
}
|
|
184
|
+
/>
|
|
185
|
+
</SidebarContent>
|
|
186
|
+
) }
|
|
176
187
|
{ areas.mobile }
|
|
177
188
|
</div>
|
|
178
189
|
) }
|
|
@@ -236,8 +247,6 @@ export default function Layout( { route } ) {
|
|
|
236
247
|
</div>
|
|
237
248
|
) }
|
|
238
249
|
</div>
|
|
239
|
-
|
|
240
|
-
<SavePanel />
|
|
241
250
|
</div>
|
|
242
251
|
</>
|
|
243
252
|
);
|
|
@@ -8,9 +8,8 @@ import { useEffect } from '@wordpress/element';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { unlock } from '../../lock-unlock';
|
|
11
|
-
import { useIsSiteEditorLoading } from './hooks';
|
|
12
11
|
import Editor from '../editor';
|
|
13
|
-
import
|
|
12
|
+
import PostsList from '../posts-app/posts-list';
|
|
14
13
|
import PagePatterns from '../page-patterns';
|
|
15
14
|
import PageTemplates from '../page-templates';
|
|
16
15
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
@@ -74,9 +73,9 @@ function useRedirectOldPaths() {
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
export default function useLayoutAreas() {
|
|
77
|
-
const isSiteEditorLoading = useIsSiteEditorLoading();
|
|
78
76
|
const { params } = useLocation();
|
|
79
77
|
const { postType, postId, path, layout, isCustom, canvas } = params;
|
|
78
|
+
const hasEditCanvasMode = canvas === 'edit';
|
|
80
79
|
useRedirectOldPaths();
|
|
81
80
|
|
|
82
81
|
// Page list
|
|
@@ -92,16 +91,13 @@ export default function useLayoutAreas() {
|
|
|
92
91
|
content={ <DataViewsSidebarContent /> }
|
|
93
92
|
/>
|
|
94
93
|
),
|
|
95
|
-
content: <
|
|
96
|
-
preview: ( isListLayout ||
|
|
97
|
-
|
|
94
|
+
content: <PostsList postType={ postType } />,
|
|
95
|
+
preview: ( isListLayout || hasEditCanvasMode ) && <Editor />,
|
|
96
|
+
mobile: hasEditCanvasMode ? (
|
|
97
|
+
<Editor />
|
|
98
|
+
) : (
|
|
99
|
+
<PostsList postType={ postType } />
|
|
98
100
|
),
|
|
99
|
-
mobile:
|
|
100
|
-
canvas === 'edit' ? (
|
|
101
|
-
<Editor isLoading={ isSiteEditorLoading } />
|
|
102
|
-
) : (
|
|
103
|
-
<PagePages />
|
|
104
|
-
),
|
|
105
101
|
},
|
|
106
102
|
widths: {
|
|
107
103
|
content: isListLayout ? 380 : undefined,
|
|
@@ -119,10 +115,8 @@ export default function useLayoutAreas() {
|
|
|
119
115
|
<SidebarNavigationScreenTemplatesBrowse backPath={ {} } />
|
|
120
116
|
),
|
|
121
117
|
content: <PageTemplates />,
|
|
122
|
-
preview: ( isListLayout ||
|
|
123
|
-
|
|
124
|
-
),
|
|
125
|
-
mobile: <PageTemplates />,
|
|
118
|
+
preview: ( isListLayout || hasEditCanvasMode ) && <Editor />,
|
|
119
|
+
mobile: hasEditCanvasMode ? <Editor /> : <PageTemplates />,
|
|
126
120
|
},
|
|
127
121
|
widths: {
|
|
128
122
|
content: isListLayout ? 380 : undefined,
|
|
@@ -139,10 +133,8 @@ export default function useLayoutAreas() {
|
|
|
139
133
|
areas: {
|
|
140
134
|
sidebar: <SidebarNavigationScreenPatterns backPath={ {} } />,
|
|
141
135
|
content: <PagePatterns />,
|
|
142
|
-
mobile: <PagePatterns />,
|
|
143
|
-
preview:
|
|
144
|
-
<Editor isLoading={ isSiteEditorLoading } />
|
|
145
|
-
),
|
|
136
|
+
mobile: hasEditCanvasMode ? <Editor /> : <PagePatterns />,
|
|
137
|
+
preview: hasEditCanvasMode && <Editor />,
|
|
146
138
|
},
|
|
147
139
|
};
|
|
148
140
|
}
|
|
@@ -155,10 +147,8 @@ export default function useLayoutAreas() {
|
|
|
155
147
|
sidebar: (
|
|
156
148
|
<SidebarNavigationScreenGlobalStyles backPath={ {} } />
|
|
157
149
|
),
|
|
158
|
-
preview: <Editor
|
|
159
|
-
mobile:
|
|
160
|
-
<Editor isLoading={ isSiteEditorLoading } />
|
|
161
|
-
),
|
|
150
|
+
preview: <Editor />,
|
|
151
|
+
mobile: hasEditCanvasMode && <Editor />,
|
|
162
152
|
},
|
|
163
153
|
};
|
|
164
154
|
}
|
|
@@ -174,10 +164,8 @@ export default function useLayoutAreas() {
|
|
|
174
164
|
backPath={ { postType: NAVIGATION_POST_TYPE } }
|
|
175
165
|
/>
|
|
176
166
|
),
|
|
177
|
-
preview: <Editor
|
|
178
|
-
mobile:
|
|
179
|
-
<Editor isLoading={ isSiteEditorLoading } />
|
|
180
|
-
),
|
|
167
|
+
preview: <Editor />,
|
|
168
|
+
mobile: hasEditCanvasMode && <Editor />,
|
|
181
169
|
},
|
|
182
170
|
};
|
|
183
171
|
}
|
|
@@ -187,10 +175,8 @@ export default function useLayoutAreas() {
|
|
|
187
175
|
sidebar: (
|
|
188
176
|
<SidebarNavigationScreenNavigationMenus backPath={ {} } />
|
|
189
177
|
),
|
|
190
|
-
preview: <Editor
|
|
191
|
-
mobile:
|
|
192
|
-
<Editor isLoading={ isSiteEditorLoading } />
|
|
193
|
-
),
|
|
178
|
+
preview: <Editor />,
|
|
179
|
+
mobile: hasEditCanvasMode && <Editor />,
|
|
194
180
|
},
|
|
195
181
|
};
|
|
196
182
|
}
|
|
@@ -200,10 +186,8 @@ export default function useLayoutAreas() {
|
|
|
200
186
|
key: 'default',
|
|
201
187
|
areas: {
|
|
202
188
|
sidebar: <SidebarNavigationScreenMain />,
|
|
203
|
-
preview: <Editor
|
|
204
|
-
mobile:
|
|
205
|
-
<Editor isLoading={ isSiteEditorLoading } />
|
|
206
|
-
),
|
|
189
|
+
preview: <Editor />,
|
|
190
|
+
mobile: hasEditCanvasMode && <Editor />,
|
|
207
191
|
},
|
|
208
192
|
};
|
|
209
193
|
}
|
|
@@ -56,6 +56,18 @@
|
|
|
56
56
|
position: relative;
|
|
57
57
|
width: 100%;
|
|
58
58
|
z-index: z-index(".edit-site-layout__canvas-container");
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* The SiteHubMobile component is displayed
|
|
62
|
+
* for pages that do not have a sidebar,
|
|
63
|
+
* yet it needs the Sidebar component for the React context.
|
|
64
|
+
*
|
|
65
|
+
* This removes the padding in this scenario.
|
|
66
|
+
* See https://github.com/WordPress/gutenberg/pull/63118
|
|
67
|
+
*/
|
|
68
|
+
.edit-site-sidebar__screen-wrapper {
|
|
69
|
+
padding: 0;
|
|
70
|
+
}
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
.edit-site-layout__canvas-container {
|
|
@@ -13,13 +13,7 @@ import {
|
|
|
13
13
|
Flex,
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
import { __, _x } from '@wordpress/i18n';
|
|
16
|
-
import {
|
|
17
|
-
useState,
|
|
18
|
-
useMemo,
|
|
19
|
-
useCallback,
|
|
20
|
-
useId,
|
|
21
|
-
useEffect,
|
|
22
|
-
} from '@wordpress/element';
|
|
16
|
+
import { useState, useMemo, useId, useEffect } from '@wordpress/element';
|
|
23
17
|
import {
|
|
24
18
|
BlockPreview,
|
|
25
19
|
privateApis as blockEditorPrivateApis,
|
|
@@ -30,6 +24,8 @@ import { usePrevious } from '@wordpress/compose';
|
|
|
30
24
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
31
25
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
32
26
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
27
|
+
import { parse } from '@wordpress/blocks';
|
|
28
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
33
29
|
|
|
34
30
|
/**
|
|
35
31
|
* Internal dependencies
|
|
@@ -53,6 +49,7 @@ import PatternsHeader from './header';
|
|
|
53
49
|
import { useLink } from '../routes/link';
|
|
54
50
|
import { useAddedBy } from '../page-templates/hooks';
|
|
55
51
|
import { useEditPostAction } from '../dataviews-actions';
|
|
52
|
+
import { defaultGetTitle } from './search-items';
|
|
56
53
|
|
|
57
54
|
const { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(
|
|
58
55
|
blockEditorPrivateApis
|
|
@@ -61,14 +58,18 @@ const { usePostActions } = unlock( editorPrivateApis );
|
|
|
61
58
|
const { useLocation } = unlock( routerPrivateApis );
|
|
62
59
|
|
|
63
60
|
const EMPTY_ARRAY = [];
|
|
64
|
-
const
|
|
61
|
+
const defaultLayouts = {
|
|
65
62
|
[ LAYOUT_TABLE ]: {
|
|
66
|
-
|
|
63
|
+
layout: {
|
|
64
|
+
primaryField: 'title',
|
|
65
|
+
},
|
|
67
66
|
},
|
|
68
67
|
[ LAYOUT_GRID ]: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
layout: {
|
|
69
|
+
mediaField: 'preview',
|
|
70
|
+
primaryField: 'title',
|
|
71
|
+
badgeFields: [ 'sync-status' ],
|
|
72
|
+
},
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
75
|
const DEFAULT_VIEW = {
|
|
@@ -76,10 +77,8 @@ const DEFAULT_VIEW = {
|
|
|
76
77
|
search: '',
|
|
77
78
|
page: 1,
|
|
78
79
|
perPage: 20,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
...defaultConfigPerViewType[ LAYOUT_GRID ],
|
|
82
|
-
},
|
|
80
|
+
layout: defaultLayouts[ LAYOUT_GRID ].layout,
|
|
81
|
+
fields: [ 'title', 'sync-status' ],
|
|
83
82
|
filters: [],
|
|
84
83
|
};
|
|
85
84
|
|
|
@@ -115,16 +114,24 @@ function PreviewWrapper( { item, onClick, ariaDescribedBy, children } ) {
|
|
|
115
114
|
|
|
116
115
|
function Preview( { item, viewType } ) {
|
|
117
116
|
const descriptionId = useId();
|
|
117
|
+
const description = item.description || item?.excerpt?.raw;
|
|
118
118
|
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
119
119
|
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
120
|
-
const isEmpty = ! item.blocks?.length;
|
|
121
|
-
|
|
122
120
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
123
121
|
const { onClick } = useLink( {
|
|
124
122
|
postType: item.type,
|
|
125
|
-
postId: isUserPattern ? item.id : item.name,
|
|
123
|
+
postId: isUserPattern || isTemplatePart ? item.id : item.name,
|
|
126
124
|
canvas: 'edit',
|
|
127
125
|
} );
|
|
126
|
+
const blocks = useMemo( () => {
|
|
127
|
+
return (
|
|
128
|
+
item.blocks ??
|
|
129
|
+
parse( item.content.raw, {
|
|
130
|
+
__unstableSkipMigrationLogs: true,
|
|
131
|
+
} )
|
|
132
|
+
);
|
|
133
|
+
}, [ item?.content?.raw, item.blocks ] );
|
|
134
|
+
const isEmpty = ! blocks?.length;
|
|
128
135
|
|
|
129
136
|
return (
|
|
130
137
|
<div
|
|
@@ -134,22 +141,22 @@ function Preview( { item, viewType } ) {
|
|
|
134
141
|
<PreviewWrapper
|
|
135
142
|
item={ item }
|
|
136
143
|
onClick={ onClick }
|
|
137
|
-
ariaDescribedBy={
|
|
144
|
+
ariaDescribedBy={ !! description ? descriptionId : undefined }
|
|
138
145
|
>
|
|
139
146
|
{ isEmpty && isTemplatePart && __( 'Empty template part' ) }
|
|
140
147
|
{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }
|
|
141
148
|
{ ! isEmpty && (
|
|
142
149
|
<Async>
|
|
143
150
|
<BlockPreview
|
|
144
|
-
blocks={
|
|
151
|
+
blocks={ blocks }
|
|
145
152
|
viewportWidth={ item.viewportWidth }
|
|
146
153
|
/>
|
|
147
154
|
</Async>
|
|
148
155
|
) }
|
|
149
156
|
</PreviewWrapper>
|
|
150
|
-
{
|
|
157
|
+
{ !! description && (
|
|
151
158
|
<div hidden id={ descriptionId }>
|
|
152
|
-
{
|
|
159
|
+
{ description }
|
|
153
160
|
</div>
|
|
154
161
|
) }
|
|
155
162
|
</div>
|
|
@@ -188,11 +195,13 @@ function Author( { item, viewType } ) {
|
|
|
188
195
|
|
|
189
196
|
function Title( { item } ) {
|
|
190
197
|
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
198
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
191
199
|
const { onClick } = useLink( {
|
|
192
200
|
postType: item.type,
|
|
193
|
-
postId: isUserPattern ? item.id : item.name,
|
|
201
|
+
postId: isUserPattern || isTemplatePart ? item.id : item.name,
|
|
194
202
|
canvas: 'edit',
|
|
195
203
|
} );
|
|
204
|
+
const title = decodeEntities( defaultGetTitle( item ) );
|
|
196
205
|
return (
|
|
197
206
|
<HStack alignment="center" justify="flex-start" spacing={ 2 }>
|
|
198
207
|
<Flex
|
|
@@ -202,7 +211,7 @@ function Title( { item } ) {
|
|
|
202
211
|
className="edit-site-patterns__pattern-title"
|
|
203
212
|
>
|
|
204
213
|
{ item.type === PATTERN_TYPES.theme ? (
|
|
205
|
-
|
|
214
|
+
title
|
|
206
215
|
) : (
|
|
207
216
|
<Button
|
|
208
217
|
variant="link"
|
|
@@ -211,7 +220,7 @@ function Title( { item } ) {
|
|
|
211
220
|
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
|
|
212
221
|
tabIndex="-1"
|
|
213
222
|
>
|
|
214
|
-
{
|
|
223
|
+
{ title }
|
|
215
224
|
</Button>
|
|
216
225
|
) }
|
|
217
226
|
</Flex>
|
|
@@ -273,7 +282,6 @@ export default function DataviewsPatterns() {
|
|
|
273
282
|
<Preview item={ item } viewType={ view.type } />
|
|
274
283
|
),
|
|
275
284
|
enableSorting: false,
|
|
276
|
-
enableHiding: false,
|
|
277
285
|
width: '1%',
|
|
278
286
|
},
|
|
279
287
|
{
|
|
@@ -289,23 +297,20 @@ export default function DataviewsPatterns() {
|
|
|
289
297
|
header: __( 'Sync status' ),
|
|
290
298
|
id: 'sync-status',
|
|
291
299
|
render: ( { item } ) => {
|
|
300
|
+
const syncStatus =
|
|
301
|
+
'wp_pattern_sync_status' in item
|
|
302
|
+
? item.wp_pattern_sync_status ||
|
|
303
|
+
PATTERN_SYNC_TYPES.full
|
|
304
|
+
: PATTERN_SYNC_TYPES.unsynced;
|
|
292
305
|
// User patterns can have their sync statuses checked directly.
|
|
293
306
|
// Non-user patterns are all unsynced for the time being.
|
|
294
307
|
return (
|
|
295
308
|
<span
|
|
296
|
-
className={ `edit-site-patterns__field-sync-status-${
|
|
309
|
+
className={ `edit-site-patterns__field-sync-status-${ syncStatus }` }
|
|
297
310
|
>
|
|
298
311
|
{
|
|
299
|
-
(
|
|
300
|
-
|
|
301
|
-
( { value } ) =>
|
|
302
|
-
value === item.syncStatus
|
|
303
|
-
) ||
|
|
304
|
-
SYNC_FILTERS.find(
|
|
305
|
-
( { value } ) =>
|
|
306
|
-
value ===
|
|
307
|
-
PATTERN_SYNC_TYPES.unsynced
|
|
308
|
-
)
|
|
312
|
+
SYNC_FILTERS.find(
|
|
313
|
+
( { value } ) => value === syncStatus
|
|
309
314
|
).label
|
|
310
315
|
}
|
|
311
316
|
</span>
|
|
@@ -322,7 +327,7 @@ export default function DataviewsPatterns() {
|
|
|
322
327
|
_fields.push( {
|
|
323
328
|
header: __( 'Author' ),
|
|
324
329
|
id: 'author',
|
|
325
|
-
getValue: ( { item } ) => item.
|
|
330
|
+
getValue: ( { item } ) => item.author_text,
|
|
326
331
|
render: ( { item } ) => {
|
|
327
332
|
return <Author viewType={ view.type } item={ item } />;
|
|
328
333
|
},
|
|
@@ -370,20 +375,6 @@ export default function DataviewsPatterns() {
|
|
|
370
375
|
}
|
|
371
376
|
return [ editAction, ...patternActions ].filter( Boolean );
|
|
372
377
|
}, [ editAction, type, templatePartActions, patternActions ] );
|
|
373
|
-
const onChangeView = useCallback(
|
|
374
|
-
( newView ) => {
|
|
375
|
-
if ( newView.type !== view.type ) {
|
|
376
|
-
newView = {
|
|
377
|
-
...newView,
|
|
378
|
-
layout: {
|
|
379
|
-
...defaultConfigPerViewType[ newView.type ],
|
|
380
|
-
},
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
setView( newView );
|
|
384
|
-
},
|
|
385
|
-
[ view.type, setView ]
|
|
386
|
-
);
|
|
387
378
|
const id = useId();
|
|
388
379
|
const settings = usePatternSettings();
|
|
389
380
|
// Wrap everything in a block editor provider.
|
|
@@ -407,11 +398,11 @@ export default function DataviewsPatterns() {
|
|
|
407
398
|
fields={ fields }
|
|
408
399
|
actions={ actions }
|
|
409
400
|
data={ data || EMPTY_ARRAY }
|
|
410
|
-
getItemId={ ( item ) => item.name }
|
|
401
|
+
getItemId={ ( item ) => item.name ?? item.id }
|
|
411
402
|
isLoading={ isResolving }
|
|
412
403
|
view={ view }
|
|
413
|
-
onChangeView={
|
|
414
|
-
|
|
404
|
+
onChangeView={ setView }
|
|
405
|
+
defaultLayouts={ defaultLayouts }
|
|
415
406
|
/>
|
|
416
407
|
</Page>
|
|
417
408
|
</ExperimentalBlockEditorProvider>
|
|
@@ -20,12 +20,46 @@ import {
|
|
|
20
20
|
PATTERN_DEFAULT_CATEGORY,
|
|
21
21
|
PATTERN_USER_CATEGORY,
|
|
22
22
|
PATTERN_TYPES,
|
|
23
|
+
TEMPLATE_PART_POST_TYPE,
|
|
23
24
|
} from '../../utils/constants';
|
|
24
25
|
|
|
25
26
|
// Default search helpers.
|
|
26
|
-
const defaultGetName = ( item ) =>
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const defaultGetName = ( item ) => {
|
|
28
|
+
if ( item.type === PATTERN_TYPES.user ) {
|
|
29
|
+
return item.slug;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ( item.type === TEMPLATE_PART_POST_TYPE ) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return item.name || '';
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const defaultGetTitle = ( item ) => {
|
|
40
|
+
if ( typeof item.title === 'string' ) {
|
|
41
|
+
return item.title;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if ( item.title && item.title.rendered ) {
|
|
45
|
+
return item.title.rendered;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if ( item.title && item.title.raw ) {
|
|
49
|
+
return item.title.raw;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return '';
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const defaultGetDescription = ( item ) => {
|
|
56
|
+
if ( item.type === PATTERN_TYPES.user ) {
|
|
57
|
+
return item.excerpt.raw;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return item.description || '';
|
|
61
|
+
};
|
|
62
|
+
|
|
29
63
|
const defaultGetKeywords = ( item ) => item.keywords || [];
|
|
30
64
|
const defaultHasCategory = () => false;
|
|
31
65
|
|
|
@@ -35,13 +35,6 @@
|
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
height: 100%;
|
|
38
|
-
border-radius: 3px 3px 0 0;
|
|
39
|
-
|
|
40
|
-
&.is-viewtype-grid {
|
|
41
|
-
.block-editor-block-preview__container {
|
|
42
|
-
border-radius: 3px 3px 0 0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
38
|
|
|
46
39
|
&.is-viewtype-table {
|
|
47
40
|
width: 96px;
|
|
@@ -62,7 +55,7 @@
|
|
|
62
55
|
cursor: pointer;
|
|
63
56
|
overflow: hidden;
|
|
64
57
|
height: 100%;
|
|
65
|
-
border-radius:
|
|
58
|
+
border-radius: $grid-unit-05;
|
|
66
59
|
|
|
67
60
|
&:focus-visible {
|
|
68
61
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|