diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index 2f5ac490d3407..021511b941e42 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -12,7 +12,7 @@ import { View, Platform } from 'react-native'; import { Component, RawHTML } from '@wordpress/element'; import { withInstanceId, compose } from '@wordpress/compose'; import { BlockFormatControls } from '@wordpress/block-editor'; -import { withSelect } from '@wordpress/data'; +import { withSelect, withDispatch } from '@wordpress/data'; import { applyFormat, getActiveFormat, @@ -490,6 +490,7 @@ export class RichText extends Component { this.lastContent = newContent; this.props.onChange( this.lastContent ); } + this.props.onSelectionChange(realStart, realEnd); } isEmpty() { @@ -776,6 +777,21 @@ const RichTextContainer = compose( [ onFocus: context.onFocus || ownProps.onFocus, }; } ), + withDispatch( ( dispatch, { + clientId, + instanceId, + identifier = instanceId, + } ) => { + const { + selectionChange, + } = dispatch( 'core/block-editor' ); + + return { + onSelectionChange( start, end ) { + selectionChange( clientId, identifier, start, end ); + }, + }; + } ), ] )( RichText ); RichTextContainer.Content = ( { value, format, tagName: Tag, multiline, ...props } ) => { diff --git a/packages/block-library/src/heading/edit.native.js b/packages/block-library/src/heading/edit.native.js index fb41a50cc10f2..75322c2fd0505 100644 --- a/packages/block-library/src/heading/edit.native.js +++ b/packages/block-library/src/heading/edit.native.js @@ -121,6 +121,7 @@ class HeadingEdit extends Component { setAttributes( { level: newLevel } ) } />