Skip to content

Commit ae3b0fd

Browse files
mcsfjorgefilipecosta
authored andcommitted
RichText: Don't forget ref passing in Preview mode (#73062)
Let RichText forward the ref that it receives to the element it returns, even when this element is the lightweight alternative returned when the block editor is in preview mode. Fixes any kind of bug arising from the fact that refs passed to RichText were ignored when the block editor is in preview mode. Particularly, `useBlockProps`, with its many merged refs, was systematically ignored. This was revealed while debugging the bug that #73020 sought to fix: `useBlockElement` could never return elements because the ref callback of `useBlockElementRef` was never called. Co-authored-by: mcsf <mcsf@git.wordpress.org> Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
1 parent 636c4ef commit ae3b0fd

File tree

1 file changed

+1
-0
lines changed
  • packages/block-editor/src/components/rich-text

1 file changed

+1
-0
lines changed

packages/block-editor/src/components/rich-text/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ const PublicForwardedRichTextContainer = forwardRef( ( props, ref ) => {
569569
} = removeNativeProps( props );
570570
return (
571571
<Tag
572+
ref={ ref }
572573
{ ...contentProps }
573574
dangerouslySetInnerHTML={ {
574575
__html: valueToHTMLString( value, multiline ),

0 commit comments

Comments
 (0)