Experimental: Expand Editor Inspector: Use DataForm experiment to templates#76934
Experimental: Expand Editor Inspector: Use DataForm experiment to templates#76934ntsekouras wants to merge 14 commits intotrunkfrom
Conversation
|
Size Change: +1.2 kB (+0.02%) Total Size: 7.74 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in acc92f6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24191046462
|
194063a to
42286ae
Compare
| if ( field.id === 'description' ) { | ||
| // TODO: handle only for templates now.. | ||
| if ( postType === 'wp_template' && ! isCustomRecord ) { | ||
| return { ...field, readOnly: true }; |
There was a problem hiding this comment.
I see the field definition comes with an Edit config but then we set it to readOnly? 🤔 Perhaps this is due to the other conversation we had about how this implementation of description was trying to do much across post types, and we could have two separate fields instead.
There was a problem hiding this comment.
I'll have to explore more as I add stuff, but in general it's not about different post types. A template post type can be either readonly or not.
| return { | ||
| ...field, | ||
| elements: field.elements.filter( | ||
| ( element ) => element.value !== 'trash' | ||
| ), |
There was a problem hiding this comment.
I've been thinking about this kind of things. We need to absorb them as field definitions instead of overrides at the screen level. Perhaps we need to define a new status_without_trash field that is distinct to status.
42286ae to
ac152c8
Compare
a5039c4 to
c372148
Compare
b4e1d97 to
07345b8
Compare
1a7c5e3 to
3d51d09
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. |
| // special because it's responsible for updating a `page` attribute. | ||
| // We need to think this through how to best connect | ||
| // it with `Gutenberg_REST_View_Config_Controller_7_1`. | ||
| postTypeConfig.slug === 'wp_template' && blogTitleField, |
There was a problem hiding this comment.
Just starting a conversation for the comments to be more noticeable from reviewers.
| // The main problem I can think of right now is that when we have | ||
| // way to control the forms and fields through APIs, we won't have | ||
| // a way to control/remove this field. | ||
| const BLOG_TITLE_FORM = { |
There was a problem hiding this comment.
Just starting a conversation for the comments to be more noticeable from reviewers.
| } | ||
| } | ||
|
|
||
| .fields-controls__description.fields-controls__description { |
There was a problem hiding this comment.
FYI the old Text component is currently marked as not recommended for use. The new Text component shouldn't have any specificity problems since the styles are @layered. It will be available soon for use in the app.
There was a problem hiding this comment.
Nice! I didn't know about the new one. I'll update.
There was a problem hiding this comment.
I see there is a linting rule though with allowed: [ 'Badge', 'Stack' ],. Does this mean that the Text is not ready yet, or it's fine to use in fields package?
There was a problem hiding this comment.
Not ready yet! We'll update the lint rule as we remove the remaining blockers.
There was a problem hiding this comment.
Text is now allowed by the linter, by the way :)
There was a problem hiding this comment.
And, as mentioned before, doesn't set any colors
| // TODO: this is temp hack for preserving the field's color. | ||
| // `panel` layout makes readonly fields gray. | ||
| type: 'regular', | ||
| labelPosition: 'none', |
There was a problem hiding this comment.
Would it be fine to show the description label in the description? If yes, we wouldn't need this block of code. --cc @jameskoster.
There was a problem hiding this comment.
I don't think showing the description is too problematic. I'd certainly favor that over any hacks.
| _fields: 'id,date,author', | ||
| }; | ||
| // TODO: This should be updated with `wp_template_part` when we expand the experiment. | ||
| const POST_TYPES_USING_MODIFIED_DATE = [ 'wp_template' ]; |
There was a problem hiding this comment.
The revisions panel changes have been extracted here.
|
I will point out that It's unfortunate that now both "Posts per page" and "Comments closed" wrap. I realise that we are building something generic that has to wrap in order to be translatable, but the before and after as-is, is a regression on the default language. What options do we have to avoid this? |
In this commit I'm making the
|
|
Good question. I think in some cases the gap was 16px. @jameskoster I think you've been looking at spacing tokens lately. Any thoughts? One thing though: we're using sentence case with capital proper nouns across the software, so it should be "Posts per page" and "Blog title". |
Oh.. I didn't notice that. This is also part of DataForm styles for |
02bb03c to
97b3c01
Compare
97b3c01 to
acc92f6
Compare



What?
Part of: #76076
This PR expands the
Expand Editor Inspectorexperiment to templates.Testing Instructions
Expand Editor Inspectorexperimentfieldspackage.Posts per page anddiscussion) in template summary panel are shown only forhome/index` templates, so you need to test those tooblog titlefield is show only if you have set aPosts page(reading settings) and then edithome/indextemplates.Not a custom template
A custom template with description
A custom template without a description
This case highlights the possible confusion about the lack of an existing description and the way to add one.
We face the same issue for
excerptfield, which for now renders anadd an excerptas value (see screenshot below), but is wrong. If we used theexcerptfield in DataViews, like we do for thedescriptionfield, we shouldn't show such a message.A similar case is the title field where render a
(no title)when empty, but it's a special field which uses a well established default copy for a while. Also note that it doesn't contain any action verb and if we were to imitate that field, we'll end up showing (no excerpt/description). Finally thetitleis by far more important field for an entity than the excerpt/description, so would it be better to show in lists ano descriptionvalue? 🤔 I believe not.