-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Update the edit site save modal UI #20608
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,5 @@ | |
} | ||
|
||
.components-base-control + .components-base-control { | ||
margin-bottom: $grid-unit-20; | ||
margin-top: $grid-unit-20; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Well this rule is meant to style consecutive controls right to add space between them. and in general consecutive controls are one under the other (unless some flex positioning in the parent is involved) which means the margin should be top since the selector targets the second element. This was causing weird margins between the multiple entities in the popover. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think that was the intent of the rule, but if it was, then I agree the margin should be at the top. I'll look for a fix that doesn't style multiple consecutive base controls in this way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't think of any other reason why this rule could exist, and also I wonder if it's me that introduce this rule from the first release of BaseControl :P . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #20782 I removed it, an so far not seeing any issues. As far as I can tell, the rule was introduced here: https://github.com/WordPress/gutenberg/pull/13181/files#diff-7f4a5101433bca0f9e460c45196b772fR24 From the conversation, it's not immediately clear why that particular rule was necessary. But given additional sidebar polish that is meant to happen soon, I would expect these spacing rules to be revisited regardless. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { upperFirst, camelCase, map, find } from 'lodash'; | ||
import { upperFirst, camelCase, map, find, get, startCase } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -12,29 +17,49 @@ import { apiFetch, select } from './controls'; | |
export const DEFAULT_ENTITY_KEY = 'id'; | ||
|
||
export const defaultEntities = [ | ||
{ name: 'site', kind: 'root', baseURL: '/wp/v2/settings' }, | ||
{ name: 'postType', kind: 'root', key: 'slug', baseURL: '/wp/v2/types' }, | ||
{ | ||
label: __( 'Site' ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to introduce this "label" property and also a dependency towards i18n package. |
||
name: 'site', | ||
kind: 'root', | ||
baseURL: '/wp/v2/settings', | ||
}, | ||
{ | ||
label: __( 'Post Type' ), | ||
name: 'postType', | ||
kind: 'root', | ||
key: 'slug', | ||
baseURL: '/wp/v2/types', | ||
}, | ||
{ | ||
name: 'media', | ||
kind: 'root', | ||
baseURL: '/wp/v2/media', | ||
plural: 'mediaItems', | ||
label: __( 'Media' ), | ||
}, | ||
{ | ||
name: 'taxonomy', | ||
kind: 'root', | ||
key: 'slug', | ||
baseURL: '/wp/v2/taxonomies', | ||
plural: 'taxonomies', | ||
label: __( 'Taxonomy' ), | ||
}, | ||
{ | ||
name: 'widgetArea', | ||
kind: 'root', | ||
baseURL: '/__experimental/widget-areas', | ||
plural: 'widgetAreas', | ||
transientEdits: { blocks: true }, | ||
label: __( 'Widget area' ), | ||
}, | ||
{ | ||
label: __( 'User' ), | ||
name: 'user', | ||
kind: 'root', | ||
baseURL: '/wp/v2/users', | ||
plural: 'users', | ||
}, | ||
{ name: 'user', kind: 'root', baseURL: '/wp/v2/users', plural: 'users' }, | ||
]; | ||
|
||
export const kinds = [ | ||
|
@@ -54,12 +79,19 @@ function* loadPostTypeEntities() { | |
kind: 'postType', | ||
baseURL: '/wp/v2/' + postType.rest_base, | ||
name, | ||
label: postType.labels.singular_name, | ||
transientEdits: { | ||
blocks: true, | ||
selectionStart: true, | ||
selectionEnd: true, | ||
}, | ||
mergedEdits: { meta: true }, | ||
getTitle( record ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is supposed to be a generic way to get a "title"/"caption"/"label" of any Entity Record. Notice that it still needs some specific behavior. |
||
if ( name === 'wp_template_part' || name === 'wp_template' ) { | ||
return startCase( record.slug ); | ||
} | ||
return get( record, [ 'title', 'rendered' ], record.id ); | ||
}, | ||
}; | ||
} ); | ||
} | ||
|
@@ -78,6 +110,7 @@ function* loadTaxonomyEntities() { | |
kind: 'taxonomy', | ||
baseURL: '/wp/v2/' + taxonomy.rest_base, | ||
name, | ||
label: taxonomy.labels.singular_name, | ||
}; | ||
} ); | ||
} | ||
|
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 selector was very hard to work with and I checked wpdirectory.net it's not something that is used by plugins and is unlikely to be used before FSE.