From 4be06989dfc9b8b5d759c6556b4e96a78361ceee Mon Sep 17 00:00:00 2001 From: Joen A <1204802+jasmussen@users.noreply.github.com> Date: Sat, 13 Mar 2021 01:00:42 +0100 Subject: [PATCH 1/6] Revert: Show empty paragraphs on fronted. (#29809) --- packages/block-library/src/paragraph/style.scss | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/block-library/src/paragraph/style.scss b/packages/block-library/src/paragraph/style.scss index 8a750a271cdd4..87761b95ee122 100644 --- a/packages/block-library/src/paragraph/style.scss +++ b/packages/block-library/src/paragraph/style.scss @@ -35,8 +35,3 @@ p.has-background { p.has-text-color a { color: inherit; } - -// Prevent an empty P tag from collapsing, so it matches the backend. -p:empty::before { - content: "\200B"; -} From b8d6c33d9b2ae3ca4a1e1ec34568e59de54f4038 Mon Sep 17 00:00:00 2001 From: Joen A <1204802+jasmussen@users.noreply.github.com> Date: Thu, 18 Mar 2021 10:29:50 +0100 Subject: [PATCH 2/6] Try: Fix gallery item clicking. (#29860) --- packages/block-library/src/gallery/editor.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/gallery/editor.scss b/packages/block-library/src/gallery/editor.scss index 817f65a62327b..9a07be2a23d73 100644 --- a/packages/block-library/src/gallery/editor.scss +++ b/packages/block-library/src/gallery/editor.scss @@ -50,6 +50,7 @@ figure.wp-block-gallery { bottom: 0; left: 0; z-index: 1; + pointer-events: none; } figcaption { z-index: 2; From e3b2a907c81f0c8866ab176930bed85bda49c3d8 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 19 Mar 2021 17:55:57 +0800 Subject: [PATCH 3/6] Fix sibling block inserter displaying at end of block list. (#29920) * Only show inserter version of insertion point if there is a next block * Clarify comment * Improve boolean logic * Update e2e test * Update tests --- .../components/block-list/insertion-point.js | 23 +++++++++++++------ .../experiments/multi-entity-saving.test.js | 11 +++++---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/block-editor/src/components/block-list/insertion-point.js b/packages/block-editor/src/components/block-list/insertion-point.js index db2653b031bc7..bbb3be4570fe0 100644 --- a/packages/block-editor/src/components/block-list/insertion-point.js +++ b/packages/block-editor/src/components/block-list/insertion-point.js @@ -199,6 +199,18 @@ function InsertionPointPopover( { } } + // Only show the inserter when there's a `nextElement` (a block after the + // insertion point). At the end of the block list the trailing appender + // should serve the purpose of inserting blocks. + const showInsertionPointInserter = + ! isHidden && nextElement && ( isInserterShown || isInserterForced ); + + // Show the indicator if the insertion point inserter is visible, or if + // the `showInsertionPoint` state is `true`. The latter is generally true + // when hovering blocks for insertion in the block library. + const showInsertionPointIndicator = + showInsertionPointInserter || ( ! isHidden && showInsertionPoint ); + /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */ // While ideally it would be enough to capture the // bubbling focus event from the Inserter, due to the @@ -223,13 +235,10 @@ function InsertionPointPopover( { className={ className } style={ style } > - { ! isHidden && - ( showInsertionPoint || - isInserterShown || - isInserterForced ) && ( -
- ) } - { ! isHidden && ( isInserterShown || isInserterForced ) && ( + { showInsertionPointIndicator && ( +
+ ) } + { showInsertionPointInserter && ( { await navigationPanel.clickItemByText( 'Index' ); await navigationPanel.close(); - // Click the first block so that the template part inserts in the right place. - const firstBlock = await canvas().$( '.wp-block' ); - await firstBlock.click(); + // Select the header template part via list view. + await page.click( 'button[aria-label="List View"]' ); + const headerTemplatePartListViewButton = await page.waitForXPath( + '//button[contains(@class, "block-editor-block-navigation-block-select-button")][contains(., "Header")]' + ); + headerTemplatePartListViewButton.click(); + await page.click( 'button[aria-label="Close list view sidebar"]' ); // Insert something to dirty the editor. await insertBlock( 'Paragraph' ); From 5ad9faad548b2f84c91df2ddd69a1f1c8897f862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Tue, 23 Mar 2021 09:45:35 +0100 Subject: [PATCH 4/6] Block Editor: Ensure that uncategorized block types are properly handled (#30125) --- .../block-editor/src/components/inserter/block-types-tab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/inserter/block-types-tab.js b/packages/block-editor/src/components/inserter/block-types-tab.js index 94b76b02ac694..4f56b60b21207 100644 --- a/packages/block-editor/src/components/inserter/block-types-tab.js +++ b/packages/block-editor/src/components/inserter/block-types-tab.js @@ -112,7 +112,7 @@ export function BlockTypesTab( { ); } ) } - { ! uncategorizedItems.length && ( + { uncategorizedItems.length > 0 && ( Date: Fri, 2 Apr 2021 12:46:31 +0400 Subject: [PATCH 5/6] Add 'object-position' to allowed inline style attributes list (#30243) --- lib/compat.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/compat.php b/lib/compat.php index 008298df27096..df1277c459f0e 100644 --- a/lib/compat.php +++ b/lib/compat.php @@ -267,3 +267,18 @@ function gutenberg_override_reusable_block_post_type_labels() { ); } add_filter( 'post_type_labels_wp_block', 'gutenberg_override_reusable_block_post_type_labels', 10, 0 ); + +/** + * Update allowed inline style attributes list. + * + * Note: This should be removed when the minimum required WP version is >= 5.8. + * + * @param string[] $attrs Array of allowed CSS attributes. + * @return string[] CSS attributes. + */ +function gutenberg_safe_style_attrs( $attrs ) { + $attrs[] = 'object-position'; + + return $attrs; +} +add_filter( 'safe_style_css', 'gutenberg_safe_style_attrs' ); From d22fa928f0f2d6ccdc21a5fc3eb52ffb3a6f5a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ribari=C4=87?= <43731400+ribaricplusplus@users.noreply.github.com> Date: Fri, 12 Mar 2021 04:00:31 +0100 Subject: [PATCH 6/6] Fix Error: Could not process the 'wp-config.php' transformation (#29800) - Use separate tests database service - Configure database credentials in every service - Set wp-config.php to be writable Co-authored-by: Riad Benguella Co-authored-by: Noah Allen --- .../env/lib/build-docker-compose-config.js | 34 ++++++++++++++++--- packages/env/lib/commands/start.js | 6 ++++ packages/env/lib/config/db-env.js | 23 +++++++++++++ packages/env/lib/config/index.js | 2 ++ packages/env/lib/wordpress.js | 22 ++++++++++++ 5 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 packages/env/lib/config/db-env.js diff --git a/packages/env/lib/build-docker-compose-config.js b/packages/env/lib/build-docker-compose-config.js index 668836de88878..b17cb7bb58212 100644 --- a/packages/env/lib/build-docker-compose-config.js +++ b/packages/env/lib/build-docker-compose-config.js @@ -9,6 +9,7 @@ const path = require( 'path' ); * Internal dependencies */ const { hasSameCoreSource } = require( './wordpress' ); +const { dbEnv } = require( './config' ); /** * @typedef {import('./config').WPConfig} WPConfig @@ -176,26 +177,40 @@ module.exports = function buildDockerComposeConfig( config ) { image: 'mariadb', ports: [ '3306' ], environment: { - MYSQL_ALLOW_EMPTY_PASSWORD: 'yes', + MYSQL_ROOT_PASSWORD: + dbEnv.credentials.WORDPRESS_DB_PASSWORD, + MYSQL_DATABASE: dbEnv.development.WORDPRESS_DB_NAME, }, volumes: [ 'mysql:/var/lib/mysql' ], }, + 'tests-mysql': { + image: 'mariadb', + ports: [ '3306' ], + environment: { + MYSQL_ROOT_PASSWORD: + dbEnv.credentials.WORDPRESS_DB_PASSWORD, + MYSQL_DATABASE: dbEnv.tests.WORDPRESS_DB_NAME, + }, + volumes: [ 'mysql-test:/var/lib/mysql' ], + }, wordpress: { build: '.', depends_on: [ 'mysql' ], image: developmentWpImage, ports: [ developmentPorts ], environment: { - WORDPRESS_DB_NAME: 'wordpress', + ...dbEnv.credentials, + ...dbEnv.development, }, volumes: developmentMounts, }, 'tests-wordpress': { - depends_on: [ 'mysql' ], + depends_on: [ 'tests-mysql' ], image: testsWpImage, ports: [ testsPorts ], environment: { - WORDPRESS_DB_NAME: 'tests-wordpress', + ...dbEnv.credentials, + ...dbEnv.tests, }, volumes: testsMounts, }, @@ -204,12 +219,20 @@ module.exports = function buildDockerComposeConfig( config ) { image: developmentWpCliImage, volumes: developmentMounts, user: cliUser, + environment: { + ...dbEnv.credentials, + ...dbEnv.development, + }, }, 'tests-cli': { depends_on: [ 'tests-wordpress' ], image: testsWpCliImage, volumes: testsMounts, user: cliUser, + environment: { + ...dbEnv.credentials, + ...dbEnv.tests, + }, }, composer: { image: 'composer', @@ -228,6 +251,8 @@ module.exports = function buildDockerComposeConfig( config ) { LOCAL_DIR: 'html', WP_PHPUNIT__TESTS_CONFIG: '/var/www/html/phpunit-wp-config.php', + ...dbEnv.credentials, + ...dbEnv.tests, }, }, }, @@ -235,6 +260,7 @@ module.exports = function buildDockerComposeConfig( config ) { ...( ! config.coreSource && { wordpress: {} } ), ...( ! config.coreSource && { 'tests-wordpress': {} } ), mysql: {}, + 'mysql-test': {}, 'phpunit-uploads': {}, }, }; diff --git a/packages/env/lib/commands/start.js b/packages/env/lib/commands/start.js index 22fe075948c4a..4f3a00cc927dd 100644 --- a/packages/env/lib/commands/start.js +++ b/packages/env/lib/commands/start.js @@ -24,6 +24,7 @@ const downloadSources = require( '../download-sources' ); const { checkDatabaseConnection, makeContentDirectoriesWritable, + makeConfigWritable, configureWordPress, setupWordPressDirectories, } = require( '../wordpress' ); @@ -140,6 +141,11 @@ module.exports = async function start( { spinner, debug, update, xdebug } ) { : [], } ); + await Promise.all( [ + makeConfigWritable( 'development', config ), + makeConfigWritable( 'tests', config ), + ] ); + // Only run WordPress install/configuration when config has changed. if ( shouldConfigureWp ) { spinner.text = 'Configuring WordPress.'; diff --git a/packages/env/lib/config/db-env.js b/packages/env/lib/config/db-env.js new file mode 100644 index 0000000000000..6f06ff9731510 --- /dev/null +++ b/packages/env/lib/config/db-env.js @@ -0,0 +1,23 @@ +// Username and password used in all databases +const credentials = { + WORDPRESS_DB_USER: 'root', + WORDPRESS_DB_PASSWORD: 'password', +}; + +// Environment for test database +const tests = { + WORDPRESS_DB_NAME: 'tests-wordpress', + WORDPRESS_DB_HOST: 'tests-mysql', +}; + +// Environment for development database. DB host gets default value which is set +// elsewhere +const development = { + WORDPRESS_DB_NAME: 'wordpress', +}; + +module.exports = { + credentials, + tests, + development, +}; diff --git a/packages/env/lib/config/index.js b/packages/env/lib/config/index.js index 0dbbcc08a5b8a..1a944f43501d0 100644 --- a/packages/env/lib/config/index.js +++ b/packages/env/lib/config/index.js @@ -3,6 +3,7 @@ */ const readConfig = require( './config' ); const { ValidationError } = require( './validate-config' ); +const dbEnv = require( './db-env' ); /** * @typedef {import('./config').WPConfig} WPConfig @@ -13,4 +14,5 @@ const { ValidationError } = require( './validate-config' ); module.exports = { ValidationError, readConfig, + dbEnv, }; diff --git a/packages/env/lib/wordpress.js b/packages/env/lib/wordpress.js index 07705167ac1dc..da632f9703b5b 100644 --- a/packages/env/lib/wordpress.js +++ b/packages/env/lib/wordpress.js @@ -47,6 +47,27 @@ async function makeContentDirectoriesWritable( ); } +/** + * Makes wp-config.php owned by www-data so that WordPress can work with the + * file. + * + * @param {WPEnvironment} environment The environment to check. Either 'development' or 'tests'. + * @param {WPConfig} config The wp-env config object. + */ +async function makeConfigWritable( + environment, + { dockerComposeConfigPath, debug } +) { + await dockerCompose.exec( + environment === 'development' ? 'wordpress' : 'tests-wordpress', + 'chown www-data:www-data wp-config.php', + { + config: dockerComposeConfigPath, + log: debug, + } + ); +} + /** * Checks a WordPress database connection. An error is thrown if the test is * unsuccessful. @@ -260,6 +281,7 @@ async function copyCoreFiles( fromPath, toPath ) { module.exports = { hasSameCoreSource, makeContentDirectoriesWritable, + makeConfigWritable, checkDatabaseConnection, configureWordPress, resetDatabase,