-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
WordPress 5.4.1 Backports #21800
Merged
Merged
WordPress 5.4.1 Backports #21800
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7542cff
Fix keyboard block duplication (#21317)
youknowriad 0fa11e0
Fix the Buttons block margins (#21376)
youknowriad 889ee28
Only scroll page for multi-selectiions (#21460)
youknowriad 0e96570
Fix the latest-posts block when `imageDimensions` is empty (#21070)
roo2 e35f55d
Prevent typing on a Popover from closing the block toolbar (#21421)
youknowriad a0d2c64
Let's bring in the grid system.
whyisjake 7601e77
Escape class name to avoid malformed html tag (#20977)
talldan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
.wp-block-buttons .wp-block-button { | ||
display: inline-block; | ||
margin: $grid-size-small; | ||
margin-right: $grid-unit-10; | ||
margin-bottom: $grid-unit-10; | ||
} | ||
|
||
.wp-block-buttons.alignright .wp-block-button { | ||
margin-right: none; | ||
margin-left: $grid-unit-10; | ||
} | ||
|
||
.wp-block-buttons.aligncenter { | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/e2e-tests/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Duplicating blocks should duplicate blocks using the block settings menu 1`] = ` | ||
"<!-- wp:paragraph --> | ||
<p>Clone me</p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph --> | ||
<p>Clone me</p> | ||
<!-- /wp:paragraph -->" | ||
`; | ||
|
||
exports[`Duplicating blocks should duplicate blocks using the keyboard shortcut 1`] = ` | ||
"<!-- wp:paragraph --> | ||
<p>Clone me</p> | ||
<!-- /wp:paragraph --> | ||
|
||
<!-- wp:paragraph --> | ||
<p>Clone me</p> | ||
<!-- /wp:paragraph -->" | ||
`; |
49 changes: 49 additions & 0 deletions
49
packages/e2e-tests/specs/editor/various/duplicating-blocks.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
createNewPost, | ||
insertBlock, | ||
getEditedPostContent, | ||
clickBlockToolbarButton, | ||
pressKeyWithModifier, | ||
} from '@wordpress/e2e-test-utils'; | ||
|
||
describe( 'Duplicating blocks', () => { | ||
beforeEach( async () => { | ||
await createNewPost(); | ||
} ); | ||
|
||
it( 'should duplicate blocks using the block settings menu', async () => { | ||
await insertBlock( 'Paragraph' ); | ||
await page.keyboard.type( 'Clone me' ); | ||
|
||
// Select the test we just typed | ||
// This doesn't do anything but we previously had a duplicationi bug | ||
// When the selection was not collapsed | ||
await pressKeyWithModifier( 'primary', 'a' ); | ||
|
||
await clickBlockToolbarButton( 'More options' ); | ||
const duplicateButton = await page.waitForXPath( | ||
'//button[text()="Duplicate"]' | ||
); | ||
await duplicateButton.click(); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
|
||
it( 'should duplicate blocks using the keyboard shortcut', async () => { | ||
await insertBlock( 'Paragraph' ); | ||
await page.keyboard.type( 'Clone me' ); | ||
|
||
// Select the test we just typed | ||
// This doesn't do anything but we previously had a duplicationi bug | ||
// When the selection was not collapsed | ||
await pressKeyWithModifier( 'primary', 'a' ); | ||
|
||
// Duplicate using the keyboard shortccut | ||
await pressKeyWithModifier( 'primaryShift', 'd' ); | ||
|
||
expect( await getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { clickBlockAppender, createNewPost } from '@wordpress/e2e-test-utils'; | ||
|
||
describe( 'isTyping', () => { | ||
beforeEach( async () => { | ||
await createNewPost(); | ||
} ); | ||
|
||
it( 'should hide the toolbar when typing', async () => { | ||
const blockToolbarSelector = '.block-editor-block-toolbar'; | ||
|
||
await clickBlockAppender(); | ||
|
||
// Type in a paragraph | ||
await page.keyboard.type( 'Type' ); | ||
|
||
// Toolbar is hidden | ||
let blockToolbar = await page.$( blockToolbarSelector ); | ||
expect( blockToolbar ).toBe( null ); | ||
|
||
// Moving the mouse shows the toolbar | ||
await page.mouse.move( 0, 0 ); | ||
await page.mouse.move( 10, 10 ); | ||
|
||
// Toolbar is visible | ||
blockToolbar = await page.$( blockToolbarSelector ); | ||
expect( blockToolbar ).not.toBe( null ); | ||
|
||
// Typing again hides the toolbar | ||
await page.keyboard.type( ' and continue' ); | ||
|
||
// Toolbar is hidden again | ||
blockToolbar = await page.$( blockToolbarSelector ); | ||
expect( blockToolbar ).toBe( null ); | ||
} ); | ||
|
||
it( 'should not close the dropdown when typing in it', async () => { | ||
// Adds a Dropdown with an input to all blocks | ||
await page.evaluate( () => { | ||
const { Dropdown, Button, Fill } = wp.components; | ||
const { createElement: el, Fragment } = wp.element; | ||
function AddDropdown( BlockListBlock ) { | ||
return ( props ) => { | ||
return el( | ||
Fragment, | ||
{}, | ||
el( | ||
Fill, | ||
{ name: 'BlockControls' }, | ||
el( Dropdown, { | ||
renderToggle: ( { onToggle } ) => | ||
el( | ||
Button, | ||
{ | ||
onClick: onToggle, | ||
className: 'dropdown-open', | ||
}, | ||
'Open Dropdown' | ||
), | ||
renderContent: () => | ||
el( 'input', { | ||
className: 'dropdown-input', | ||
} ), | ||
} ) | ||
), | ||
el( BlockListBlock, props ) | ||
); | ||
}; | ||
} | ||
|
||
wp.hooks.addFilter( | ||
'editor.BlockListBlock', | ||
'e2e-test/add-dropdown', | ||
AddDropdown | ||
); | ||
} ); | ||
|
||
await clickBlockAppender(); | ||
|
||
// Type in a paragraph | ||
await page.keyboard.type( 'Type' ); | ||
|
||
// Show Toolbar | ||
await page.mouse.move( 0, 0 ); | ||
await page.mouse.move( 10, 10 ); | ||
|
||
// Open the dropdown | ||
await page.click( '.dropdown-open' ); | ||
|
||
// Type inside the dropdown's input | ||
await page.type( '.dropdown-input', 'Random' ); | ||
|
||
// The input should still be visible | ||
const input = await page.$( '.dropdown-input' ); | ||
expect( input ).not.toBe( null ); | ||
} ); | ||
} ); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
During previous cherry-picks (e.g: during 5.4 RC) we opted for not include the new grid system and just change the variable to their equivalents e.g: $grid-unit-10 would be $grid-size in the "old system". But in retrospective probably including the grid system from the start would have been a safer and easier choice, so I don't have anything against including the new grid variables (I regret not having done it sooner). cc: @youknowriad in case you think including the grid system may have an undesirable side effect in future cherry-picks.
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.
I think it's fine to include it, it's harmless