Skip to content

Commit

Permalink
Merge branch 'trunk' into fix-68550/add-cut-block-action
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshbhutkar committed Jan 28, 2025
2 parents 4e05b76 + 2abe6fa commit 7601dc3
Show file tree
Hide file tree
Showing 41 changed files with 188 additions and 445 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Use desired version of Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: '.nvmrc'
check-latest: true
Expand Down Expand Up @@ -336,7 +336,7 @@ jobs:
git config user.email [email protected]
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: 'main/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Use desired version of Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: '.nvmrc'
check-latest: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-npm-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ jobs:
- name: Setup Node.js
if: ${{ github.event.inputs.release_type != 'wp' }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: 'cli/.nvmrc'
registry-url: 'https://registry.npmjs.org'
check-latest: true

- name: Setup Node.js (for WP major version)
if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }}
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: 'publish/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- uses: ruby/setup-ruby@28c4deda893d5a96a6b2d958c5b47fc18d65c9d3 # v1.213.0
- uses: ruby/setup-ruby@1287d2b408066abada82d5ad1c63652e758428d9 # v1.214.0
with:
# `.ruby-version` file location
working-directory: packages/react-native-editor/ios
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- name: Use desired version of Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: '.nvmrc'
check-latest: true
Expand Down
296 changes: 2 additions & 294 deletions changelog.txt

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/reference-guides/slotfills/main-dashboard-button.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ registerPlugin( 'main-dashboard-button-test', {

### Change the icon and link

This example will change the icon in the header to indicate an external link that will take the user to http://wordpress.org when clicked.
This example will change the icon in the header to indicate an external link that will take the user to https://wordpress.org when clicked.

```js
import { registerPlugin } from '@wordpress/plugins';
Expand All @@ -45,7 +45,7 @@ import { external } from '@wordpress/icons';

const MainDashboardButtonIconTest = () => (
<MainDashboardButton>
<FullscreenModeClose icon={ external } href="http://wordpress.org" />
<FullscreenModeClose icon={ external } href="https://wordpress.org" />
</MainDashboardButton>
);

Expand All @@ -54,4 +54,4 @@ registerPlugin( 'main-dashboard-button-icon-test', {
} );
```

![The edit post screen in fullscreen mode displaying an external link icon instead of the default W](https://developer.wordpress.org/files/2024/08/main-dashboard-button-external-link-example.png 'Change the icon in the header to indicate an external link that will take the user to http://wordpress.org when clicked')
![The edit post screen in fullscreen mode displaying an external link icon instead of the default W](https://developer.wordpress.org/files/2024/08/main-dashboard-button-external-link-example.png 'Change the icon in the header to indicate an external link that will take the user to https://wordpress.org when clicked')
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-resolver-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public static function get_theme_data( $deprecated = array(), $options = array()
}
if ( current_theme_supports( 'experimental-link-color' ) ) {
_doing_it_wrong(
current_theme_supports( 'experimental-link-color' ),
"add_theme_support( 'experimental-link-color' )",
__( '`experimental-link-color` is no longer supported. Use `link-color` instead.', 'gutenberg' ),
'6.3.0'
);
Expand Down
4 changes: 2 additions & 2 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ function gutenberg_enqueue_stored_styles( $options = array() ) {

// Combines Core styles.
if ( ! empty( $compiled_core_stylesheet ) ) {
wp_register_style( $style_tag_id, false, array(), true, true );
wp_register_style( $style_tag_id, false, array(), true );
wp_add_inline_style( $style_tag_id, $compiled_core_stylesheet );
wp_enqueue_style( $style_tag_id );
}
Expand All @@ -562,7 +562,7 @@ function gutenberg_enqueue_stored_styles( $options = array() ) {
$styles = gutenberg_style_engine_get_stylesheet_from_context( $store_name, $options );
if ( ! empty( $styles ) ) {
$key = "wp-style-engine-$store_name";
wp_register_style( $key, false, array(), true, true );
wp_register_style( $key, false, array(), true );
wp_add_inline_style( $key, $styles );
wp_enqueue_style( $key );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private static function handle_read_pending_messages( $subscriber_to_messages_pa
if ( ! $fd ) {
$retries = isset( $_COOKIE['signaling_server_retries'] ) ? intval( $_COOKIE['signaling_server_retries'] ) : 0;
$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
setcookie( 'signaling_server_retries', $retries + 1, time() + DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure );
setcookie( 'signaling_server_retries', (string) ( $retries + 1 ), time() + DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure );
echo 'id: ' . time() . PHP_EOL;
echo 'event: error' . PHP_EOL;
echo 'data: ' . 'Could not open required file.' . PHP_EOL . PHP_EOL;
Expand All @@ -183,7 +183,7 @@ private static function handle_read_pending_messages( $subscriber_to_messages_pa
if ( isset( $_COOKIE['signaling_server_retries'] ) ) {
$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
// unset the cookie using a past expiration date.
setcookie( 'signaling_server_retries', 0, time() - DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure );
setcookie( 'signaling_server_retries', '0', time() - DAY_IN_SECONDS, SITECOOKIEPATH, '', $secure );
}

echo 'retry: 3000' . PHP_EOL;
Expand Down
31 changes: 10 additions & 21 deletions packages/block-editor/src/components/grid/grid-visualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,18 @@ const GridVisualizerGrid = forwardRef(
const [ isDroppingAllowed, setIsDroppingAllowed ] = useState( false );

useEffect( () => {
const observers = [];
for ( const element of [ gridElement, ...gridElement.children ] ) {
const observer = new window.ResizeObserver( () => {
setGridInfo( getGridInfo( gridElement ) );
} );
observer.observe( element );
observers.push( observer );
}

const mutationObserver = new window.MutationObserver( () => {
const resizeCallback = () =>
setGridInfo( getGridInfo( gridElement ) );
} );
mutationObserver.observe( gridElement, {
attributeFilter: [ 'style', 'class' ],
childList: true,
subtree: true,
} );
observers.push( mutationObserver );

// Both border-box and content-box are observed as they may change
// independently. This requires two observers because a single one
// can’t be made to monitor both on the same element.
const borderBoxSpy = new window.ResizeObserver( resizeCallback );
borderBoxSpy.observe( gridElement, { box: 'border-box' } );
const contentBoxSpy = new window.ResizeObserver( resizeCallback );
contentBoxSpy.observe( gridElement );
return () => {
for ( const observer of observers ) {
observer.disconnect();
}
borderBoxSpy.disconnect();
contentBoxSpy.disconnect();
};
}, [ gridElement ] );

Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/grid/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

.block-editor-grid-visualizer__grid {
display: grid;
position: absolute;
}

.block-editor-grid-visualizer__cell {
Expand Down
10 changes: 6 additions & 4 deletions packages/block-editor/src/components/grid/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ export function getGridInfo( gridElement ) {
gridTemplateColumns,
gridTemplateRows,
gap: getComputedCSS( gridElement, 'gap' ),
paddingTop: `calc(${ paddingTop } + ${ borderTopWidth })`,
paddingRight: `calc(${ paddingRight } + ${ borderRightWidth })`,
paddingBottom: `calc(${ paddingBottom } + ${ borderBottomWidth })`,
paddingLeft: `calc(${ paddingLeft } + ${ borderLeftWidth })`,
inset: `
calc(${ paddingTop } + ${ borderTopWidth })
calc(${ paddingRight } + ${ borderRightWidth })
calc(${ paddingBottom } + ${ borderBottomWidth })
calc(${ paddingLeft } + ${ borderLeftWidth })
`,
},
};
}
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/**
* WordPress dependencies
*/
import { Button, Tooltip } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { link, linkOff } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

export default function LinkedButton( { isLinked, ...props } ) {
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<Button
{ ...props }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
/>
</Tooltip>
<Button
{ ...props }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
/>
);
}
5 changes: 5 additions & 0 deletions packages/block-library/src/comments-pagination/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"default": "none"
}
},
"example": {
"attributes": {
"paginationArrow": "none"
}
},
"providesContext": {
"comments/paginationArrow": "paginationArrow"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/navigation-submenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { page, addSubmenu } from '@wordpress/icons';
import { _x } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -37,6 +38,12 @@ export const settings = {
return label;
},
edit,
example: {
attributes: {
label: _x( 'About', 'Example link text for Navigation Submenu' ),
type: 'page',
},
},
save,
transforms,
};
Expand Down
25 changes: 21 additions & 4 deletions packages/block-library/src/navigation-submenu/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
$font_sizes = block_core_navigation_submenu_build_css_font_sizes( $block->context );
$style_attribute = $font_sizes['inline_styles'];

$css_classes = trim( implode( ' ', $font_sizes['css_classes'] ) );
$has_submenu = count( $block->inner_blocks ) > 0;
$kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] );
$is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind );
Expand All @@ -99,11 +98,29 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
$open_on_hover_and_click = isset( $block->context['openSubmenusOnClick'] ) && ! $block->context['openSubmenusOnClick'] &&
$show_submenu_indicators;

$classes = array(
'wp-block-navigation-item',
);
$classes = array_merge(
$classes,
$font_sizes['css_classes']
);
if ( $has_submenu ) {
$classes[] = 'has-child';
}
if ( $open_on_click ) {
$classes[] = 'open-on-click';
}
if ( $open_on_hover_and_click ) {
$classes[] = 'open-on-hover-click';
}
if ( $is_active ) {
$classes[] = 'current-menu-item';
}

$wrapper_attributes = get_block_wrapper_attributes(
array(
'class' => $css_classes . ' wp-block-navigation-item' . ( $has_submenu ? ' has-child' : '' ) .
( $open_on_click ? ' open-on-click' : '' ) . ( $open_on_hover_and_click ? ' open-on-hover-click' : '' ) .
( $is_active ? ' current-menu-item' : '' ),
'class' => implode( ' ', $classes ),
'style' => $style_attribute,
)
);
Expand Down
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- `BorderBoxControl`, `BoxControl`: Remove `Tooltip` component from linked button ([#68498](https://github.com/WordPress/gutenberg/pull/68498)).

### Internal

- `BoxControl`: Add runtime check for presets and presetKey ([#68385](https://github.com/WordPress/gutenberg/pull/68385)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import Button from '../../button';
import Tooltip from '../../tooltip';
import { View } from '../../view';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
import { useBorderBoxControlLinkedButton } from './hook';
Expand All @@ -25,18 +23,15 @@ const BorderBoxControlLinkedButton = (
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<View className={ className }>
<Button
{ ...buttonProps }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
ref={ forwardedRef }
/>
</View>
</Tooltip>
<Button
{ ...buttonProps }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
ref={ forwardedRef }
className={ className }
/>
);
};

Expand Down
19 changes: 8 additions & 11 deletions packages/components/src/box-control/linked-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import Button from '../button';
import Tooltip from '../tooltip';

export default function LinkedButton( {
isLinked,
Expand All @@ -17,15 +16,13 @@ export default function LinkedButton( {
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<Button
{ ...props }
className="component-box-control__linked-button"
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
/>
</Tooltip>
<Button
{ ...props }
className="component-box-control__linked-button"
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
/>
);
}
Loading

0 comments on commit 7601dc3

Please sign in to comment.