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

Post editor: fix title margin #46698

Merged
merged 2 commits into from
Dec 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,17 @@ export default function VisualEditor( { styles } ) {
titleRef?.current?.focus();
}, [ isWelcomeGuideVisible, isCleanNewPost ] );

styles = useMemo(
() => [
...styles,
{
// We should move this in to future to the body.
css: `.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}`,
},
],
[ styles ]
);

return (
<BlockTools
__unstableContentRef={ ref }
Expand Down Expand Up @@ -374,10 +385,15 @@ export default function VisualEditor( { styles } ) {
{ ! isTemplateMode && (
<div
className={ classnames(
// This wrapper div should have the same
// classes as the block list beneath.
'is-root-container',
'block-editor-block-list__layout',
'edit-post-visual-editor__post-title-wrapper',
{
'is-focus-mode': isFocusMode,
}
},
blockListLayoutClass
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For TT3, these classes are enough to restore the padding, but some themes use block-editor-block-list__layout or is-root-container. We should just make sure we use the same classes as the root block list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we also render the post title as a proper block, but that's a bit of a challenge right now.

) }
contentEditable={ false }
>
Expand Down