From 39ed61df5b692fc54f3d119f8cb177ea9db47d6b Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:27:33 +0900 Subject: [PATCH 1/6] wp-env: Add phpMyAdmin and multisite support to the documentation (#68125) * wp-env: Added phpMyAdmin and multisite support to the documentation * Fix double periods Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> * Improve description of phpmyadminPort Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> * Clarify explanation about phpMyAdmin and mysql ports Co-authored-by: Miguel Fonseca <150562+mcsf@users.noreply.github.com> * Add a line break * Updated the description of phpMyAdmin --------- Co-authored-by: t-hamano Co-authored-by: mcsf Co-authored-by: spacedmonkey Co-authored-by: fabiankaegy --- .../getting-started-with-code-contribution.md | 4 ++- packages/env/README.md | 34 ++++++++++++------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/docs/contributors/code/getting-started-with-code-contribution.md b/docs/contributors/code/getting-started-with-code-contribution.md index df6b305f35983e..9afcc3e46ca1bd 100644 --- a/docs/contributors/code/getting-started-with-code-contribution.md +++ b/docs/contributors/code/getting-started-with-code-contribution.md @@ -104,7 +104,9 @@ You can access the Dashboard at: `http://localhost:8888/wp-admin/` using **Usern #### Accessing the MySQL Database -To access the MySQL database on the `wp-env` instance you will first need the connection details. To do this: +phpMyAdmin is available by default for the Gutenberg project. You can access the MySQL Database at: `http://localhost:9000/`. + +If you want to access the database through another tool, you will first need the connection details. To do this: 1. In a terminal, navigate to your local Gutenberg repo. 2. Run `npm run wp-env start` - various information about the `wp-env` environment should be logged into the terminal. diff --git a/packages/env/README.md b/packages/env/README.md index af037f5ee80ab6..467e8d44e7135d 100644 --- a/packages/env/README.md +++ b/packages/env/README.md @@ -479,17 +479,19 @@ You can customize the WordPress installation, plugins and themes that the develo `.wp-env.json` supports fields for options applicable to both the tests and development instances. -| Field | Type | Default | Description | -|----------------|----------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------| -| `"core"` | `string\|null` | `null` | The WordPress installation to use. If `null` is specified, `wp-env` will use the latest production release of WordPress. | -| `"phpVersion"` | `string\|null` | `null` | The PHP version to use. If `null` is specified, `wp-env` will use the default version used with production release of WordPress. | -| `"plugins"` | `string[]` | `[]` | A list of plugins to install and activate in the environment. | -| `"themes"` | `string[]` | `[]` | A list of themes to install in the environment. | -| `"port"` | `integer` | `8888` (`8889` for the tests instance) | The primary port number to use for the installation. You'll access the instance through the port: 'http://localhost:8888'. | -| `"testsPort"` | `integer` | `8889` | The port number for the test site. You'll access the instance through the port: 'http://localhost:8889'. | -| `"config"` | `Object` | See below. | Mapping of wp-config.php constants to their desired values. | -| `"mappings"` | `Object` | `"{}"` | Mapping of WordPress directories to local directories to be mounted in the WordPress instance. | -| `"mysqlPort"` | `integer` | `null` (randomly assigned) | The MySQL port number to expose. The setting is only available in the `env.development` and `env.tests` objects. | +| Field | Type | Default | Description | +|--------------------|----------------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------| +| `"core"` | `string\|null` | `null` | The WordPress installation to use. If `null` is specified, `wp-env` will use the latest production release of WordPress. | +| `"phpVersion"` | `string\|null` | `null` | The PHP version to use. If `null` is specified, `wp-env` will use the default version used with production release of WordPress. | +| `"plugins"` | `string[]` | `[]` | A list of plugins to install and activate in the environment. | +| `"themes"` | `string[]` | `[]` | A list of themes to install in the environment. | +| `"port"` | `integer` | `8888` (`8889` for the tests instance) | The primary port number to use for the installation. You'll access the instance through the port: 'http://localhost:8888'. | +| `"testsPort"` | `integer` | `8889` | The port number for the test site. You'll access the instance through the port: 'http://localhost:8889'. | +| `"config"` | `Object` | See below. | Mapping of wp-config.php constants to their desired values. | +| `"mappings"` | `Object` | `"{}"` | Mapping of WordPress directories to local directories to be mounted in the WordPress instance. | +| `"mysqlPort"` | `integer` | `null` (randomly assigned) | The MySQL port number to expose. The setting is only available in the `env.development` and `env.tests` objects. | +| `"phpmyadminPort"` | `integer` | `null` | The port number for phpMyAdmin. If provided, you'll access phpMyAdmin through: http://localhost: | +| `"multisite"` | `boolean` | `false` | Whether to set up a multisite installation. | _Note: the port number environment variables (`WP_ENV_PORT` and `WP_ENV_TESTS_PORT`) take precedent over the .wp-env.json values._ @@ -523,7 +525,8 @@ Additionally, the key `env` is available to override any of the above options on "KEY_1": false }, "port": 3000, - "mysqlPort": 13306 + "mysqlPort": 13306, + "phpmyadminPort": 9001 } } } @@ -688,7 +691,12 @@ You can tell `wp-env` to use a custom port number so that your instance does not } ``` -These can also be set via the environment variables `WP_ENV_PORT`, `WP_ENV_TESTS_PORT`, `WP_ENV_MYSQL_PORT` and `WP_ENV_TESTS_MYSQL_PORT`. +These can also be set via environment variables: + +- `WP_ENV_PORT` to override the development environment's web server's port. +- `WP_ENV_TESTS_PORT` to override the testing environment's web server's port. +- phpMyAdmin is not enabled by default, but its port can also be overridden for the development and testing environments via `WP_ENV_PHPMYADMIN_PORT` and `WP_ENV_TESTS_PHPMYADMIN_PORT`, respectively. +- By default, MySQL aren't exposed to the host, which means no chance of port conflicts. But these can also be overridden for the development and testing environments via `WP_ENV_MYSQL_PORT` and `WP_ENV_TESTS_MYSQL_PORT`, respectively. ### Specific PHP Version From e68767fc1334958ecceb7efbc78bb39076a49f3f Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:17:32 +0900 Subject: [PATCH 2/6] Fix: Linked featured image block cannot be selected correctly (#68775) Co-authored-by: t-hamano Co-authored-by: carolinan --- .../src/post-featured-image/edit.js | 17 ++--------------- .../src/post-featured-image/editor.scss | 4 ++-- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/packages/block-library/src/post-featured-image/edit.js b/packages/block-library/src/post-featured-image/edit.js index 05888c41fecf23..6afe2c29e25045 100644 --- a/packages/block-library/src/post-featured-image/edit.js +++ b/packages/block-library/src/post-featured-image/edit.js @@ -49,11 +49,6 @@ function getMediaSourceUrlBySizeSlug( media, slug ) { ); } -const disabledClickProps = { - onClick: ( event ) => event.preventDefault(), - 'aria-disabled': true, -}; - export default function PostFeaturedImageEdit( { clientId, attributes, @@ -318,11 +313,7 @@ export default function PostFeaturedImageEdit( { { controls }
{ !! isLink ? ( - + { placeholder() } ) : ( @@ -430,11 +421,7 @@ export default function PostFeaturedImageEdit( {
{ /* If the featured image is linked, wrap in an tag to trigger any inherited link element styles */ } { !! isLink ? ( - + { image } ) : ( diff --git a/packages/block-library/src/post-featured-image/editor.scss b/packages/block-library/src/post-featured-image/editor.scss index 5fab62c571b1cf..3295fe14e62ac2 100644 --- a/packages/block-library/src/post-featured-image/editor.scss +++ b/packages/block-library/src/post-featured-image/editor.scss @@ -100,9 +100,9 @@ // When the Post Featured Image block is linked, // it's wrapped with a disabled tag. - // Restore cursor style so it doesn't appear 'clickable'. + // Ensure that the link is not clickable. > a { - cursor: default; + pointer-events: none; } // When the Post Featured Image block is linked, From 129587828d6f2908ddf7e1027ecb14f115e095e0 Mon Sep 17 00:00:00 2001 From: Himanshu Pathak Date: Tue, 21 Jan 2025 13:03:40 +0530 Subject: [PATCH 3/6] Gallery: Remove unused inline menu styles (#68776) * Gallery: Remove unused inline menu transition * Base Styles: Remove unused styles entirely Co-authored-by: himanshupathak95 Co-authored-by: t-hamano --- packages/base-styles/_z-index.scss | 1 - .../block-library/src/gallery/editor.scss | 56 ------------------- 2 files changed, 57 deletions(-) diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss index af679edb910642..6f7e3f2f13c309 100644 --- a/packages/base-styles/_z-index.scss +++ b/packages/base-styles/_z-index.scss @@ -25,7 +25,6 @@ $z-layers: ( ".components-popover__close": 5, ".block-editor-block-list__insertion-point": 6, ".block-editor-warning": 5, - ".block-library-gallery-item__inline-menu": 20, ".block-editor-url-input__suggestions": 30, ".edit-post-layout__footer": 30, ".interface-interface-skeleton__header": 30, diff --git a/packages/block-library/src/gallery/editor.scss b/packages/block-library/src/gallery/editor.scss index d204d0347d8eb4..62c0eff788746d 100644 --- a/packages/block-library/src/gallery/editor.scss +++ b/packages/block-library/src/gallery/editor.scss @@ -117,10 +117,6 @@ opacity: 0.3; } - .is-selected .block-library-gallery-item__inline-menu { - display: inline-flex; - } - .block-editor-media-placeholder { margin: 0; height: 100%; @@ -131,58 +127,6 @@ } } -.block-library-gallery-item__inline-menu { - display: none; - position: absolute; - top: -2px; - margin: $grid-unit-10; - z-index: z-index(".block-library-gallery-item__inline-menu"); - border-radius: $radius-small; - background: $white; - border: $border-width solid $gray-900; - - @media not (prefers-reduced-motion) { - transition: box-shadow 0.2s ease-out; - } - - &:hover { - box-shadow: $elevation-x-small; - } - - @include break-small() { - // Use smaller buttons to fit when there are many columns. - .columns-7 &, - .columns-8 & { - padding: $grid-unit-05 * 0.5; - } - } - - .components-button.has-icon { - &:not(:focus) { - border: none; - box-shadow: none; - } - - @include break-small() { - // Use smaller buttons to fit when there are many columns. - .columns-7 &, - .columns-8 & { - padding: 0; - width: inherit; - height: inherit; - } - } - } - - &.is-left { - left: -2px; - } - - &.is-right { - right: -2px; - } -} - .wp-block-gallery ul.blocks-gallery-grid { padding: 0; // Some themes give all
    default margin instead of padding. From 34f09ca486a12bde60fd9de770dadfd6792fca93 Mon Sep 17 00:00:00 2001 From: Yogesh Bhutkar Date: Tue, 21 Jan 2025 13:48:02 +0530 Subject: [PATCH 4/6] Position: Refactor "Position" controls panel to use `ToolsPanel` instead of `PanelBody` (#67967) * Refactor "Position" controls panel to use `ToolsPanel` instead of `PanelBody` * Refactor imports * Refactor `position-controls-panel` to reset multiple selected blocks * Refactor `PositionControlsPanel` to simplify block attribute retrieval * Refactor: Simplify the logic * Refactor `PositionControlsPanel` to improve block attribute handling and reset logic * Refactor `PositionControlsPanel` to clean up empty style properties for selected blocks Co-authored-by: yogeshbhutkar Co-authored-by: fabiankaegy Co-authored-by: t-hamano --- .../position-controls-panel.js | 89 +++++++++++++------ 1 file changed, 62 insertions(+), 27 deletions(-) diff --git a/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js b/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js index 42a8597227dee9..17f65d58b8f74b 100644 --- a/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js +++ b/packages/block-editor/src/components/inspector-controls-tabs/position-controls-panel.js @@ -2,11 +2,11 @@ * WordPress dependencies */ import { - PanelBody, __experimentalUseSlotFills as useSlotFills, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; -import { useSelect } from '@wordpress/data'; -import { useLayoutEffect, useState } from '@wordpress/element'; +import { useDispatch, useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; /** @@ -15,40 +15,75 @@ import { __ } from '@wordpress/i18n'; import InspectorControlsGroups from '../inspector-controls/groups'; import { default as InspectorControls } from '../inspector-controls'; import { store as blockEditorStore } from '../../store'; +import { useToolsPanelDropdownMenuProps } from '../global-styles/utils'; +import { cleanEmptyObject } from '../../hooks/utils'; const PositionControlsPanel = () => { - const [ initialOpen, setInitialOpen ] = useState(); + const { selectedClientIds, selectedBlocks, hasPositionAttribute } = + useSelect( ( select ) => { + const { getBlocksByClientId, getSelectedBlockClientIds } = + select( blockEditorStore ); - // Determine whether the panel should be expanded. - const { multiSelectedBlocks } = useSelect( ( select ) => { - const { getBlocksByClientId, getSelectedBlockClientIds } = - select( blockEditorStore ); - const clientIds = getSelectedBlockClientIds(); - return { - multiSelectedBlocks: getBlocksByClientId( clientIds ), - }; - }, [] ); + const selectedBlockClientIds = getSelectedBlockClientIds(); + const _selectedBlocks = getBlocksByClientId( + selectedBlockClientIds + ); - useLayoutEffect( () => { - // If any selected block has a position set, open the panel by default. - // The first block's value will still be used within the control though. - if ( initialOpen === undefined ) { - setInitialOpen( - multiSelectedBlocks.some( + return { + selectedClientIds: selectedBlockClientIds, + selectedBlocks: _selectedBlocks, + hasPositionAttribute: _selectedBlocks?.some( ( { attributes } ) => !! attributes?.style?.position?.type - ) - ); + ), + }; + }, [] ); + + const { updateBlockAttributes } = useDispatch( blockEditorStore ); + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); + + function resetPosition() { + if ( ! selectedClientIds?.length || ! selectedBlocks?.length ) { + return; } - }, [ initialOpen, multiSelectedBlocks, setInitialOpen ] ); + + const attributesByClientId = Object.fromEntries( + selectedBlocks?.map( ( { clientId, attributes } ) => [ + clientId, + { + style: cleanEmptyObject( { + ...attributes?.style, + position: { + ...attributes?.style?.position, + type: undefined, + top: undefined, + right: undefined, + bottom: undefined, + left: undefined, + }, + } ), + }, + ] ) + ); + + updateBlockAttributes( selectedClientIds, attributesByClientId, true ); + } return ( - - - + hasPositionAttribute } + onDeselect={ resetPosition } + > + + + ); }; From 5b7f7ec473542d863a40291b2513d7cdfb6c712c Mon Sep 17 00:00:00 2001 From: Karthick M <97787966+karthick-murugan@users.noreply.github.com> Date: Tue, 21 Jan 2025 13:59:17 +0530 Subject: [PATCH 5/6] Latest Post Block: Refactor settings panel to use ToolsPanel (#67956) * Image size fix in lightbox * Revert "Image size fix in lightbox" This reverts commit 63f81c1e9cbb3b0513abca2b8cb579fef374ed7b. * Update toolspanel to latest posts block * Design changes * feedback changes * Feedback changes * Feedback updates * Feedback changes * Feedback changes Co-authored-by: karthick-murugan Co-authored-by: fabiankaegy Co-authored-by: t-hamano --- .../src/latest-posts/constants.js | 1 + .../block-library/src/latest-posts/edit.js | 163 +++++++++++++----- 2 files changed, 120 insertions(+), 44 deletions(-) diff --git a/packages/block-library/src/latest-posts/constants.js b/packages/block-library/src/latest-posts/constants.js index 70c34448a3bff6..bcb367ce9d7448 100644 --- a/packages/block-library/src/latest-posts/constants.js +++ b/packages/block-library/src/latest-posts/constants.js @@ -1,3 +1,4 @@ export const MIN_EXCERPT_LENGTH = 10; export const MAX_EXCERPT_LENGTH = 100; export const MAX_POSTS_COLUMNS = 6; +export const DEFAULT_EXCERPT_LENGTH = 55; diff --git a/packages/block-library/src/latest-posts/edit.js b/packages/block-library/src/latest-posts/edit.js index 82f0661d04e40f..95c72ea538b0ef 100644 --- a/packages/block-library/src/latest-posts/edit.js +++ b/packages/block-library/src/latest-posts/edit.js @@ -17,6 +17,8 @@ import { ToolbarGroup, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { __, _x, sprintf } from '@wordpress/i18n'; import { dateI18n, format, getSettings } from '@wordpress/date'; @@ -49,7 +51,9 @@ import { MIN_EXCERPT_LENGTH, MAX_EXCERPT_LENGTH, MAX_POSTS_COLUMNS, + DEFAULT_EXCERPT_LENGTH, } from './constants'; +import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; /** * Module Constants @@ -77,6 +81,8 @@ function getFeaturedImageDetails( post, size ) { export default function LatestPostsEdit( { attributes, setAttributes } ) { const instanceId = useInstanceId( LatestPostsEdit ); + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); + const { postsToShow, order, @@ -227,68 +233,137 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) { const hasPosts = !! latestPosts?.length; const inspectorControls = ( - - + setAttributes( { + displayPostContent: false, + displayPostContentRadio: 'excerpt', + excerptLength: DEFAULT_EXCERPT_LENGTH, + } ) + } + dropdownMenuProps={ dropdownMenuProps } + > + !! displayPostContent } label={ __( 'Post content' ) } - checked={ displayPostContent } - onChange={ ( value ) => - setAttributes( { displayPostContent: value } ) + onDeselect={ () => + setAttributes( { displayPostContent: false } ) } - /> + isShownByDefault + > + + setAttributes( { displayPostContent: value } ) + } + /> + { displayPostContent && ( - displayPostContentRadio !== 'excerpt' } label={ __( 'Show' ) } - selected={ displayPostContentRadio } - options={ [ - { label: __( 'Excerpt' ), value: 'excerpt' }, - { - label: __( 'Full post' ), - value: 'full_post', - }, - ] } - onChange={ ( value ) => + onDeselect={ () => setAttributes( { - displayPostContentRadio: value, + displayPostContentRadio: 'excerpt', } ) } - /> + isShownByDefault + > + + setAttributes( { + displayPostContentRadio: value, + } ) + } + /> + ) } { displayPostContent && displayPostContentRadio === 'excerpt' && ( - + excerptLength !== DEFAULT_EXCERPT_LENGTH + } label={ __( 'Max number of words' ) } - value={ excerptLength } - onChange={ ( value ) => - setAttributes( { excerptLength: value } ) + onDeselect={ () => + setAttributes( { + excerptLength: DEFAULT_EXCERPT_LENGTH, + } ) } - min={ MIN_EXCERPT_LENGTH } - max={ MAX_EXCERPT_LENGTH } - /> + isShownByDefault + > + + setAttributes( { excerptLength: value } ) + } + min={ MIN_EXCERPT_LENGTH } + max={ MAX_EXCERPT_LENGTH } + /> + ) } - + - - + setAttributes( { + displayAuthor: false, + displayPostDate: false, + } ) + } + dropdownMenuProps={ dropdownMenuProps } + > + !! displayAuthor } label={ __( 'Display author name' ) } - checked={ displayAuthor } - onChange={ ( value ) => - setAttributes( { displayAuthor: value } ) + onDeselect={ () => + setAttributes( { displayAuthor: false } ) } - /> - + + setAttributes( { displayAuthor: value } ) + } + /> + + !! displayPostDate } label={ __( 'Display post date' ) } - checked={ displayPostDate } - onChange={ ( value ) => - setAttributes( { displayPostDate: value } ) + onDeselect={ () => + setAttributes( { displayPostDate: false } ) } - /> - - + isShownByDefault + > + + setAttributes( { displayPostDate: value } ) + } + /> + + Date: Tue, 21 Jan 2025 10:56:54 -0500 Subject: [PATCH 6/6] Bump the github-actions group across 1 directory with 2 updates (#68809) Bumps the github-actions group with 2 updates in the / directory: [ruby/setup-ruby](https://github.com/ruby/setup-ruby) and [actions/stale](https://github.com/actions/stale). Updates `ruby/setup-ruby` from 1.209.0 to 1.213.0 - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb) - [Commits](https://github.com/ruby/setup-ruby/compare/7a6302104fbeea3c6aaa43b1b91e08f7d6623279...28c4deda893d5a96a6b2d958c5b47fc18d65c9d3) Updates `actions/stale` from 9.0.0 to 9.1.0 - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/28ca1036281a5e5922ead5184a1bbf96e5fc984e...5bef64f19d7facfb25b37b414482c7164d639639) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: actions/stale dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: desrosj --- .github/workflows/rnmobile-ios-runner.yml | 2 +- .github/workflows/stale-issue-gardening.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index b6d796b1108ff0..a7dc66063e4bb7 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -28,7 +28,7 @@ jobs: with: show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} - - uses: ruby/setup-ruby@7a6302104fbeea3c6aaa43b1b91e08f7d6623279 # v1.209.0 + - uses: ruby/setup-ruby@28c4deda893d5a96a6b2d958c5b47fc18d65c9d3 # v1.213.0 with: # `.ruby-version` file location working-directory: packages/react-native-editor/ios diff --git a/.github/workflows/stale-issue-gardening.yml b/.github/workflows/stale-issue-gardening.yml index c73fe7a19b24b3..6b8c7e82d1ca7b 100644 --- a/.github/workflows/stale-issue-gardening.yml +++ b/.github/workflows/stale-issue-gardening.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Update issues - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 + uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: ${{ matrix.message }}