@wordpress/edit-site 5.7.0 → 5.9.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 +4 -0
- package/build/components/add-new-template/new-template.js +2 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +7 -7
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +6 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +117 -0
- package/build/components/editor-canvas-container/index.js.map +1 -0
- package/build/components/global-styles/border-panel.js +81 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +6 -8
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +11 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +53 -0
- package/build/components/global-styles/effects-panel.js.map +1 -0
- package/build/components/global-styles/filters-panel.js +50 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/global-styles-provider.js +4 -15
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/preview.js +1 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +14 -8
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-effects.js +15 -7
- package/build/components/global-styles/screen-effects.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +2 -2
- package/build/components/global-styles/screen-filters.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +8 -118
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +149 -0
- package/build/components/global-styles/style-variations-container.js.map +1 -0
- package/build/components/global-styles/ui.js +52 -15
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/index.js +11 -7
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +1 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -137
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +17 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/table.js +3 -3
- package/build/components/list/table.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -0
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/index.js +4 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +28 -13
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +8 -6
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +58 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +5 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +114 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/site-hub/index.js +40 -17
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +8 -7
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +9 -8
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +9 -41
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-details/index.js +3 -1
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/index.js +19 -0
- package/build/hooks/commands/index.js.map +1 -0
- package/build/hooks/commands/use-navigation-commands.js +126 -0
- package/build/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build/hooks/commands/use-wp-admin-commands.js +97 -0
- package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
- package/build/hooks/template-part-edit.js +2 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/store/private-actions.js +19 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +13 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +23 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +3 -2
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +6 -6
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +6 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +100 -0
- package/build-module/components/editor-canvas-container/index.js.map +1 -0
- package/build-module/components/global-styles/border-panel.js +81 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +6 -6
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +11 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +43 -0
- package/build-module/components/global-styles/effects-panel.js.map +1 -0
- package/build-module/components/global-styles/filters-panel.js +40 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/global-styles-provider.js +5 -16
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/preview.js +1 -1
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +13 -8
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-effects.js +13 -4
- package/build-module/components/global-styles/screen-effects.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +2 -2
- package/build-module/components/global-styles/screen-filters.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -114
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +130 -0
- package/build-module/components/global-styles/style-variations-container.js.map +1 -0
- package/build-module/components/global-styles/ui.js +49 -16
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +10 -7
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -135
- package/build-module/components/keyboard-shortcuts/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/list/table.js +3 -3
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -0
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +28 -15
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +9 -7
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +41 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +6 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +113 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -18
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +8 -7
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +9 -8
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +10 -41
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-details/index.js +3 -1
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/index.js +10 -0
- package/build-module/hooks/commands/index.js.map +1 -0
- package/build-module/hooks/commands/use-navigation-commands.js +109 -0
- package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js +81 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
- package/build-module/hooks/template-part-edit.js +2 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-actions.js +15 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +23 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +133 -107
- package/build-style/style.css +133 -107
- package/package.json +34 -32
- package/src/components/add-new-template/new-template.js +3 -0
- package/src/components/block-editor/index.js +8 -8
- package/src/components/editor/index.js +11 -3
- package/src/components/editor-canvas-container/index.js +115 -0
- package/src/components/editor-canvas-container/style.scss +19 -0
- package/src/components/global-styles/border-panel.js +73 -1
- package/src/components/global-styles/context-menu.js +6 -6
- package/src/components/global-styles/dimensions-panel.js +11 -0
- package/src/components/global-styles/effects-panel.js +40 -0
- package/src/components/global-styles/filters-panel.js +39 -0
- package/src/components/global-styles/global-styles-provider.js +4 -18
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +9 -5
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-effects.js +12 -5
- package/src/components/global-styles/screen-filters.js +2 -2
- package/src/components/global-styles/screen-style-variations.js +10 -129
- package/src/components/global-styles/style-variations-container.js +136 -0
- package/src/components/global-styles/style.scss +0 -39
- package/src/components/global-styles/ui.js +54 -8
- package/src/components/header-edit-mode/index.js +14 -5
- package/src/components/header-edit-mode/more-menu/index.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +1 -155
- package/src/components/layout/index.js +13 -16
- package/src/components/layout/style.scss +31 -4
- package/src/components/list/table.js +16 -2
- package/src/components/preferences-modal/index.js +7 -0
- package/src/components/secondary-sidebar/style.scss +23 -5
- package/src/components/sidebar/index.js +4 -0
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +36 -17
- package/src/components/sidebar-navigation-screen/index.js +10 -5
- package/src/components/sidebar-navigation-screen/style.scss +20 -5
- package/src/components/sidebar-navigation-screen-global-styles/index.js +41 -0
- package/src/components/sidebar-navigation-screen-main/index.js +9 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +134 -9
- package/src/components/site-hub/index.js +51 -23
- package/src/components/site-icon/index.js +6 -11
- package/src/components/site-icon/style.scss +8 -3
- package/src/components/start-template-options/index.js +13 -12
- package/src/components/start-template-options/style.scss +18 -43
- package/src/components/style-book/index.js +7 -51
- package/src/components/style-book/style.scss +0 -18
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -3
- package/src/components/template-details/index.js +1 -0
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/index.js +10 -0
- package/src/hooks/commands/use-navigation-commands.js +112 -0
- package/src/hooks/commands/use-wp-admin-commands.js +79 -0
- package/src/hooks/template-part-edit.js +1 -0
- package/src/index.js +1 -0
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +2 -1
- package/src/style.scss +1 -0
- package/build/components/global-styles/duotone-panel.js +0 -78
- package/build/components/global-styles/duotone-panel.js.map +0 -1
- package/build/components/global-styles/filter-utils.js +0 -17
- package/build/components/global-styles/filter-utils.js.map +0 -1
- package/build/components/global-styles/shadow-panel.js +0 -197
- package/build/components/global-styles/shadow-panel.js.map +0 -1
- package/build-module/components/global-styles/duotone-panel.js +0 -67
- package/build-module/components/global-styles/duotone-panel.js.map +0 -1
- package/build-module/components/global-styles/filter-utils.js +0 -9
- package/build-module/components/global-styles/filter-utils.js.map +0 -1
- package/build-module/components/global-styles/shadow-panel.js +0 -178
- package/build-module/components/global-styles/shadow-panel.js.map +0 -1
- package/src/components/global-styles/duotone-panel.js +0 -82
- package/src/components/global-styles/filter-utils.js +0 -9
- package/src/components/global-styles/shadow-panel.js +0 -178
package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
CHANGED
|
@@ -6,10 +6,14 @@ import {
|
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
BlockList,
|
|
8
8
|
BlockTools,
|
|
9
|
+
__experimentalLinkControl as LinkControl,
|
|
9
10
|
} from '@wordpress/block-editor';
|
|
10
11
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
12
|
import { createBlock } from '@wordpress/blocks';
|
|
12
|
-
import {
|
|
13
|
+
import { Popover } from '@wordpress/components';
|
|
14
|
+
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
15
|
+
import { useCallback, useEffect, useState } from '@wordpress/element';
|
|
16
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* Internal dependencies
|
|
@@ -17,17 +21,80 @@ import { useCallback } from '@wordpress/element';
|
|
|
17
21
|
import { unlock } from '../../private-apis';
|
|
18
22
|
import { NavigationMenuLoader } from './loader';
|
|
19
23
|
|
|
24
|
+
function CustomLinkAdditionalBlockUI( { block, onClose } ) {
|
|
25
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
26
|
+
const { label, url, opensInNewTab } = block.attributes;
|
|
27
|
+
const link = {
|
|
28
|
+
url,
|
|
29
|
+
opensInNewTab,
|
|
30
|
+
title: label && stripHTML( label ),
|
|
31
|
+
};
|
|
32
|
+
return (
|
|
33
|
+
<Popover placement="bottom" shift onClose={ onClose }>
|
|
34
|
+
<LinkControl
|
|
35
|
+
hasTextControl
|
|
36
|
+
hasRichPreviews
|
|
37
|
+
value={ link }
|
|
38
|
+
onChange={ ( updatedValue ) => {
|
|
39
|
+
updateBlockAttributes( block.clientId, {
|
|
40
|
+
label: updatedValue.title,
|
|
41
|
+
url: updatedValue.url,
|
|
42
|
+
opensInNewTab: updatedValue.opensInNewTab,
|
|
43
|
+
} );
|
|
44
|
+
onClose();
|
|
45
|
+
} }
|
|
46
|
+
onCancel={ onClose }
|
|
47
|
+
/>
|
|
48
|
+
</Popover>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
// Needs to be kept in sync with the query used at packages/block-library/src/page-list/edit.js.
|
|
52
|
+
const MAX_PAGE_COUNT = 100;
|
|
53
|
+
const PAGES_QUERY = [
|
|
54
|
+
'postType',
|
|
55
|
+
'page',
|
|
56
|
+
{
|
|
57
|
+
per_page: MAX_PAGE_COUNT,
|
|
58
|
+
_fields: [ 'id', 'link', 'menu_order', 'parent', 'title', 'type' ],
|
|
59
|
+
// TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby
|
|
60
|
+
// values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent
|
|
61
|
+
// sort.
|
|
62
|
+
orderby: 'menu_order',
|
|
63
|
+
order: 'asc',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
|
|
20
67
|
export default function NavigationMenuContent( { rootClientId, onSelect } ) {
|
|
21
|
-
const
|
|
68
|
+
const [ isLoading, setIsLoading ] = useState( true );
|
|
69
|
+
const { clientIdsTree, shouldKeepLoading, isSinglePageList } = useSelect(
|
|
22
70
|
( select ) => {
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
71
|
+
const {
|
|
72
|
+
__unstableGetClientIdsTree,
|
|
73
|
+
areInnerBlocksControlled,
|
|
74
|
+
getBlockName,
|
|
75
|
+
} = select( blockEditorStore );
|
|
76
|
+
const { isResolving } = select( coreStore );
|
|
27
77
|
|
|
78
|
+
const _clientIdsTree = __unstableGetClientIdsTree( rootClientId );
|
|
79
|
+
const hasOnlyPageListBlock =
|
|
80
|
+
_clientIdsTree.length === 1 &&
|
|
81
|
+
getBlockName( _clientIdsTree[ 0 ].clientId ) ===
|
|
82
|
+
'core/page-list';
|
|
83
|
+
const isLoadingPages = isResolving(
|
|
84
|
+
'getEntityRecords',
|
|
85
|
+
PAGES_QUERY
|
|
86
|
+
);
|
|
87
|
+
return {
|
|
88
|
+
clientIdsTree: _clientIdsTree,
|
|
28
89
|
// This is a small hack to wait for the navigation block
|
|
29
90
|
// to actually load its inner blocks.
|
|
30
|
-
|
|
91
|
+
shouldKeepLoading:
|
|
92
|
+
! areInnerBlocksControlled( rootClientId ) ||
|
|
93
|
+
isLoadingPages,
|
|
94
|
+
isSinglePageList:
|
|
95
|
+
hasOnlyPageListBlock &&
|
|
96
|
+
! isLoadingPages &&
|
|
97
|
+
_clientIdsTree[ 0 ].innerBlocks.length > 0,
|
|
31
98
|
};
|
|
32
99
|
},
|
|
33
100
|
[ rootClientId ]
|
|
@@ -35,6 +102,48 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
|
|
|
35
102
|
const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =
|
|
36
103
|
useDispatch( blockEditorStore );
|
|
37
104
|
|
|
105
|
+
const [ customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId ] =
|
|
106
|
+
useState( false );
|
|
107
|
+
|
|
108
|
+
const renderAdditionalBlockUICallback = useCallback(
|
|
109
|
+
( block ) => {
|
|
110
|
+
if (
|
|
111
|
+
customLinkEditPopoverOpenId &&
|
|
112
|
+
block.clientId === customLinkEditPopoverOpenId
|
|
113
|
+
) {
|
|
114
|
+
return (
|
|
115
|
+
<CustomLinkAdditionalBlockUI
|
|
116
|
+
block={ block }
|
|
117
|
+
onClose={ () => {
|
|
118
|
+
setIsCustomLinkEditPopoverOpenId( false );
|
|
119
|
+
} }
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
},
|
|
125
|
+
[ customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId ]
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// Delay loading stop by 50ms to avoid flickering.
|
|
129
|
+
useEffect( () => {
|
|
130
|
+
let timeoutId;
|
|
131
|
+
if ( shouldKeepLoading && ! isLoading ) {
|
|
132
|
+
setIsLoading( true );
|
|
133
|
+
}
|
|
134
|
+
if ( ! shouldKeepLoading && isLoading ) {
|
|
135
|
+
timeoutId = setTimeout( () => {
|
|
136
|
+
setIsLoading( false );
|
|
137
|
+
timeoutId = undefined;
|
|
138
|
+
}, 50 );
|
|
139
|
+
}
|
|
140
|
+
return () => {
|
|
141
|
+
if ( timeoutId ) {
|
|
142
|
+
clearTimeout( timeoutId );
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}, [ shouldKeepLoading, clientIdsTree, isLoading ] );
|
|
146
|
+
|
|
38
147
|
const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );
|
|
39
148
|
|
|
40
149
|
const offCanvasOnselect = useCallback(
|
|
@@ -48,11 +157,22 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
|
|
|
48
157
|
block.clientId,
|
|
49
158
|
createBlock( 'core/navigation-link', block.attributes )
|
|
50
159
|
);
|
|
160
|
+
} else if (
|
|
161
|
+
block.name === 'core/navigation-link' &&
|
|
162
|
+
block.attributes.kind === 'custom' &&
|
|
163
|
+
block.attributes.url
|
|
164
|
+
) {
|
|
165
|
+
setIsCustomLinkEditPopoverOpenId( block.clientId );
|
|
51
166
|
} else {
|
|
52
167
|
onSelect( block );
|
|
53
168
|
}
|
|
54
169
|
},
|
|
55
|
-
[
|
|
170
|
+
[
|
|
171
|
+
onSelect,
|
|
172
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
173
|
+
replaceBlock,
|
|
174
|
+
setIsCustomLinkEditPopoverOpenId,
|
|
175
|
+
]
|
|
56
176
|
);
|
|
57
177
|
|
|
58
178
|
// The hidden block is needed because it makes block edit side effects trigger.
|
|
@@ -62,10 +182,15 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
|
|
|
62
182
|
{ isLoading && <NavigationMenuLoader /> }
|
|
63
183
|
{ ! isLoading && (
|
|
64
184
|
<OffCanvasEditor
|
|
65
|
-
blocks={
|
|
185
|
+
blocks={
|
|
186
|
+
isSinglePageList
|
|
187
|
+
? clientIdsTree[ 0 ].innerBlocks
|
|
188
|
+
: clientIdsTree
|
|
189
|
+
}
|
|
66
190
|
onSelect={ offCanvasOnselect }
|
|
67
191
|
LeafMoreMenu={ LeafMoreMenu }
|
|
68
192
|
showAppender={ false }
|
|
193
|
+
renderAdditionalBlockUI={ renderAdditionalBlockUICallback }
|
|
69
194
|
/>
|
|
70
195
|
) }
|
|
71
196
|
<div style={ { visibility: 'hidden' } }>
|
|
@@ -10,12 +10,14 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
10
10
|
import {
|
|
11
11
|
Button,
|
|
12
12
|
__unstableMotion as motion,
|
|
13
|
+
__unstableAnimatePresence as AnimatePresence,
|
|
13
14
|
__experimentalHStack as HStack,
|
|
14
15
|
} from '@wordpress/components';
|
|
15
16
|
import { useReducedMotion } from '@wordpress/compose';
|
|
16
17
|
import { __ } from '@wordpress/i18n';
|
|
17
18
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
18
19
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
19
21
|
import { forwardRef } from '@wordpress/element';
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -28,8 +30,7 @@ import { unlock } from '../../private-apis';
|
|
|
28
30
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
29
31
|
|
|
30
32
|
const SiteHub = forwardRef( ( props, ref ) => {
|
|
31
|
-
const { canvasMode
|
|
32
|
-
select( editSiteStore ).getEditedPostType();
|
|
33
|
+
const { canvasMode } = useSelect( ( select ) => {
|
|
33
34
|
const { getCanvasMode, getSettings } = unlock(
|
|
34
35
|
select( editSiteStore )
|
|
35
36
|
);
|
|
@@ -41,20 +42,15 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
41
42
|
const disableMotion = useReducedMotion();
|
|
42
43
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
43
44
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
onClick: () => {
|
|
54
|
-
clearSelectedBlock();
|
|
55
|
-
setCanvasMode( 'view' );
|
|
56
|
-
},
|
|
57
|
-
};
|
|
45
|
+
const siteIconButtonProps = {
|
|
46
|
+
label: __( 'Open Admin Sidebar' ),
|
|
47
|
+
onClick: () => {
|
|
48
|
+
if ( canvasMode === 'edit' ) {
|
|
49
|
+
clearSelectedBlock();
|
|
50
|
+
setCanvasMode( 'view' );
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
58
54
|
const siteTitle = useSelect(
|
|
59
55
|
( select ) =>
|
|
60
56
|
select( coreStore ).getEntityRecord( 'root', 'site' )?.title,
|
|
@@ -66,7 +62,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
66
62
|
ref={ ref }
|
|
67
63
|
{ ...props }
|
|
68
64
|
className={ classnames( 'edit-site-site-hub', props.className ) }
|
|
69
|
-
|
|
65
|
+
initial={ false }
|
|
70
66
|
transition={ {
|
|
71
67
|
type: 'tween',
|
|
72
68
|
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
@@ -91,15 +87,47 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
91
87
|
{ ...siteIconButtonProps }
|
|
92
88
|
className="edit-site-layout__view-mode-toggle"
|
|
93
89
|
>
|
|
94
|
-
<
|
|
90
|
+
<motion.div
|
|
91
|
+
initial={ false }
|
|
92
|
+
animate={ {
|
|
93
|
+
scale: canvasMode === 'view' ? 0.5 : 1,
|
|
94
|
+
} }
|
|
95
|
+
whileHover={ {
|
|
96
|
+
scale: canvasMode === 'view' ? 0.5 : 0.96,
|
|
97
|
+
} }
|
|
98
|
+
transition={ {
|
|
99
|
+
type: 'tween',
|
|
100
|
+
duration: disableMotion
|
|
101
|
+
? 0
|
|
102
|
+
: HUB_ANIMATION_DURATION,
|
|
103
|
+
ease: 'easeOut',
|
|
104
|
+
} }
|
|
105
|
+
>
|
|
106
|
+
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
107
|
+
</motion.div>
|
|
95
108
|
</Button>
|
|
96
109
|
</motion.div>
|
|
97
110
|
|
|
98
|
-
|
|
99
|
-
<div
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
<AnimatePresence>
|
|
112
|
+
<motion.div
|
|
113
|
+
layout={ canvasMode === 'edit' }
|
|
114
|
+
animate={ {
|
|
115
|
+
opacity: canvasMode === 'view' ? 1 : 0,
|
|
116
|
+
} }
|
|
117
|
+
exit={ {
|
|
118
|
+
opacity: 0,
|
|
119
|
+
} }
|
|
120
|
+
className="edit-site-site-hub__site-title"
|
|
121
|
+
transition={ {
|
|
122
|
+
type: 'tween',
|
|
123
|
+
duration: disableMotion ? 0 : 0.2,
|
|
124
|
+
ease: 'easeOut',
|
|
125
|
+
delay: canvasMode === 'view' ? 0.1 : 0,
|
|
126
|
+
} }
|
|
127
|
+
>
|
|
128
|
+
{ decodeEntities( siteTitle ) }
|
|
129
|
+
</motion.div>
|
|
130
|
+
</AnimatePresence>
|
|
103
131
|
</HStack>
|
|
104
132
|
</motion.div>
|
|
105
133
|
);
|
|
@@ -14,22 +14,17 @@ import { store as coreDataStore } from '@wordpress/core-data';
|
|
|
14
14
|
|
|
15
15
|
function SiteIcon( { className } ) {
|
|
16
16
|
const { isRequestingSite, siteIconUrl } = useSelect( ( select ) => {
|
|
17
|
-
const { getEntityRecord
|
|
18
|
-
const siteData =
|
|
19
|
-
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
17
|
+
const { getEntityRecord } = select( coreDataStore );
|
|
18
|
+
const siteData = getEntityRecord( 'root', '__unstableBase', undefined );
|
|
20
19
|
|
|
21
20
|
return {
|
|
22
|
-
isRequestingSite:
|
|
23
|
-
|
|
24
|
-
'__unstableBase',
|
|
25
|
-
undefined,
|
|
26
|
-
] ),
|
|
27
|
-
siteIconUrl: siteData.site_icon_url,
|
|
21
|
+
isRequestingSite: ! siteData,
|
|
22
|
+
siteIconUrl: siteData?.site_icon_url,
|
|
28
23
|
};
|
|
29
24
|
}, [] );
|
|
30
25
|
|
|
31
26
|
if ( isRequestingSite && ! siteIconUrl ) {
|
|
32
|
-
return
|
|
27
|
+
return <div className="edit-site-site-icon__image" />;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
const icon = siteIconUrl ? (
|
|
@@ -41,7 +36,7 @@ function SiteIcon( { className } ) {
|
|
|
41
36
|
) : (
|
|
42
37
|
<Icon
|
|
43
38
|
className="edit-site-site-icon__icon"
|
|
44
|
-
size="
|
|
39
|
+
size="48px"
|
|
45
40
|
icon={ wordpress }
|
|
46
41
|
/>
|
|
47
42
|
);
|
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.edit-site-site-icon__image {
|
|
6
|
-
width:
|
|
7
|
-
height:
|
|
8
|
-
border-radius: $radius-block-ui;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: auto;
|
|
8
|
+
border-radius: $radius-block-ui * 2;
|
|
9
9
|
object-fit: cover;
|
|
10
|
+
background: #333;
|
|
11
|
+
|
|
12
|
+
.edit-site-layout.is-full-canvas.is-edit-mode & {
|
|
13
|
+
border-radius: 0;
|
|
14
|
+
}
|
|
10
15
|
}
|
|
@@ -32,7 +32,7 @@ function useFallbackTemplateContent( slug, isCustom = false ) {
|
|
|
32
32
|
ignore_empty: true,
|
|
33
33
|
} ),
|
|
34
34
|
} ).then( ( { content } ) => setTemplateContent( content.raw ) );
|
|
35
|
-
}, [ slug ] );
|
|
35
|
+
}, [ isCustom, slug ] );
|
|
36
36
|
return templateContent;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -121,6 +121,7 @@ function StartModal( { slug, isCustom, onClose, postType } ) {
|
|
|
121
121
|
closeLabel={ __( 'Cancel' ) }
|
|
122
122
|
focusOnMount="firstElement"
|
|
123
123
|
onRequestClose={ onClose }
|
|
124
|
+
isFullScreen={ true }
|
|
124
125
|
>
|
|
125
126
|
<div className="edit-site-start-template-options__modal-content">
|
|
126
127
|
<PatternSelection
|
|
@@ -146,28 +147,28 @@ export default function StartTemplateOptions() {
|
|
|
146
147
|
const [ modalState, setModalState ] = useState(
|
|
147
148
|
START_TEMPLATE_MODAL_STATES.INITIAL
|
|
148
149
|
);
|
|
149
|
-
const {
|
|
150
|
+
const { shouldOpenModal, slug, isCustom, postType } = useSelect(
|
|
150
151
|
( select ) => {
|
|
151
152
|
const { getEditedPostType, getEditedPostId } =
|
|
152
153
|
select( editSiteStore );
|
|
153
154
|
const _postType = getEditedPostType();
|
|
154
155
|
const postId = getEditedPostId();
|
|
155
|
-
const {
|
|
156
|
-
|
|
157
|
-
getEditedEntityRecord,
|
|
158
|
-
} = select( coreStore );
|
|
156
|
+
const { getEditedEntityRecord, hasEditsForEntityRecord } =
|
|
157
|
+
select( coreStore );
|
|
159
158
|
const templateRecord = getEditedEntityRecord(
|
|
160
159
|
'postType',
|
|
161
160
|
_postType,
|
|
162
161
|
postId
|
|
163
162
|
);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
const hasEdits = hasEditsForEntityRecord(
|
|
164
|
+
'postType',
|
|
165
|
+
_postType,
|
|
166
|
+
postId
|
|
167
|
+
);
|
|
167
168
|
|
|
168
169
|
return {
|
|
169
|
-
|
|
170
|
-
!
|
|
170
|
+
shouldOpenModal:
|
|
171
|
+
! hasEdits &&
|
|
171
172
|
'' === templateRecord.content &&
|
|
172
173
|
'wp_template' === _postType &&
|
|
173
174
|
! select( preferencesStore ).get(
|
|
@@ -184,7 +185,7 @@ export default function StartTemplateOptions() {
|
|
|
184
185
|
|
|
185
186
|
if (
|
|
186
187
|
( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&
|
|
187
|
-
!
|
|
188
|
+
! shouldOpenModal ) ||
|
|
188
189
|
modalState === START_TEMPLATE_MODAL_STATES.CLOSED
|
|
189
190
|
) {
|
|
190
191
|
return null;
|
|
@@ -1,57 +1,31 @@
|
|
|
1
|
-
.edit-site-start-template-options__modal.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
.edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
|
|
2
|
+
column-count: 2;
|
|
3
|
+
column-gap: $grid-unit-30;
|
|
4
|
+
|
|
5
|
+
// Small top padding required to avoid cutting off the visible outline when hovering items
|
|
6
|
+
padding-top: $border-width-focus;
|
|
7
|
+
|
|
8
8
|
@include break-medium() {
|
|
9
|
-
|
|
9
|
+
column-count: 3;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
@include break-wide() {
|
|
13
|
+
column-count: 4;
|
|
13
14
|
}
|
|
14
|
-
}
|
|
15
15
|
|
|
16
|
-
.edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
|
|
17
|
-
display: grid;
|
|
18
|
-
width: 100%;
|
|
19
|
-
margin-top: $grid-unit-05;
|
|
20
|
-
gap: $grid-unit-30;
|
|
21
|
-
grid-template-columns: repeat(auto-fit, minmax(min(100%/2, max(240px, 100%/10)), 1fr));
|
|
22
16
|
.block-editor-block-patterns-list__list-item {
|
|
23
17
|
break-inside: avoid-column;
|
|
24
|
-
margin-bottom: 0;
|
|
25
|
-
width: 100%;
|
|
26
|
-
aspect-ratio: 3/4;
|
|
27
|
-
|
|
28
|
-
.block-editor-block-preview__container {
|
|
29
|
-
height: 100%;
|
|
30
|
-
box-shadow: 0 0 0 1px $gray-300;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.block-editor-block-preview__content {
|
|
34
|
-
width: 100%;
|
|
35
|
-
position: absolute;
|
|
36
|
-
}
|
|
37
18
|
|
|
38
19
|
.block-editor-block-patterns-list__item-title {
|
|
39
20
|
display: none;
|
|
40
21
|
}
|
|
22
|
+
}
|
|
41
23
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
&:focus {
|
|
49
|
-
.block-editor-block-preview__container {
|
|
50
|
-
box-shadow: inset 0 0 0 1px $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
51
|
-
|
|
52
|
-
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
53
|
-
outline: 2px solid transparent;
|
|
54
|
-
}
|
|
24
|
+
.block-editor-block-patterns-list__item {
|
|
25
|
+
// Avoid to override the BlockPatternList component
|
|
26
|
+
// default hover and focus styles.
|
|
27
|
+
&:not(:focus):not(:hover) .block-editor-block-preview__container {
|
|
28
|
+
box-shadow: 0 0 0 1px $gray-300;
|
|
55
29
|
}
|
|
56
30
|
}
|
|
57
31
|
|
|
@@ -61,6 +35,7 @@
|
|
|
61
35
|
position: absolute;
|
|
62
36
|
padding: 0;
|
|
63
37
|
background: #f0f0f0;
|
|
38
|
+
min-height: $grid-unit-50 * 4;
|
|
64
39
|
&::after {
|
|
65
40
|
width: 100%;
|
|
66
41
|
top: 50%;
|
|
@@ -7,14 +7,11 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
Button,
|
|
11
10
|
__unstableComposite as Composite,
|
|
12
11
|
__unstableUseCompositeState as useCompositeState,
|
|
13
12
|
__unstableCompositeItem as CompositeItem,
|
|
14
13
|
Disabled,
|
|
15
14
|
TabPanel,
|
|
16
|
-
createSlotFill,
|
|
17
|
-
__experimentalUseSlotFills as useSlotFills,
|
|
18
15
|
} from '@wordpress/components';
|
|
19
16
|
import { __, sprintf } from '@wordpress/i18n';
|
|
20
17
|
import {
|
|
@@ -31,29 +28,19 @@ import {
|
|
|
31
28
|
__unstableIframe as Iframe,
|
|
32
29
|
} from '@wordpress/block-editor';
|
|
33
30
|
import { useSelect } from '@wordpress/data';
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
useResizeObserver,
|
|
37
|
-
useFocusOnMount,
|
|
38
|
-
useFocusReturn,
|
|
39
|
-
useMergeRefs,
|
|
40
|
-
} from '@wordpress/compose';
|
|
31
|
+
import { useResizeObserver } from '@wordpress/compose';
|
|
41
32
|
import { useMemo, memo } from '@wordpress/element';
|
|
42
|
-
import { ESCAPE } from '@wordpress/keycodes';
|
|
43
33
|
|
|
44
34
|
/**
|
|
45
35
|
* Internal dependencies
|
|
46
36
|
*/
|
|
47
37
|
import { unlock } from '../../private-apis';
|
|
38
|
+
import EditorCanvasContainer from '../editor-canvas-container';
|
|
48
39
|
|
|
49
40
|
const { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(
|
|
50
41
|
blockEditorPrivateApis
|
|
51
42
|
);
|
|
52
43
|
|
|
53
|
-
const SLOT_FILL_NAME = 'EditSiteStyleBook';
|
|
54
|
-
const { Slot: StyleBookSlot, Fill: StyleBookFill } =
|
|
55
|
-
createSlotFill( SLOT_FILL_NAME );
|
|
56
|
-
|
|
57
44
|
// The content area of the Style Book is rendered within an iframe so that global styles
|
|
58
45
|
// are applied to elements within the entire content area. To support elements that are
|
|
59
46
|
// not part of the block previews, such as headings and layout for the block previews,
|
|
@@ -174,11 +161,8 @@ function getExamples() {
|
|
|
174
161
|
return [ headingsExample, ...otherExamples ];
|
|
175
162
|
}
|
|
176
163
|
|
|
177
|
-
function StyleBook( { isSelected, onSelect
|
|
164
|
+
function StyleBook( { isSelected, onSelect } ) {
|
|
178
165
|
const [ resizeObserver, sizes ] = useResizeObserver();
|
|
179
|
-
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
180
|
-
const sectionFocusReturnRef = useFocusReturn();
|
|
181
|
-
|
|
182
166
|
const [ textColor ] = useGlobalStyle( 'color.text' );
|
|
183
167
|
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
184
168
|
const examples = useMemo( getExamples, [] );
|
|
@@ -207,17 +191,9 @@ function StyleBook( { isSelected, onSelect, onClose } ) {
|
|
|
207
191
|
[ originalSettings ]
|
|
208
192
|
);
|
|
209
193
|
|
|
210
|
-
function closeOnEscape( event ) {
|
|
211
|
-
if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
|
|
212
|
-
event.preventDefault();
|
|
213
|
-
onClose();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
194
|
return (
|
|
218
|
-
<
|
|
219
|
-
|
|
220
|
-
<section
|
|
195
|
+
<EditorCanvasContainer closeButtonLabel={ __( 'Close Style Book' ) }>
|
|
196
|
+
<div
|
|
221
197
|
className={ classnames( 'edit-site-style-book', {
|
|
222
198
|
'is-wide': sizes.width > 600,
|
|
223
199
|
} ) }
|
|
@@ -225,21 +201,8 @@ function StyleBook( { isSelected, onSelect, onClose } ) {
|
|
|
225
201
|
color: textColor,
|
|
226
202
|
background: backgroundColor,
|
|
227
203
|
} }
|
|
228
|
-
aria-label={ __( 'Style Book' ) }
|
|
229
|
-
onKeyDown={ closeOnEscape }
|
|
230
|
-
ref={ useMergeRefs( [
|
|
231
|
-
sectionFocusReturnRef,
|
|
232
|
-
focusOnMountRef,
|
|
233
|
-
] ) }
|
|
234
204
|
>
|
|
235
205
|
{ resizeObserver }
|
|
236
|
-
<Button
|
|
237
|
-
className="edit-site-style-book__close-button"
|
|
238
|
-
icon={ closeSmall }
|
|
239
|
-
label={ __( 'Close Style Book' ) }
|
|
240
|
-
onClick={ onClose }
|
|
241
|
-
showTooltip={ false }
|
|
242
|
-
/>
|
|
243
206
|
<TabPanel
|
|
244
207
|
className="edit-site-style-book__tab-panel"
|
|
245
208
|
tabs={ tabs }
|
|
@@ -282,8 +245,8 @@ function StyleBook( { isSelected, onSelect, onClose } ) {
|
|
|
282
245
|
</Iframe>
|
|
283
246
|
) }
|
|
284
247
|
</TabPanel>
|
|
285
|
-
</
|
|
286
|
-
</
|
|
248
|
+
</div>
|
|
249
|
+
</EditorCanvasContainer>
|
|
287
250
|
);
|
|
288
251
|
}
|
|
289
252
|
|
|
@@ -365,11 +328,4 @@ const Example = ( { composite, id, title, blocks, isSelected, onClick } ) => {
|
|
|
365
328
|
);
|
|
366
329
|
};
|
|
367
330
|
|
|
368
|
-
function useHasStyleBook() {
|
|
369
|
-
const fills = useSlotFills( SLOT_FILL_NAME );
|
|
370
|
-
return !! fills?.length;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
StyleBook.Slot = StyleBookSlot;
|
|
374
331
|
export default StyleBook;
|
|
375
|
-
export { useHasStyleBook };
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
.edit-site-style-book {
|
|
2
|
-
background: $white; // Fallback color, overridden by JavaScript.
|
|
3
|
-
border-radius: $radius-block-ui;
|
|
4
|
-
bottom: 0;
|
|
5
|
-
left: 0;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
position: absolute;
|
|
8
|
-
right: 0;
|
|
9
|
-
top: 0;
|
|
10
|
-
transition: all 0.3s; // Match .block-editor-iframe__body transition.
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.edit-site-style-book__close-button {
|
|
14
|
-
position: absolute;
|
|
15
|
-
right: $grid-unit-10;
|
|
16
|
-
top: math.div($grid-unit-60 - $button-size, 2); // ( tab height - button size ) / 2
|
|
17
|
-
}
|
|
18
|
-
|
|
19
1
|
.edit-site-style-book__tab-panel {
|
|
20
2
|
.components-tab-panel__tabs {
|
|
21
3
|
background: $white;
|
|
@@ -14,16 +14,17 @@ import { store as editSiteStore } from '../../store';
|
|
|
14
14
|
export default function useInitEditedEntityFromURL() {
|
|
15
15
|
const { params: { postId, postType } = {} } = useLocation();
|
|
16
16
|
const { isRequestingSite, homepageId, url } = useSelect( ( select ) => {
|
|
17
|
-
const { getSite } = select( coreDataStore );
|
|
17
|
+
const { getSite, getUnstableBase } = select( coreDataStore );
|
|
18
18
|
const siteData = getSite();
|
|
19
|
+
const base = getUnstableBase();
|
|
19
20
|
|
|
20
21
|
return {
|
|
21
|
-
isRequestingSite: !
|
|
22
|
+
isRequestingSite: ! base,
|
|
22
23
|
homepageId:
|
|
23
24
|
siteData?.show_on_front === 'page'
|
|
24
25
|
? siteData.page_on_front
|
|
25
26
|
: null,
|
|
26
|
-
url:
|
|
27
|
+
url: base?.home,
|
|
27
28
|
};
|
|
28
29
|
}, [] );
|
|
29
30
|
|
|
@@ -102,6 +102,7 @@ export default function TemplateDetails( { template, onClose } ) {
|
|
|
102
102
|
<Button
|
|
103
103
|
className="edit-site-template-details__show-all-button"
|
|
104
104
|
{ ...browseAllLinkProps }
|
|
105
|
+
onClick={ () => onClose() }
|
|
105
106
|
>
|
|
106
107
|
{ template?.type === 'wp_template'
|
|
107
108
|
? __( 'Manage all templates' )
|