@wordpress/edit-site 5.15.0 → 5.16.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-pattern/index.js +2 -1
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +29 -2
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +4 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +12 -7
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-block.js +16 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +12 -5
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -3
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +4 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/layout/index.js +9 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/index.js +3 -3
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +18 -4
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +20 -3
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/index.js +1 -2
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -16
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +11 -19
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +10 -4
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +15 -8
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +24 -14
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +2 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +8 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +50 -26
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +0 -9
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +5 -2
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +57 -27
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +65 -7
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +84 -49
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +2 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/use-debounced-input.js +5 -7
- package/build/utils/use-debounced-input.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +2 -1
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +29 -2
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +4 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +12 -7
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +16 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +13 -6
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -3
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/layout/index.js +9 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/index.js +3 -3
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +19 -5
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +19 -3
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +1 -2
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +2 -15
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +12 -20
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -4
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -9
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +21 -14
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +7 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +49 -26
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +4 -2
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +57 -27
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +84 -49
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +2 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/use-debounced-input.js +5 -7
- package/build-module/utils/use-debounced-input.js.map +1 -1
- package/build-style/style-rtl.css +67 -47
- package/build-style/style.css +67 -47
- package/package.json +39 -39
- package/src/components/add-new-pattern/index.js +2 -0
- package/src/components/block-editor/use-site-editor-settings.js +22 -2
- package/src/components/editor/index.js +3 -3
- package/src/components/global-styles/global-styles-provider.js +7 -2
- package/src/components/global-styles/screen-block.js +15 -0
- package/src/components/global-styles/screen-revisions/index.js +64 -58
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
- package/src/components/global-styles/style-variations-container.js +2 -0
- package/src/components/header-edit-mode/document-actions/index.js +8 -4
- package/src/components/header-edit-mode/document-actions/style.scss +41 -28
- package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
- package/src/components/layout/index.js +33 -20
- package/src/components/layout/style.scss +2 -2
- package/src/components/page/index.js +8 -8
- package/src/components/page/style.scss +8 -5
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
- package/src/components/page-patterns/patterns-list.js +25 -12
- package/src/components/page-patterns/style.scss +9 -8
- package/src/components/page-patterns/use-patterns.js +19 -3
- package/src/components/page-template-parts/index.js +0 -1
- package/src/components/page-templates/index.js +6 -19
- package/src/components/resizable-frame/index.js +10 -25
- package/src/components/save-button/index.js +2 -0
- package/src/components/save-hub/index.js +6 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
- package/src/components/sidebar-navigation-screen/index.js +24 -16
- package/src/components/sidebar-navigation-screen/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
- package/src/components/sidebar-navigation-screen-pages/index.js +9 -4
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +69 -41
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -8
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
- package/src/components/site-hub/index.js +3 -1
- package/src/components/site-hub/style.scss +1 -2
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
- package/src/components/table/style.scss +1 -0
- package/src/hooks/commands/use-common-commands.js +63 -23
- package/src/hooks/commands/use-edit-mode-commands.js +94 -23
- package/src/hooks/push-changes-to-global-styles/index.js +83 -46
- package/src/store/private-actions.js +5 -1
- package/src/utils/use-debounced-input.js +8 -7
|
@@ -37,10 +37,10 @@ export function SidebarNavigationItemGlobalStyles( props ) {
|
|
|
37
37
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
38
38
|
const { createNotice } = useDispatch( noticesStore );
|
|
39
39
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
40
|
-
const { get:
|
|
40
|
+
const { get: getPreference } = useSelect( preferencesStore );
|
|
41
41
|
|
|
42
42
|
const turnOffDistractionFreeMode = useCallback( () => {
|
|
43
|
-
const isDistractionFree =
|
|
43
|
+
const isDistractionFree = getPreference(
|
|
44
44
|
editSiteStore.name,
|
|
45
45
|
'distractionFree'
|
|
46
46
|
);
|
|
@@ -52,7 +52,7 @@ export function SidebarNavigationItemGlobalStyles( props ) {
|
|
|
52
52
|
isDismissible: true,
|
|
53
53
|
type: 'snackbar',
|
|
54
54
|
} );
|
|
55
|
-
}, [ createNotice, setPreference,
|
|
55
|
+
}, [ createNotice, setPreference, getPreference ] );
|
|
56
56
|
const hasGlobalStyleVariations = useSelect(
|
|
57
57
|
( select ) =>
|
|
58
58
|
!! select(
|
|
@@ -108,30 +108,10 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
function SidebarNavigationScreenGlobalStylesFooter( {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
select( coreStore );
|
|
116
|
-
|
|
117
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
118
|
-
const globalStyles = globalStylesId
|
|
119
|
-
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
120
|
-
: undefined;
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
revisionsCount:
|
|
124
|
-
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,
|
|
125
|
-
};
|
|
126
|
-
}, [] );
|
|
127
|
-
|
|
128
|
-
const hasRevisions = revisionsCount >= 2;
|
|
129
|
-
const modified = revisions?.[ 0 ]?.modified;
|
|
130
|
-
|
|
131
|
-
if ( ! hasRevisions || isLoading || ! modified ) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
|
|
111
|
+
function SidebarNavigationScreenGlobalStylesFooter( {
|
|
112
|
+
modifiedDateTime,
|
|
113
|
+
onClickRevisions,
|
|
114
|
+
} ) {
|
|
135
115
|
return (
|
|
136
116
|
<VStack className="edit-site-sidebar-navigation-screen-global-styles__footer">
|
|
137
117
|
<SidebarNavigationItem
|
|
@@ -150,8 +130,8 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
|
|
|
150
130
|
{ __( 'Last modified' ) }
|
|
151
131
|
</span>
|
|
152
132
|
<span>
|
|
153
|
-
<time dateTime={
|
|
154
|
-
{ humanTimeDiff(
|
|
133
|
+
<time dateTime={ modifiedDateTime }>
|
|
134
|
+
{ humanTimeDiff( modifiedDateTime ) }
|
|
155
135
|
</time>
|
|
156
136
|
</span>
|
|
157
137
|
<Icon icon={ backup } style={ { fill: 'currentcolor' } } />
|
|
@@ -162,6 +142,8 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
|
|
|
162
142
|
}
|
|
163
143
|
|
|
164
144
|
export default function SidebarNavigationScreenGlobalStyles() {
|
|
145
|
+
const { revisions, isLoading: isLoadingRevisions } =
|
|
146
|
+
useGlobalStylesRevisions();
|
|
165
147
|
const { openGeneralSidebar, setIsListViewOpened } =
|
|
166
148
|
useDispatch( editSiteStore );
|
|
167
149
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
@@ -170,19 +152,32 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
170
152
|
);
|
|
171
153
|
const { createNotice } = useDispatch( noticesStore );
|
|
172
154
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
173
|
-
const { get:
|
|
174
|
-
const { isViewMode, isStyleBookOpened } = useSelect(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
155
|
+
const { get: getPreference } = useSelect( preferencesStore );
|
|
156
|
+
const { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(
|
|
157
|
+
( select ) => {
|
|
158
|
+
const { getCanvasMode, getEditorCanvasContainerView } = unlock(
|
|
159
|
+
select( editSiteStore )
|
|
160
|
+
);
|
|
161
|
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
162
|
+
select( coreStore );
|
|
163
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
164
|
+
const globalStyles = globalStylesId
|
|
165
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
166
|
+
: undefined;
|
|
167
|
+
return {
|
|
168
|
+
isViewMode: 'view' === getCanvasMode(),
|
|
169
|
+
isStyleBookOpened:
|
|
170
|
+
'style-book' === getEditorCanvasContainerView(),
|
|
171
|
+
revisionsCount:
|
|
172
|
+
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??
|
|
173
|
+
0,
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
[]
|
|
177
|
+
);
|
|
183
178
|
|
|
184
179
|
const turnOffDistractionFreeMode = useCallback( () => {
|
|
185
|
-
const isDistractionFree =
|
|
180
|
+
const isDistractionFree = getPreference(
|
|
186
181
|
editSiteStore.name,
|
|
187
182
|
'distractionFree'
|
|
188
183
|
);
|
|
@@ -194,7 +189,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
194
189
|
isDismissible: true,
|
|
195
190
|
type: 'snackbar',
|
|
196
191
|
} );
|
|
197
|
-
}, [ createNotice, setPreference,
|
|
192
|
+
}, [ createNotice, setPreference, getPreference ] );
|
|
198
193
|
|
|
199
194
|
const openGlobalStyles = useCallback( async () => {
|
|
200
195
|
turnOffDistractionFreeMode();
|
|
@@ -226,6 +221,12 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
226
221
|
setEditorCanvasContainerView( 'global-styles-revisions' );
|
|
227
222
|
}, [ openGlobalStyles, setEditorCanvasContainerView ] );
|
|
228
223
|
|
|
224
|
+
// If there are no revisions, do not render a footer.
|
|
225
|
+
const hasRevisions = revisionsCount >= 2;
|
|
226
|
+
const modifiedDateTime = revisions?.[ 0 ]?.modified;
|
|
227
|
+
const shouldShowGlobalStylesFooter =
|
|
228
|
+
hasRevisions && ! isLoadingRevisions && modifiedDateTime;
|
|
229
|
+
|
|
229
230
|
return (
|
|
230
231
|
<>
|
|
231
232
|
<SidebarNavigationScreen
|
|
@@ -235,9 +236,12 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
235
236
|
) }
|
|
236
237
|
content={ <SidebarNavigationScreenGlobalStylesContent /> }
|
|
237
238
|
footer={
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
shouldShowGlobalStylesFooter && (
|
|
240
|
+
<SidebarNavigationScreenGlobalStylesFooter
|
|
241
|
+
modifiedDateTime={ modifiedDateTime }
|
|
242
|
+
onClickRevisions={ openRevisions }
|
|
243
|
+
/>
|
|
244
|
+
)
|
|
241
245
|
}
|
|
242
246
|
actions={
|
|
243
247
|
<>
|
package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
CHANGED
|
@@ -135,8 +135,7 @@ function useDuplicateNavigationMenu() {
|
|
|
135
135
|
useDispatch( noticesStore );
|
|
136
136
|
|
|
137
137
|
const handleDuplicate = async ( navigationMenu ) => {
|
|
138
|
-
const menuTitle =
|
|
139
|
-
navigationMenu?.title?.rendered || navigationMenu?.slug;
|
|
138
|
+
const menuTitle = navigationMenu?.title || navigationMenu?.slug;
|
|
140
139
|
|
|
141
140
|
try {
|
|
142
141
|
const savedRecord = await saveEntityRecord(
|
|
@@ -25,19 +25,19 @@ import { unlock } from '../../lock-unlock';
|
|
|
25
25
|
|
|
26
26
|
// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
|
|
27
27
|
function buildMenuLabel( title, id, status ) {
|
|
28
|
-
if ( ! title
|
|
28
|
+
if ( ! title ) {
|
|
29
29
|
/* translators: %s is the index of the menu in the list of menus. */
|
|
30
30
|
return sprintf( __( '(no title %s)' ), id );
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if ( status === 'publish' ) {
|
|
34
|
-
return decodeEntities( title
|
|
34
|
+
return decodeEntities( title );
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return sprintf(
|
|
38
38
|
// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
|
|
39
39
|
__( '%1$s (%2$s)' ),
|
|
40
|
-
decodeEntities( title
|
|
40
|
+
decodeEntities( title ),
|
|
41
41
|
status
|
|
42
42
|
);
|
|
43
43
|
}
|
|
@@ -124,7 +124,7 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
124
124
|
withChevron
|
|
125
125
|
icon={ navigation }
|
|
126
126
|
>
|
|
127
|
-
{ buildMenuLabel( title, index + 1, status ) }
|
|
127
|
+
{ buildMenuLabel( title?.rendered, index + 1, status ) }
|
|
128
128
|
</NavMenuItem>
|
|
129
129
|
) ) }
|
|
130
130
|
</ItemGroup>
|
|
@@ -23,10 +23,12 @@ import {
|
|
|
23
23
|
currentlyPreviewingTheme,
|
|
24
24
|
} from '../../utils/is-previewing-theme';
|
|
25
25
|
import { unlock } from '../../lock-unlock';
|
|
26
|
+
import { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
|
|
26
27
|
|
|
27
|
-
const { useHistory } = unlock( routerPrivateApis );
|
|
28
|
+
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
28
29
|
|
|
29
30
|
export default function LeafMoreMenu( props ) {
|
|
31
|
+
const location = useLocation();
|
|
30
32
|
const history = useHistory();
|
|
31
33
|
const { block } = props;
|
|
32
34
|
const { clientId } = block;
|
|
@@ -63,22 +65,32 @@ export default function LeafMoreMenu( props ) {
|
|
|
63
65
|
attributes.type &&
|
|
64
66
|
history
|
|
65
67
|
) {
|
|
66
|
-
history.push(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
history.push(
|
|
69
|
+
{
|
|
70
|
+
postType: attributes.type,
|
|
71
|
+
postId: attributes.id,
|
|
72
|
+
...( isPreviewingTheme() && {
|
|
73
|
+
wp_theme_preview: currentlyPreviewingTheme(),
|
|
74
|
+
} ),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
backPath: getPathFromURL( location.params ),
|
|
78
|
+
}
|
|
79
|
+
);
|
|
73
80
|
}
|
|
74
81
|
if ( name === 'core/page-list-item' && attributes.id && history ) {
|
|
75
|
-
history.push(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
history.push(
|
|
83
|
+
{
|
|
84
|
+
postType: 'page',
|
|
85
|
+
postId: attributes.id,
|
|
86
|
+
...( isPreviewingTheme() && {
|
|
87
|
+
wp_theme_preview: currentlyPreviewingTheme(),
|
|
88
|
+
} ),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
backPath: getPathFromURL( location.params ),
|
|
92
|
+
}
|
|
93
|
+
);
|
|
82
94
|
}
|
|
83
95
|
},
|
|
84
96
|
[ history ]
|
package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
privateApis as blockEditorPrivateApis,
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
BlockList,
|
|
8
|
-
BlockTools,
|
|
9
8
|
} from '@wordpress/block-editor';
|
|
10
9
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
10
|
import { createBlock } from '@wordpress/blocks';
|
|
@@ -106,9 +105,7 @@ export default function NavigationMenuContent( { rootClientId } ) {
|
|
|
106
105
|
/>
|
|
107
106
|
) }
|
|
108
107
|
<div className="edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor">
|
|
109
|
-
<
|
|
110
|
-
<BlockList />
|
|
111
|
-
</BlockTools>
|
|
108
|
+
<BlockList />
|
|
112
109
|
</div>
|
|
113
110
|
</>
|
|
114
111
|
);
|
|
@@ -28,10 +28,15 @@ import { unlock } from '../../lock-unlock';
|
|
|
28
28
|
const { useHistory } = unlock( routerPrivateApis );
|
|
29
29
|
|
|
30
30
|
const PageItem = ( { postType = 'page', postId, ...props } ) => {
|
|
31
|
-
const linkInfo = useLink(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const linkInfo = useLink(
|
|
32
|
+
{
|
|
33
|
+
postType,
|
|
34
|
+
postId,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
backPath: '/page',
|
|
38
|
+
}
|
|
39
|
+
);
|
|
35
40
|
return <SidebarNavigationItem { ...linkInfo } { ...props } />;
|
|
36
41
|
};
|
|
37
42
|
|
|
@@ -23,7 +23,7 @@ export default function TemplatePartNavigationMenu( { id } ) {
|
|
|
23
23
|
upperCase={ true }
|
|
24
24
|
weight={ 500 }
|
|
25
25
|
>
|
|
26
|
-
{ title
|
|
26
|
+
{ title || __( 'Navigation' ) }
|
|
27
27
|
</Heading>
|
|
28
28
|
<NavigationMenuEditor navigationMenuId={ id } />
|
|
29
29
|
</>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { parse } from '@wordpress/blocks';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
@@ -54,9 +59,14 @@ export default function useNavigationMenuContent( postType, postId ) {
|
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
|
|
62
|
+
const blocks =
|
|
63
|
+
record?.content && typeof record.content !== 'function'
|
|
64
|
+
? parse( record.content )
|
|
65
|
+
: [];
|
|
66
|
+
|
|
57
67
|
const navigationBlocks = getBlocksOfTypeFromBlocks(
|
|
58
68
|
'core/navigation',
|
|
59
|
-
|
|
69
|
+
blocks
|
|
60
70
|
);
|
|
61
71
|
|
|
62
72
|
if ( ! navigationBlocks.length ) {
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { sentenceCase } from 'change-case';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import { __, sprintf
|
|
9
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
6
12
|
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { Icon } from '@wordpress/components';
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Internal dependencies
|
|
@@ -28,6 +33,11 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
28
33
|
postType,
|
|
29
34
|
postId
|
|
30
35
|
);
|
|
36
|
+
const templatePartAreas = useSelect(
|
|
37
|
+
( select ) =>
|
|
38
|
+
select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
|
|
39
|
+
[]
|
|
40
|
+
);
|
|
31
41
|
const currentTheme = useSelect(
|
|
32
42
|
( select ) => select( coreStore ).getCurrentTheme(),
|
|
33
43
|
[]
|
|
@@ -36,56 +46,24 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
36
46
|
const isAddedByActiveTheme =
|
|
37
47
|
addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
|
|
38
48
|
const title = getTitle();
|
|
39
|
-
let
|
|
49
|
+
let description = getDescription();
|
|
40
50
|
|
|
41
|
-
if ( !
|
|
42
|
-
|
|
51
|
+
if ( ! description && addedBy.text ) {
|
|
52
|
+
description = sprintf(
|
|
43
53
|
// translators: %s: pattern title e.g: "Header".
|
|
44
54
|
__( 'This is the %s pattern.' ),
|
|
45
55
|
getTitle()
|
|
46
56
|
);
|
|
47
57
|
}
|
|
48
58
|
|
|
49
|
-
if ( !
|
|
50
|
-
|
|
59
|
+
if ( ! description && postType === 'wp_block' && record?.title ) {
|
|
60
|
+
description = sprintf(
|
|
51
61
|
// translators: %s: user created pattern title e.g. "Footer".
|
|
52
62
|
__( 'This is the %s pattern.' ),
|
|
53
63
|
record.title
|
|
54
64
|
);
|
|
55
65
|
}
|
|
56
66
|
|
|
57
|
-
const description = (
|
|
58
|
-
<>
|
|
59
|
-
{ descriptionText }
|
|
60
|
-
|
|
61
|
-
{ addedBy.text && ! isAddedByActiveTheme && (
|
|
62
|
-
<span className="edit-site-sidebar-navigation-screen-pattern__added-by-description">
|
|
63
|
-
<span className="edit-site-sidebar-navigation-screen-pattern__added-by-description-author">
|
|
64
|
-
<span className="edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon">
|
|
65
|
-
{ addedBy.imageUrl ? (
|
|
66
|
-
<img
|
|
67
|
-
src={ addedBy.imageUrl }
|
|
68
|
-
alt=""
|
|
69
|
-
width="24"
|
|
70
|
-
height="24"
|
|
71
|
-
/>
|
|
72
|
-
) : (
|
|
73
|
-
<Icon icon={ addedBy.icon } />
|
|
74
|
-
) }
|
|
75
|
-
</span>
|
|
76
|
-
{ addedBy.text }
|
|
77
|
-
</span>
|
|
78
|
-
|
|
79
|
-
{ addedBy.isCustomized && (
|
|
80
|
-
<span className="edit-site-sidebar-navigation-screen-pattern__added-by-description-customized">
|
|
81
|
-
{ _x( '(Customized)', 'pattern' ) }
|
|
82
|
-
</span>
|
|
83
|
-
) }
|
|
84
|
-
</span>
|
|
85
|
-
) }
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
|
|
89
67
|
const footer = !! record?.modified ? (
|
|
90
68
|
<SidebarNavigationScreenDetailsFooter
|
|
91
69
|
lastModifiedDateTime={ record.modified }
|
|
@@ -94,7 +72,7 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
94
72
|
|
|
95
73
|
const details = [];
|
|
96
74
|
|
|
97
|
-
if ( postType === 'wp_block' ) {
|
|
75
|
+
if ( postType === 'wp_block' || 'wp_template_part' ) {
|
|
98
76
|
details.push( {
|
|
99
77
|
label: __( 'Syncing' ),
|
|
100
78
|
value:
|
|
@@ -104,8 +82,59 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
104
82
|
} );
|
|
105
83
|
}
|
|
106
84
|
|
|
85
|
+
if ( postType === 'wp_template_part' ) {
|
|
86
|
+
const templatePartArea = templatePartAreas.find(
|
|
87
|
+
( area ) => area.area === record.area
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
let areaDetailValue = templatePartArea?.label;
|
|
91
|
+
|
|
92
|
+
if ( ! areaDetailValue ) {
|
|
93
|
+
areaDetailValue = record.area
|
|
94
|
+
? sprintf(
|
|
95
|
+
// translators: %s: Sentenced cased template part area e.g: "My custom area".
|
|
96
|
+
__( '%s (removed)' ),
|
|
97
|
+
sentenceCase( record.area )
|
|
98
|
+
)
|
|
99
|
+
: __( 'None' );
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
details.push( { label: __( 'Area' ), value: areaDetailValue } );
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (
|
|
106
|
+
postType === 'wp_template_part' &&
|
|
107
|
+
addedBy.text &&
|
|
108
|
+
! isAddedByActiveTheme
|
|
109
|
+
) {
|
|
110
|
+
details.push( {
|
|
111
|
+
label: __( 'Added by' ),
|
|
112
|
+
value: (
|
|
113
|
+
<span className="edit-site-sidebar-navigation-screen-pattern__added-by-description-author">
|
|
114
|
+
{ addedBy.text }
|
|
115
|
+
</span>
|
|
116
|
+
),
|
|
117
|
+
} );
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (
|
|
121
|
+
postType === 'wp_template_part' &&
|
|
122
|
+
addedBy.text &&
|
|
123
|
+
( record.origin === 'plugin' || record.has_theme_file === true )
|
|
124
|
+
) {
|
|
125
|
+
details.push( {
|
|
126
|
+
label: __( 'Customized' ),
|
|
127
|
+
value: (
|
|
128
|
+
<span className="edit-site-sidebar-navigation-screen-pattern__added-by-description-customized">
|
|
129
|
+
{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }
|
|
130
|
+
</span>
|
|
131
|
+
),
|
|
132
|
+
} );
|
|
133
|
+
}
|
|
134
|
+
|
|
107
135
|
const content = (
|
|
108
136
|
<>
|
|
137
|
+
{ useNavigationMenuContent( postType, postId ) }
|
|
109
138
|
{ !! details.length && (
|
|
110
139
|
<SidebarNavigationScreenDetailsPanel
|
|
111
140
|
spacing={ 5 }
|
|
@@ -123,7 +152,6 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
123
152
|
) ) }
|
|
124
153
|
</SidebarNavigationScreenDetailsPanel>
|
|
125
154
|
) }
|
|
126
|
-
{ useNavigationMenuContent( postType, postId ) }
|
|
127
155
|
</>
|
|
128
156
|
);
|
|
129
157
|
|
|
@@ -12,19 +12,11 @@ export default function CategoryItem( {
|
|
|
12
12
|
label,
|
|
13
13
|
type,
|
|
14
14
|
} ) {
|
|
15
|
-
const linkInfo = useLink(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
// Keep a record of where we came from in state so we can
|
|
23
|
-
// use the browser's back button to go back to Patterns.
|
|
24
|
-
// See the implementation of the back button in patterns-list.
|
|
25
|
-
backPath: '/patterns',
|
|
26
|
-
}
|
|
27
|
-
);
|
|
15
|
+
const linkInfo = useLink( {
|
|
16
|
+
path: '/patterns',
|
|
17
|
+
categoryType: type,
|
|
18
|
+
categoryId: id,
|
|
19
|
+
} );
|
|
28
20
|
|
|
29
21
|
if ( ! count ) {
|
|
30
22
|
return;
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
__experimentalHeading as Heading,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
13
|
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
15
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
16
15
|
import { getQueryArgs } from '@wordpress/url';
|
|
@@ -24,7 +23,6 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
24
23
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
25
24
|
import CategoryItem from './category-item';
|
|
26
25
|
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';
|
|
27
|
-
import { store as editSiteStore } from '../../store';
|
|
28
26
|
import { useLink } from '../routes/link';
|
|
29
27
|
import usePatternCategories from './use-pattern-categories';
|
|
30
28
|
import useMyPatterns from './use-my-patterns';
|
|
@@ -108,11 +106,6 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
108
106
|
const { patternCategories, hasPatterns } = usePatternCategories();
|
|
109
107
|
const { myPatterns } = useMyPatterns();
|
|
110
108
|
|
|
111
|
-
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
112
|
-
const settings = select( editSiteStore ).getSettings();
|
|
113
|
-
return !! settings.supportsTemplatePartsMode;
|
|
114
|
-
}, [] );
|
|
115
|
-
|
|
116
109
|
const templatePartsLink = useLink( { path: '/wp_template_part/all' } );
|
|
117
110
|
const footer = ! isMobileViewport ? (
|
|
118
111
|
<ItemGroup>
|
|
@@ -131,7 +124,6 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
131
124
|
|
|
132
125
|
return (
|
|
133
126
|
<SidebarNavigationScreen
|
|
134
|
-
isRoot={ isTemplatePartsMode }
|
|
135
127
|
title={ __( 'Patterns' ) }
|
|
136
128
|
description={ __(
|
|
137
129
|
'Manage what patterns are available when editing the site.'
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
11
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
13
12
|
|
|
@@ -18,7 +17,6 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
|
18
17
|
import { useLink } from '../routes/link';
|
|
19
18
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
20
19
|
import AddNewTemplate from '../add-new-template';
|
|
21
|
-
import { store as editSiteStore } from '../../store';
|
|
22
20
|
import SidebarButton from '../sidebar-button';
|
|
23
21
|
|
|
24
22
|
const TemplateItem = ( { postType, postId, ...props } ) => {
|
|
@@ -31,11 +29,6 @@ const TemplateItem = ( { postType, postId, ...props } ) => {
|
|
|
31
29
|
|
|
32
30
|
export default function SidebarNavigationScreenTemplates() {
|
|
33
31
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
34
|
-
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
35
|
-
const settings = select( editSiteStore ).getSettings();
|
|
36
|
-
|
|
37
|
-
return !! settings.supportsTemplatePartsMode;
|
|
38
|
-
}, [] );
|
|
39
32
|
|
|
40
33
|
const { records: templates, isResolving: isLoading } = useEntityRecords(
|
|
41
34
|
'postType',
|
|
@@ -51,10 +44,9 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
51
44
|
);
|
|
52
45
|
|
|
53
46
|
const browseAllLink = useLink( { path: '/wp_template/all' } );
|
|
54
|
-
const canCreate = ! isMobileViewport
|
|
47
|
+
const canCreate = ! isMobileViewport;
|
|
55
48
|
return (
|
|
56
49
|
<SidebarNavigationScreen
|
|
57
|
-
isRoot={ isTemplatePartsMode }
|
|
58
50
|
title={ __( 'Templates' ) }
|
|
59
51
|
description={ __(
|
|
60
52
|
'Express the layout of your site with templates'
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
5
6
|
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
11
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
11
13
|
|
|
12
14
|
const config = {
|
|
13
15
|
wp_template: {
|
|
@@ -29,8 +31,16 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
29
31
|
const {
|
|
30
32
|
params: { postType },
|
|
31
33
|
} = useNavigator();
|
|
34
|
+
|
|
35
|
+
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
36
|
+
const settings = select( editSiteStore ).getSettings();
|
|
37
|
+
|
|
38
|
+
return !! settings.supportsTemplatePartsMode;
|
|
39
|
+
}, [] );
|
|
40
|
+
|
|
32
41
|
return (
|
|
33
42
|
<SidebarNavigationScreen
|
|
43
|
+
isRoot={ isTemplatePartsMode }
|
|
34
44
|
title={ config[ postType ].title }
|
|
35
45
|
description={ config[ postType ].description }
|
|
36
46
|
backPath={ config[ postType ].backPath }
|
|
@@ -21,6 +21,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
21
21
|
import { forwardRef } from '@wordpress/element';
|
|
22
22
|
import { search, external } from '@wordpress/icons';
|
|
23
23
|
import { store as commandsStore } from '@wordpress/commands';
|
|
24
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Internal dependencies
|
|
@@ -174,7 +175,7 @@ const SiteHub = forwardRef( ( { isTransparent, ...restProps }, ref ) => {
|
|
|
174
175
|
<Button
|
|
175
176
|
href={ homeUrl }
|
|
176
177
|
target="_blank"
|
|
177
|
-
label={ __( 'View site' ) }
|
|
178
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
178
179
|
aria-label={ __(
|
|
179
180
|
'View site (opens in a new tab)'
|
|
180
181
|
) }
|
|
@@ -192,6 +193,7 @@ const SiteHub = forwardRef( ( { isTransparent, ...restProps }, ref ) => {
|
|
|
192
193
|
icon={ search }
|
|
193
194
|
onClick={ () => openCommandCenter() }
|
|
194
195
|
label={ __( 'Open command palette' ) }
|
|
196
|
+
shortcut={ displayShortcut.primary( 'k' ) }
|
|
195
197
|
/>
|
|
196
198
|
) }
|
|
197
199
|
</HStack>
|
|
@@ -19,13 +19,12 @@
|
|
|
19
19
|
|
|
20
20
|
.edit-site-site-hub__site-view-link {
|
|
21
21
|
flex-grow: 0;
|
|
22
|
+
margin-right: var(--wp-admin-border-width-focus);
|
|
22
23
|
@include break-mobile() {
|
|
23
24
|
opacity: 0;
|
|
24
25
|
transition: opacity 0.2s ease-in-out;
|
|
25
26
|
}
|
|
26
27
|
&:focus {
|
|
27
|
-
outline: none;
|
|
28
|
-
box-shadow: none;
|
|
29
28
|
opacity: 1;
|
|
30
29
|
}
|
|
31
30
|
svg {
|