Skip to content

Commit

Permalink
Editor: Use the same PostTemplatePanel between post and site editors
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 6, 2023
1 parent efa4b01 commit ecbbbec
Show file tree
Hide file tree
Showing 31 changed files with 375 additions and 565 deletions.
2 changes: 1 addition & 1 deletion 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
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,14 +62,14 @@ export default function PostStatus() {
<>
<PostVisibility />
<PostSchedulePanel />
<PostTemplate />
<PostURLPanel />
<PostSyncStatus />
<PostSticky />
<PostPendingStatus />
<PostFormat />
<PostSlug />
<PostTemplatePanel />
<PostAuthorPanel />
<PostSticky />
<PostPendingStatus />
{ fills }
<HStack
style={ {
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
Loading

0 comments on commit ecbbbec

Please sign in to comment.