Skip to content

Commit

Permalink
Fix rich image caption toolbar and focus (#15685)
Browse files Browse the repository at this point in the history
* RichText: ownProps has precedence over block context.
In this way, instances of RichText outside blocks can pass and handle their own custom onFocus and isSelected

* RichText: Remove isSelected from block edit context.

* Fix lint issues
  • Loading branch information
etoledom committed May 17, 2019
1 parent bd2bdc6 commit 8160f88
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -821,11 +821,14 @@ RichText.defaultProps = {

const RichTextContainer = compose( [
withInstanceId,
withBlockEditContext( ( { clientId, onFocus, isSelected, onCaretVerticalPositionChange }, ownProps ) => {
withBlockEditContext( ( { clientId, onFocus, onCaretVerticalPositionChange }, ownProps ) => {
// ownProps.onFocus needs precedence over the block edit context
if ( ownProps.onFocus !== undefined ) {
onFocus = ownProps.onFocus;
}
return {
clientId,
isSelected,
onFocus: onFocus || ownProps.onFocus,
onFocus,
onCaretVerticalPositionChange,
};
} ),
Expand Down

0 comments on commit 8160f88

Please sign in to comment.