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 e22ddec63e14b8..f23775a5a08649 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() { @@ -778,6 +779,21 @@ const RichTextContainer = compose( [ onCaretVerticalPositionChange: context.onCaretVerticalPositionChange, }; } ), + 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 59cc25d8bd4c3e..c48523a216190e 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 } ) } />