-
Notifications
You must be signed in to change notification settings - Fork 2k
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
FSE: Add a site description block. #33720
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
918a344
to
07d134b
Compare
<PlainText | ||
className="wp-block-a8c-site-description" | ||
value={ this.state.value } | ||
onChange={ value => this.setState( { value } ) } |
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.
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.
Oh, interesting; my Update button is always available (although that makes no sense either 🙃 ). Will dig further. But we don't want to be saving attributes for this block (we shouldn't ever see <!-- wp:a8c/site-description {"description":"tagline"} /-->
in markup for instance) 🤔
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.
...l-site-editing/full-site-editing-plugin/full-site-editing/blocks/site-description/style.scss
Outdated
Show resolved
Hide resolved
componentDidUpdate( prevProps ) { | ||
if ( | ||
prevProps.isSaving === false && | ||
this.props.isSaving === true && |
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.
This is also updating the site description during autosaves (i.e. when clicking on the Preview button), but I think we should only update it when the user explicitly has clicked on the Publish/Update button.
4e506cb
to
6f6798b
Compare
I noted you removed the previous code that was allowing to update the site description from the block. Are you planning to add that back on this PR? |
|
||
componentDidMount() { | ||
const { setAttributes } = this.props; | ||
try { |
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.
This is equivalent to apiFetch.then( successHandler, rejectHandler )
or apiFetch.then( successHandler ).catch( anyThrownErrorsFromErrorOrSuccessHandler );
better cooperate with other editor UI state.
5cf206b
to
6c7a1de
Compare
I did! I stripped it out because I was getting confused while sorting the attributes. With attributes working properly, I can add it back in, yes 👍 |
@kwight I committed some changes reverting the usage of attributes and moving back to a local state approach. We have #34004 in progress to determine a better way to make the Publish button clickable when there are changes in the site blocks. That means that I also added back the logic that was saving the description. In the last commit (c2efb58) I also modified the code to align it more with the work done in #33761. Feel free to review those changes and land this PR if you're happy with them or change anything you want :) |
@@ -312,7 +312,7 @@ public function enqueue_script_and_style() { | |||
wp_enqueue_style( | |||
'a8c-full-site-editing-style', | |||
plugins_url( 'dist/' . $style_file, __FILE__ ), | |||
array(), | |||
'wp-edit-post', |
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.
This is to ensure that our styles are loaded after the Gutenberg styles for the editor, making easier to override a specific style.
* External dependencies | ||
*/ | ||
import apiFetch from '@wordpress/api-fetch'; | ||
import { PlainText } from '@wordpress/block-editor'; |
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.
We probably should use the older editor
package until support is dropped. This will allow for Gutenberg support across more versions
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.
Oh, will do, good idea.
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.
import './style.scss'; | ||
|
||
registerBlockType( 'a8c/site-description', { | ||
title: __( 'Site Description2' ), |
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.
@kwight Typo?
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.
That was me trying to verify I was getting the latest build on my local environment 😅. Will prep a PR reverting this in a bit
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.
Changes proposed in this Pull Request
Let's add a basic site description block, for use with Full Site Editing.
Testing instructions
Fixes #33107 .