From f1792649294fc40384639a7f1e711259f5e22ff4 Mon Sep 17 00:00:00 2001 From: Matthew Kevins Date: Sat, 13 Apr 2019 17:46:20 +1000 Subject: [PATCH] Add selectBlock method to BlockHolder --- src/block-management/block-holder.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/block-management/block-holder.js b/src/block-management/block-holder.js index beefcb3d18..ebfdcd42cc 100644 --- a/src/block-management/block-holder.js +++ b/src/block-management/block-holder.js @@ -88,6 +88,12 @@ export class BlockHolder extends React.Component { this.props.onSelect( this.props.clientId ); }; + selectBlock = ( block ) => { + if ( this.props.onSelect && block && block.clientId ) { + this.props.onSelect( block.clientId ); + } + } + onRemoveBlockCheckUpload = ( mediaId: number ) => { if ( hasAction( 'blocks.onRemoveBlockCheckUpload' ) ) { // now remove the action as it's a one-shot use and won't be needed anymore @@ -181,6 +187,7 @@ export class BlockHolder extends React.Component { setAttributes={ this.props.onChange } onFocus={ this.onFocus } onReplace={ this.props.onReplace } + selectBlock={ this.selectBlock } insertBlocksAfter={ this.insertBlocksAfter } mergeBlocks={ this.mergeBlocks } onCaretVerticalPositionChange={ this.props.onCaretVerticalPositionChange }