-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Editor: Update WordPress packages published for Gutenberg 10.6 #1257
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
Changes from all commits
7dadab1
46d2374
fd24471
904148e
86bc8fa
bac3140
9921bdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| function wp_register_border_support( $block_type ) { | ||
| // Determine if any border related features are supported. | ||
| $has_border_support = block_has_support( $block_type, array( '__experimentalBorder' ) ); | ||
| $has_border_color_support = block_has_support( $block_type, array( '__experimentalBorder', 'color' ) ); | ||
| $has_border_color_support = wp_has_border_feature_support( $block_type, 'color' ); | ||
|
|
||
| // Setup attributes and styles within that if needed. | ||
| if ( ! $block_type->attributes ) { | ||
|
|
@@ -60,7 +60,7 @@ function wp_apply_border_support( $block_type, $block_attributes ) { | |
|
|
||
| // Border radius. | ||
| if ( | ||
| block_has_support( $block_type, array( '__experimentalBorder', 'radius' ) ) && | ||
| wp_has_border_feature_support( $block_type, 'radius' ) && | ||
| isset( $block_attributes['style']['border']['radius'] ) | ||
| ) { | ||
| $border_radius = (int) $block_attributes['style']['border']['radius']; | ||
|
|
@@ -69,7 +69,7 @@ function wp_apply_border_support( $block_type, $block_attributes ) { | |
|
|
||
| // Border style. | ||
| if ( | ||
| block_has_support( $block_type, array( '__experimentalBorder', 'style' ) ) && | ||
| wp_has_border_feature_support( $block_type, 'style' ) && | ||
| isset( $block_attributes['style']['border']['style'] ) | ||
| ) { | ||
| $border_style = $block_attributes['style']['border']['style']; | ||
|
|
@@ -78,15 +78,15 @@ function wp_apply_border_support( $block_type, $block_attributes ) { | |
|
|
||
| // Border width. | ||
| if ( | ||
| block_has_support( $block_type, array( '__experimentalBorder', 'width' ) ) && | ||
| wp_has_border_feature_support( $block_type, 'width' ) && | ||
| isset( $block_attributes['style']['border']['width'] ) | ||
| ) { | ||
| $border_width = intval( $block_attributes['style']['border']['width'] ); | ||
| $styles[] = sprintf( 'border-width: %dpx;', $border_width ); | ||
| } | ||
|
|
||
| // Border color. | ||
| if ( block_has_support( $block_type, array( '__experimentalBorder', 'color' ) ) ) { | ||
| if ( wp_has_border_feature_support( $block_type, 'color' ) ) { | ||
| $has_named_border_color = array_key_exists( 'borderColor', $block_attributes ); | ||
| $has_custom_border_color = isset( $block_attributes['style']['border']['color'] ); | ||
|
|
||
|
|
@@ -135,6 +135,37 @@ function wp_skip_border_serialization( $block_type ) { | |
| $border_support['__experimentalSkipSerialization']; | ||
| } | ||
|
|
||
| /** | ||
| * Checks whether the current block type supports the border feature requested. | ||
| * | ||
| * If the `__experimentalBorder` support flag is a boolean `true` all border | ||
| * support features are available. Otherwise, the specific feature's support | ||
| * flag nested under `experimentalBorder` must be enabled for the feature | ||
| * to be opted into. | ||
| * | ||
| * @since 5.8.0 | ||
| * @access private | ||
| * | ||
| * @param WP_Block_Type $block_type Block type to check for support. | ||
| * @param string $feature Name of the feature to check support for. | ||
| * @param mixed $default Fallback value for feature support, defaults to false. | ||
| * | ||
| * @return boolean Whether or not the feature is supported. | ||
| */ | ||
| function wp_has_border_feature_support( $block_type, $feature, $default = false ) { | ||
| // Check if all border support features have been opted into via `"__experimentalBorder": true`. | ||
| if ( | ||
| property_exists( $block_type, 'supports' ) && | ||
| ( true === _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), $default ) ) | ||
| ) { | ||
| return true; | ||
| } | ||
|
Contributor
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 part can probably use
Member
Author
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. Yes, let's fix in Gutenberg and backport with 10.7 version. |
||
|
|
||
| // Check if the specific feature has been opted into individually | ||
| // via nested flag under `__experimentalBorder`. | ||
| return block_has_support( $block_type, array( '__experimentalBorder', $feature ), $default ); | ||
| } | ||
|
|
||
| // Register the block support. | ||
| WP_Block_Supports::get_instance()->register( | ||
| 'border', | ||
|
|
||
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 no longer publish ES5 code to npm. All WordPress packages work with ES2015+ from now on.
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.
Can you clarify the change a bit more :p
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 excludes WP packages from JSHint validation.
js/distfolder contains files built fromnode_moduleswith webpack.