Skip to content
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

Deprecated the selectors/actions and components that moved to the block editor module #15770

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ _Returns_

<a name="getAllBlocks" href="#getAllBlocks">#</a> **getAllBlocks**

Returns an array with all blocks; Equivalent to calling wp.data.select( 'core/editor' ).getBlocks();
Returns an array with all blocks; Equivalent to calling wp.data.select( 'core/block-editor' ).getBlocks();

_Returns_

Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-test-utils/src/get-all-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import { wpDataSelect } from './wp-data-select';

/**
* Returns an array with all blocks; Equivalent to calling wp.data.select( 'core/editor' ).getBlocks();
* Returns an array with all blocks; Equivalent to calling wp.data.select( 'core/block-editor' ).getBlocks();
*
* @return {Promise} Promise resolving with an array containing all blocks in the document.
*/
export function getAllBlocks() {
return wpDataSelect( 'core/editor', 'getBlocks' );
return wpDataSelect( 'core/block-editor', 'getBlocks' );
}
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/select-block-by-client-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
*/
export async function selectBlockByClientId( clientId ) {
await page.evaluate( ( id ) => {
wp.data.dispatch( 'core/editor' ).selectBlock( id );
wp.data.dispatch( 'core/block-editor' ).selectBlock( id );
}, clientId );
}
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/set-post-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export async function setPostContent( content ) {
return await page.evaluate( ( _content ) => {
const { dispatch } = window.wp.data;
const blocks = wp.blocks.parse( _content );
dispatch( 'core/editor' ).resetBlocks( blocks );
dispatch( 'core/block-editor' ).resetBlocks( blocks );
}, content );
}
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/align-hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function enqueue_align_plugin_script() {
array(
'wp-blocks',
'wp-element',
'wp-editor',
'wp-block-editor',
'wp-i18n',
),
filemtime( plugin_dir_path( __FILE__ ) . 'align-hook/index.js' ),
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/align-hook/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
var InnerBlocks = wp.blockEditor.InnerBlocks;
var __ = wp.i18n.__;
var TEMPLATE = [
[ 'core/paragraph', { fontSize: 'large', content: __( 'Content…' ) } ],
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/block-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function enqueue_block_icons_plugin_script() {
'wp-blocks',
'wp-components',
'wp-element',
'wp-editor',
'wp-block-editor',
'wp-hooks',
'wp-i18n',
),
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/block-icons/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
var InnerBlocks = wp.blockEditor.InnerBlocks;
var circle = el( 'circle', { cx: 10, cy: 10, r: 10, fill: 'red', stroke: 'blue', strokeWidth: '10' } );
var svg = el( 'svg', { width: 20, height: 20, viewBox: '0 0 20 20' }, circle );

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/container-without-paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function enqueue_container_without_paragraph_plugin_script() {
array(
'wp-blocks',
'wp-element',
'wp-editor',
'wp-block-editor',
),
filemtime( plugin_dir_path( __FILE__ ) . 'container-without-paragraph/index.js' ),
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
icon: 'yes',

edit() {
return wp.element.createElement(wp.editor.InnerBlocks, {
return wp.element.createElement(wp.blockEditor.InnerBlocks, {
allowedBlocks: ['core/image', 'core/gallery']
});
},

save() {
return wp.element.createElement(wp.editor.InnerBlocks.Content);
return wp.element.createElement(wp.blockEditor.InnerBlocks.Content);
},
})
} )();
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/deprecated-node-matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function enqueue_deprecated_node_matcher_plugin_script() {
'lodash',
'wp-blocks',
'wp-element',
'wp-editor',
'wp-block-editor',
),
filemtime( plugin_dir_path( __FILE__ ) . 'deprecated-node-matcher/index.js' ),
true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var RichText = wp.editor.RichText;
var RichText = wp.blockEditor.RichText;
var el = wp.element.createElement;
var el = wp.element.createElement;

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/format-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function gutenberg_test_format_api_scripts() {
wp_enqueue_script(
'gutenberg-test-format-api',
plugins_url( 'format-api/index.js', __FILE__ ),
array( 'wp-editor', 'wp-element', 'wp-rich-text' ),
array( 'wp-block-editor', 'wp-element', 'wp-rich-text' ),
filemtime( plugin_dir_path( __FILE__ ) . 'format-api/index.js' ),
true
);
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/format-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
className: 'my-plugin-link',
edit: function( props ) {
return wp.element.createElement(
wp.editor.RichTextToolbarButton, {
wp.blockEditor.RichTextToolbarButton, {
icon: 'admin-links',
title: 'Custom Link',
onClick: function() {
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/hooks-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function enqueue_hooks_plugin_script() {
'wp-blocks',
'wp-components',
'wp-element',
'wp-editor',
'wp-block-editor',
'wp-hooks',
'wp-i18n',
),
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/hooks-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var Fragment = wp.element.Fragment;
var Button = wp.components.Button;
var PanelBody = wp.components.PanelBody;
var InspectorControls = wp.editor.InspectorControls;
var InspectorControls = wp.blockEditor.InspectorControls;
var addFilter = wp.hooks.addFilter;
var createBlock = wp.blocks.createBlock;
var __ = wp.i18n.__;
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/inner-blocks-allowed-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function enqueue_inner_blocks_allowed_blocks_script() {
plugins_url( 'inner-blocks-allowed-blocks/index.js', __FILE__ ),
array(
'wp-blocks',
'wp-editor',
'wp-block-editor',
'wp-element',
'wp-i18n',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { withSelect } = wp.data;
const { registerBlockType } = wp.blocks;
const { createElement: el } = wp.element;
const { InnerBlocks } = wp.editor;
const { InnerBlocks } = wp.blockEditor;
const __ = wp.i18n.__;
const divProps = { className: 'product', style: { outline: '1px solid gray', padding: 5 } };
const template = [
Expand Down Expand Up @@ -64,7 +64,7 @@
category: 'common',

edit: withSelect( function( select, ownProps ) {
var getBlockOrder = select( 'core/editor' ).getBlockOrder;
var getBlockOrder = select( 'core/block-editor' ).getBlockOrder;
return {
numberOfChildren: getBlockOrder( ownProps.clientId ).length,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/inner-blocks-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function enqueue_container_without_paragraph_plugin_script() {
'wp-blocks',
'wp-components',
'wp-element',
'wp-editor',
'wp-block-editor',
'wp-hooks',
'wp-i18n',
),
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/inner-blocks-templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var registerBlockType = wp.blocks.registerBlockType;
var createBlock = wp.blocks.createBlock;
var el = wp.element.createElement;
var InnerBlocks = wp.editor.InnerBlocks;
var InnerBlocks = wp.blockEditor.InnerBlocks;
var __ = wp.i18n.__;
var TEMPLATE = [
[ 'core/paragraph', {
Expand Down
3 changes: 2 additions & 1 deletion packages/e2e-tests/plugins/plugins-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function enqueue_plugins_api_plugin_scripts() {
'wp-compose',
'wp-data',
'wp-edit-post',
'wp-block-editor',
'wp-editor',
'wp-element',
'wp-i18n',
Expand All @@ -63,7 +64,7 @@ function enqueue_plugins_api_plugin_scripts() {
'wp-compose',
'wp-data',
'wp-edit-post',
'wp-editor',
'wp-block-editor',
'wp-element',
'wp-i18n',
'wp-plugins',
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/plugins/plugins-api/annotations-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var withSelect = wp.data.withSelect;
var select = wp.data.select;
var dispatch = wp.data.dispatch;
var PlainText = wp.editor.PlainText;
var PlainText = wp.blockEditor.PlainText;
var Fragment = wp.element.Fragment;
var el = wp.element.createElement;
var Component = wp.element.Component;
Expand Down Expand Up @@ -63,7 +63,7 @@
onClick: () => {
dispatch( 'core/annotations' ).__experimentalAddAnnotation( {
source: 'e2e-tests',
blockClientId: select( 'core/editor' ).getBlockOrder()[ 0 ],
blockClientId: select( 'core/block-editor' ).getBlockOrder()[ 0 ],
richTextIdentifier: 'content',
range: {
start: parseInt( this.state.start, 10 ),
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/plugins-api/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var withSelect = wp.data.withSelect;
var select = wp.data.select;
var dispatch = wp.data.dispatch;
var PlainText = wp.editor.PlainText;
var PlainText = wp.blockEditor.PlainText;
var Fragment = wp.element.Fragment;
var el = wp.element.createElement;
var __ = wp.i18n.__;
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e-tests/specs/reusable-blocks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ describe( 'Reusable Blocks', () => {
beforeEach( async () => {
// Remove all blocks from the post so that we're working with a clean slate
await page.evaluate( () => {
const blocks = wp.data.select( 'core/editor' ).getBlocks();
const blocks = wp.data.select( 'core/block-editor' ).getBlocks();
const clientIds = blocks.map( ( block ) => block.clientId );
wp.data.dispatch( 'core/editor' ).removeBlocks( clientIds );
wp.data.dispatch( 'core/block-editor' ).removeBlocks( clientIds );
} );
} );

Expand Down
Loading