-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Use padding appender hook in Site editor #72598
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
Conversation
|
Size Change: -137 B (-0.01%) Total Size: 2.38 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in db40595. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18983657151
|
| 'edit-site-editor__loading-progress' | ||
| ); | ||
|
|
||
| const [ paddingAppenderRef, paddingStyle ] = usePaddingAppender( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating the logic between post and site editor, Should we just move it to the "editor" component (there's already a number of similar hooks there)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most definitely. I gave that a look initially but missed that it could indeed work simply (I thought it'd require and added a prop on Editor). Now, the hook is incorporated into VisualEditor which is the one I assume you meant.
8bd47ce to
db40595
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
It's looking good to me code wise. I can't give it a proper test at the moment. I'd love if some one can test a little bit. Otherwise this is great. Thanks :) |
| templateId={ templateId } | ||
| className={ className } | ||
| forceIsDirty={ hasActiveMetaboxes } | ||
| contentRef={ paddingAppenderRef } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if contentRef is still needed or if we can remove the prop from the editor components.
| } | ||
|
|
||
| return baseStyles; | ||
| return hasThemeStyles ? settings.styles ?? [] : defaultEditorStyles; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theme styles toggle is another thing that we should move to the editor package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I supposed that would always remain a Post editor only feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it was just a feeling that it would have already been done if it were desirable. I could see wanting to have the logic for handling it in the editor package and maybe that’s all you're suggesting. Unless there is demand, I wouldn’t think the site editor should expose the toggle in the preferences UI for now.
What?
Closes #65925
Adds the ability to click after the post content to add the default block when editing in post-only mode.
Why?
For parity with the post-only editing experience in the Post editor.
How?
Moves the hook to the editor package and incorporates it into
VisualEditor.Additionally cleans up a now unused rest parameter in a hook of the edit-post’s Layout component db40595
Testing Instructions
For both post and site editors
Site Editor specific
After verifying the padding is applied, open the navigation so the page is shown in view mode and ensure the padding is not added after the post content.
Note
I think the padding appender is supposed to focus the last default block if one‘s already inserted and that doesn’t seem to be working but seems to be the case before these changes. UPDATE: this was also noted by @Mamaduka and there’s fix in #72821.