-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-picked commits for WordPress 6.4 RC3 v2 (#55736)
* Update label for lightbox editor UI (#55724) * Update label for lightbox editor UI * Change lightbox label in Global Styles * Require queryId for enhanced pagination. (#55720) * Change pattern category taxonomy public param to false (#55748) * Query block enhanced pagination: Detect inner plugin blocks during render (#55714) * Flag inner plugin blocks inside query loop * Improve PHP logic a little * Only disallow plugin blocks and post content * Get rid of global variables * Fix returned content from render callback * Handle composed query stacks * Disable navigation on the browser * Replace `count` with `empty` * Add PHPdocs and improve var naming * Lint PHP * Clarify docs a little * Move the disable check before preventDefault * Restore previous navigate logic * Set filter priorities back to 10 * Basic inspector warnings * Make render query filter static * Add stable modal logic * Switch back to ToggleControl * Auto remove filter when query stack is empty * Add first unit tests * Switch to inverse control * Add test case for nested queries * Prevent passing `null` to the Tag Processr * Get rid of explicit auto mode and notices * Test directives in the Pagination Previous block * Minor typos and improvements * Improve modal texts * Fix WPCS * Reorder teardowns * Reset the dirty flag after it's used * Prevent usage of post content block --------- Co-authored-by: David Arenas <[email protected]> * Reuse existing screen-reader-text CSS class. (#55309) --------- Co-authored-by: Artemio Morales <[email protected]> Co-authored-by: Peter Wilson <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: Luis Herranz <[email protected]> Co-authored-by: David Arenas <[email protected]> Co-authored-by: Andrea Fercia <[email protected]>
- Loading branch information
1 parent
1150493
commit 60cfa82
Showing
12 changed files
with
459 additions
and
94 deletions.
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
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
51 changes: 19 additions & 32 deletions
51
packages/block-library/src/query/edit/inspector-controls/enhanced-pagination-control.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 |
---|---|---|
@@ -1,58 +1,45 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { ToggleControl, Notice } from '@wordpress/components'; | ||
import { ToggleControl } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { BlockTitle } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { useUnsupportedBlockList } from '../../utils'; | ||
import { useUnsupportedBlocks } from '../../utils'; | ||
|
||
export default function EnhancedPaginationControl( { | ||
enhancedPagination, | ||
setAttributes, | ||
clientId, | ||
} ) { | ||
const unsupported = useUnsupportedBlockList( clientId ); | ||
const { hasUnsupportedBlocks } = useUnsupportedBlocks( clientId ); | ||
|
||
let help = __( 'Browsing between pages requires a full page reload.' ); | ||
if ( enhancedPagination ) { | ||
help = __( | ||
"Browsing between pages won't require a full page reload, unless non-compatible blocks are detected." | ||
); | ||
} else if ( hasUnsupportedBlocks ) { | ||
help = __( | ||
"Force page reload can't be disabled because there are non-compatible blocks inside the Query block." | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<ToggleControl | ||
label={ __( 'Enhanced pagination' ) } | ||
help={ __( | ||
'Browsing between pages won’t require a full page reload.' | ||
) } | ||
checked={ !! enhancedPagination } | ||
disabled={ unsupported.length } | ||
label={ __( 'Force page reload' ) } | ||
help={ help } | ||
checked={ ! enhancedPagination } | ||
disabled={ hasUnsupportedBlocks } | ||
onChange={ ( value ) => { | ||
setAttributes( { | ||
enhancedPagination: !! value, | ||
enhancedPagination: ! value, | ||
} ); | ||
} } | ||
/> | ||
{ !! unsupported.length && ( | ||
<Notice | ||
status="warning" | ||
isDismissible={ false } | ||
className="wp-block-query__enhanced-pagination-notice" | ||
> | ||
{ __( | ||
"Enhanced pagination doesn't support the following blocks:" | ||
) } | ||
<ul> | ||
{ unsupported.map( ( id ) => ( | ||
<li key={ id }> | ||
<BlockTitle clientId={ id } /> | ||
</li> | ||
) ) } | ||
</ul> | ||
{ __( | ||
'If you want to enable it, you have to remove all unsupported blocks first.' | ||
) } | ||
</Notice> | ||
) } | ||
</> | ||
); | ||
} |
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
Oops, something went wrong.