Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Use the same PostTemplatePanel between post and site editors #56817

Merged
merged 8 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/base-styles/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ $z-layers: (
".block-editor-block-rename-modal": 1000001,
".edit-site-list__rename-modal": 1000001,
".dataviews-action-modal": 1000001,
".edit-site-swap-template-modal": 1000001,
".editor-post-template__swap-template-modal": 1000001,
".edit-site-template-panel__replace-template-modal": 1000001,

// Note: The ConfirmDialog component's z-index is being set to 1000001 in packages/components/src/confirm-dialog/styles.ts
Expand Down Expand Up @@ -156,9 +156,6 @@ $z-layers: (
// Show tooltips above NUX tips, wp-admin menus, submenus, and sidebar:
".components-tooltip": 1000002,

// Keep template popover underneath 'Create custom template' modal overlay.
".edit-post-post-template__dialog": 99999,

// Make sure corner handles are above side handles for ResizableBox component
".components-resizable-box__handle": 2,
".components-resizable-box__side-handle": 2,
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Header( {
select( blockEditorStore ).getBlockSelectionStart(),
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
isEditingTemplate:
select( editorStore ).getRenderingMode() !== 'post-only',
select( editorStore ).getRenderingMode() === 'template-only',
isPublishSidebarOpened:
select( editPostStore ).isPublishSidebarOpened(),
hasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function ModeSwitcher() {
isCodeEditingEnabled:
select( editorStore ).getEditorSettings().codeEditingEnabled,
isEditingTemplate:
select( editorStore ).getRenderingMode() !== 'post-only',
select( editorStore ).getRenderingMode() === 'template-only',
mode: select( editPostStore ).getEditorMode(),
} ),
[]
Expand Down
8 changes: 4 additions & 4 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ function Layout() {
showIconLabels,
isDistractionFree,
showBlockBreadcrumbs,
isTemplateMode,
showMetaBoxes,
documentLabel,
} = useSelect( ( select ) => {
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
const editorSettings = getEditorSettings();
const postTypeLabel = getPostTypeLabel();

return {
isTemplateMode:
select( editorStore ).getRenderingMode() !== 'post-only',
showMetaBoxes:
select( editorStore ).getRenderingMode() === 'post-only',
hasFixedToolbar:
select( editPostStore ).isFeatureActive( 'fixedToolbar' ),
sidebarIsOpened: !! (
Expand Down Expand Up @@ -349,7 +349,7 @@ function Layout() {
{ isRichEditingEnabled && mode === 'visual' && (
<VisualEditor styles={ styles } />
) }
{ ! isDistractionFree && ! isTemplateMode && (
{ ! isDistractionFree && showMetaBoxes && (
<div className="edit-post-layout__metaboxes">
<MetaBoxes location="normal" />
<MetaBoxes location="advanced" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
PostSwitchToDraftButton,
PostSyncStatus,
PostURLPanel,
PostTemplatePanel,
} from '@wordpress/editor';

/**
Expand All @@ -26,7 +27,6 @@ import PostFormat from '../post-format';
import PostPendingStatus from '../post-pending-status';
import PluginPostStatusInfo from '../plugin-post-status-info';
import { store as editPostStore } from '../../../store';
import PostTemplate from '../post-template';

/**
* Module Constants
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function PostStatus() {
<>
<PostVisibility />
<PostSchedulePanel />
<PostTemplate />
<PostTemplatePanel />
<PostURLPanel />
<PostSyncStatus />
<PostSticky />
Expand Down
141 changes: 0 additions & 141 deletions packages/edit-post/src/components/sidebar/post-template/form.js

This file was deleted.

120 changes: 0 additions & 120 deletions packages/edit-post/src/components/sidebar/post-template/index.js

This file was deleted.

22 changes: 0 additions & 22 deletions packages/edit-post/src/components/sidebar/post-template/style.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SettingsHeader = ( { sidebarName } ) => {
return {
// translators: Default label for the Document sidebar tab, not selected.
documentLabel: getPostTypeLabel() || _x( 'Document', 'noun' ),
isTemplateMode: getRenderingMode() !== 'post-only',
isTemplateMode: getRenderingMode() === 'template-only',
};
}, [] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ const SettingsSidebar = () => {
sidebarName: sidebar,
keyboardShortcut: shortcut,
isTemplateMode:
select( editorStore ).getRenderingMode() !== 'post-only',
select( editorStore ).getRenderingMode() ===
'template-only',
};
},
[]
Expand Down