Skip to content

Commit

Permalink
Post Title in post editor: Allow root padding setting to affect paddi…
Browse files Browse the repository at this point in the history
…ng of post title (#49460)
  • Loading branch information
andrewserong authored Mar 30, 2023
1 parent 9ee0f4b commit a636abc
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,21 @@ export default function VisualEditor( { styles } ) {
( select ) => select( editPostStore ).hasMetaBoxes(),
[]
);
const { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =
useSelect( ( select ) => {
const _settings = select( blockEditorStore ).getSettings();
return {
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
themeSupportsLayout: _settings.supportsLayout,
isFocusMode: _settings.focusMode,
};
}, [] );
const {
hasRootPaddingAwareAlignments,
isFocusMode,
themeHasDisabledLayoutStyles,
themeSupportsLayout,
} = useSelect( ( select ) => {
const _settings = select( blockEditorStore ).getSettings();
return {
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
themeSupportsLayout: _settings.supportsLayout,
isFocusMode: _settings.focusMode,
hasRootPaddingAwareAlignments:
_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
};
}, [] );
const { clearSelectedBlock } = useDispatch( blockEditorStore );
const { setIsEditingTemplate } = useDispatch( editPostStore );
const desktopCanvasStyles = {
Expand Down Expand Up @@ -393,6 +399,8 @@ export default function VisualEditor( { styles } ) {
'edit-post-visual-editor__post-title-wrapper',
{
'is-focus-mode': isFocusMode,
'has-global-padding':
hasRootPaddingAwareAlignments,
},
'is-layout-flow'
) }
Expand Down

0 comments on commit a636abc

Please sign in to comment.