-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Framework: Remove deprecations slated for 3.5 removal (#8687)
* Framework: Update use of deprecated UID * Framework: Update use of deprecated compose * Framework: Remove deprecations slated for v3.5 removal * Framework: Update package dependencies after deprecation removals
- Loading branch information
Showing
36 changed files
with
53 additions
and
713 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,18 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { | ||
reduce, | ||
get, | ||
map, | ||
} from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createElement } from '@wordpress/element'; | ||
import { withSelect } from '@wordpress/data'; | ||
import deprecated from '@wordpress/deprecated'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockListLayout from './layout'; | ||
|
||
const UngroupedLayoutBlockList = withSelect( | ||
( select, ownProps ) => ( { | ||
blockClientIds: select( 'core/editor' ).getBlockOrder( ownProps.rootClientId ), | ||
} ) | ||
)( BlockListLayout ); | ||
|
||
const GroupedLayoutBlockList = withSelect( | ||
( select, ownProps ) => ( { | ||
blocks: select( 'core/editor' ).getBlocks( ownProps.rootClientId ), | ||
} ), | ||
)( ( { | ||
blocks, | ||
layouts, | ||
...props | ||
} ) => map( layouts, ( layout ) => { | ||
deprecated( 'grouped layout', { | ||
alternative: 'intermediary nested inner blocks', | ||
version: '3.5', | ||
plugin: 'Gutenberg', | ||
hint: 'See core Columns / Column block for reference implementation', | ||
} ); | ||
|
||
// Filter blocks assigned to layout when rendering grouped layouts. | ||
const layoutBlockClientIds = reduce( blocks, ( result, block ) => { | ||
if ( get( block, [ 'attributes', 'layout' ] ) === layout.name ) { | ||
result.push( block.clientId ); | ||
} | ||
|
||
return result; | ||
}, [] ); | ||
|
||
return ( | ||
<BlockListLayout | ||
key={ layout.name } | ||
layout={ layout.name } | ||
isGroupedByLayout | ||
blockClientIds={ layoutBlockClientIds } | ||
{ ...props } | ||
/> | ||
); | ||
} ) ); | ||
|
||
const BlockList = ( props ) => createElement( | ||
// BlockList can be provided with a layouts configuration, either grouped | ||
// (blocks adjacent in markup) or ungrouped. This is inferred by the shape | ||
// of the layouts configuration passed (grouped layout as array). | ||
Array.isArray( props.layouts ) ? | ||
GroupedLayoutBlockList : | ||
UngroupedLayoutBlockList, | ||
props | ||
); | ||
// TODO: This should be refactored to flatten BlockListLayout into this file. | ||
export default withSelect( ( select, ownProps ) => { | ||
const { getBlockOrder } = select( 'core/editor' ); | ||
|
||
export default BlockList; | ||
return { | ||
blockClientIds: getBlockOrder( ownProps.rootClientId ), | ||
}; | ||
} )( BlockListLayout ); |
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
Oops, something went wrong.