Skip to content

Commit

Permalink
Merge mobile v1.5.0 fixes into master (#15703)
Browse files Browse the repository at this point in the history
* Fix rich image caption toolbar and focus (#15685)

* 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

* RichText: Revert removing isSelected from block context (#15698)

Removing it generates a regression where inserting a new list block, the block is not selected
  • Loading branch information
koke authored May 20, 2019
1 parent 19d1cbf commit 716b80d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/block-editor/src/components/rich-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,11 +821,18 @@ RichText.defaultProps = {

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

0 comments on commit 716b80d

Please sign in to comment.