Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
123 changes: 0 additions & 123 deletions lib/class-wp-rest-blocks-controller.php

This file was deleted.

1 change: 0 additions & 1 deletion lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// These files only need to be loaded if within a rest server instance
// which this class will exist if that is the case.
if ( class_exists( 'WP_REST_Controller' ) ) {
require dirname( __FILE__ ) . '/class-wp-rest-blocks-controller.php';
require dirname( __FILE__ ) . '/class-wp-rest-autosaves-controller.php';
require dirname( __FILE__ ) . '/class-wp-rest-block-renderer-controller.php';
require dirname( __FILE__ ) . '/class-wp-rest-search-controller.php';
Expand Down
15 changes: 7 additions & 8 deletions lib/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,20 @@ function gutenberg_register_post_types() {
register_post_type(
'wp_block',
array(
'labels' => array(
'labels' => array(
'name' => 'Blocks',
'singular_name' => 'Block',
),
'public' => false,
'rewrite' => false,
'show_in_rest' => true,
'rest_base' => 'blocks',
'rest_controller_class' => 'WP_REST_Blocks_Controller',
'capability_type' => 'block',
'public' => false,
'rewrite' => false,
'show_in_rest' => true,
'rest_base' => 'blocks',
'capability_type' => 'block',
'capabilities' => array(
'read' => 'read_blocks',
'create_posts' => 'create_blocks',
),
'map_meta_cap' => true,
'map_meta_cap' => true,
)
);

Expand Down
38 changes: 36 additions & 2 deletions packages/block-library/src/block/edit-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Button } from '@wordpress/components';
import { Component, Fragment, createRef } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { ESCAPE } from '@wordpress/keycodes';
import { withInstanceId } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
import { withInstanceId, compose } from '@wordpress/compose';

class ReusableBlockEditPanel extends Component {
constructor() {
Expand Down Expand Up @@ -115,4 +116,37 @@ class ReusableBlockEditPanel extends Component {
}
}

export default withInstanceId( ReusableBlockEditPanel );
export default compose( [
withInstanceId,
withSelect( ( select ) => {
const { getEditedPostAttribute } = select( 'core/editor' );

return {
title: getEditedPostAttribute( 'title' ),
};
} ),
withDispatch( ( dispatch, ownProps ) => {
const {
editPost,
undoAll,
savePost,
clearSelectedBlock,
} = dispatch( 'core/editor' );

return {
onChangeTitle( title ) {
editPost( { title } );
},
onSave() {
clearSelectedBlock();
savePost();
ownProps.onSave();
},
onCancel() {
clearSelectedBlock();
undoAll();
ownProps.onCancel();
},
};
} ),
] )( ReusableBlockEditPanel );
Loading