diff --git a/packages/block-editor/src/components/rich-text/event-listeners/enter.js b/packages/block-editor/src/components/rich-text/event-listeners/enter.js index f2308deddd676a..75a265f8da9b2e 100644 --- a/packages/block-editor/src/components/rich-text/event-listeners/enter.js +++ b/packages/block-editor/src/components/rich-text/event-listeners/enter.js @@ -29,6 +29,7 @@ export default ( props ) => ( element ) => { onChange( insert( value, '\n' ) ); } } else if ( onSplitAtEnd && start === end && end === text.length ) { + // This is no longer used anywhere. Deprecate? event.preventDefault(); onSplitAtEnd(); } else if ( onReplace && onSplit ) { diff --git a/packages/block-library/src/post-title/edit.js b/packages/block-library/src/post-title/edit.js index fdfb8e7c2c6cd2..a7137be35d4420 100644 --- a/packages/block-library/src/post-title/edit.js +++ b/packages/block-library/src/post-title/edit.js @@ -17,7 +17,6 @@ import { } from '@wordpress/block-editor'; import { ToggleControl, TextControl, PanelBody } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { createBlock, getDefaultBlockName } from '@wordpress/blocks'; import { useEntityProp, store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; @@ -25,7 +24,6 @@ export default function PostTitleEdit( { attributes: { level, levelOptions, textAlign, isLink, rel, linkTarget }, setAttributes, context: { postType, postId, queryId }, - insertBlocksAfter, } ) { const TagName = level === 0 ? 'p' : `h${ level }`; const isDescendentOfQueryLoop = Number.isFinite( queryId ); @@ -57,9 +55,6 @@ export default function PostTitleEdit( { postId ); const [ link ] = useEntityProp( 'postType', postType, 'link', postId ); - const onSplitAtEnd = () => { - insertBlocksAfter( createBlock( getDefaultBlockName() ) ); - }; const blockProps = useBlockProps( { className: clsx( { [ `has-text-align-${ textAlign }` ]: textAlign, @@ -77,7 +72,7 @@ export default function PostTitleEdit( { value={ rawTitle } onChange={ setTitle } __experimentalVersion={ 2 } - __unstableOnSplitAtEnd={ onSplitAtEnd } + disableLineBreaks { ...blockProps } /> ) : ( @@ -100,7 +95,7 @@ export default function PostTitleEdit( { value={ rawTitle } onChange={ setTitle } __experimentalVersion={ 2 } - __unstableOnSplitAtEnd={ onSplitAtEnd } + disableLineBreaks /> ) : (