Skip to content

Commit

Permalink
Remove onSplitAtEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Dec 18, 2024
1 parent 211052c commit 1aca4b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
9 changes: 2 additions & 7 deletions packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ 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';

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 );
Expand Down Expand Up @@ -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,
Expand All @@ -77,7 +72,7 @@ export default function PostTitleEdit( {
value={ rawTitle }
onChange={ setTitle }
__experimentalVersion={ 2 }
__unstableOnSplitAtEnd={ onSplitAtEnd }
disableLineBreaks
{ ...blockProps }
/>
) : (
Expand All @@ -100,7 +95,7 @@ export default function PostTitleEdit( {
value={ rawTitle }
onChange={ setTitle }
__experimentalVersion={ 2 }
__unstableOnSplitAtEnd={ onSplitAtEnd }
disableLineBreaks
/>
</TagName>
) : (
Expand Down

0 comments on commit 1aca4b5

Please sign in to comment.