diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index 0e5ff3847547a..a22b251dd607c 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -100,7 +100,6 @@ function RichTextWrapper( onMerge, onSplit, __unstableOnSplitAtEnd: onSplitAtEnd, - __unstableOnSplitMiddle: onSplitMiddle, identifier, preserveWhiteSpace, __unstablePastePlainText: pastePlainText, @@ -380,7 +379,6 @@ function RichTextWrapper( tagName, onReplace, onSplit, - onSplitMiddle, __unstableEmbedURLOnPaste, multilineTag, preserveWhiteSpace, @@ -396,7 +394,6 @@ function RichTextWrapper( value, onReplace, onSplit, - onSplitMiddle, multilineTag, onChange, disableLineBreaks, diff --git a/packages/block-editor/src/components/rich-text/split-value.js b/packages/block-editor/src/components/rich-text/split-value.js index e64fb603a05a1..0ec083c9fe1e5 100644 --- a/packages/block-editor/src/components/rich-text/split-value.js +++ b/packages/block-editor/src/components/rich-text/split-value.js @@ -13,7 +13,6 @@ export function splitValue( { pastedBlocks = [], onReplace, onSplit, - onSplitMiddle, multilineTag, } ) { if ( ! onReplace || ! onSplit ) { @@ -35,8 +34,8 @@ export function splitValue( { // Create a block with the content before the caret if there's no pasted // blocks, or if there are pasted blocks and the value is not empty. We do - // not want a leading empty block on paste, but we do if split with e.g. the - // enter key. + // not want a leading empty block on paste, but we do if we split with e.g. + // the enter key. if ( ! hasPastedBlocks || ! isEmpty( before ) ) { blocks.push( onSplit( @@ -53,19 +52,13 @@ export function splitValue( { if ( hasPastedBlocks ) { blocks.push( ...pastedBlocks ); lastPastedBlockIndex += pastedBlocks.length; - } else if ( onSplitMiddle ) { - blocks.push( onSplitMiddle() ); } - // If there's pasted blocks, append a block with non empty content / after - // the caret. Otherwise, do append an empty block if there is no - // `onSplitMiddle` prop, but if there is and the content is empty, the - // middle block is enough to set focus in. - if ( - hasPastedBlocks - ? ! isEmpty( after ) - : ! onSplitMiddle || ! isEmpty( after ) - ) { + // Create a block with the content after the caret if there's no pasted + // blocks, or if there are pasted blocks and the value is not empty. We do + // not want a trailing empty block on paste, but we do if we split with e.g. + // the enter key. + if ( ! hasPastedBlocks || ! isEmpty( after ) ) { blocks.push( onSplit( toHTMLString( { diff --git a/packages/block-editor/src/components/rich-text/use-enter.js b/packages/block-editor/src/components/rich-text/use-enter.js index ad51128172582..623203fb687df 100644 --- a/packages/block-editor/src/components/rich-text/use-enter.js +++ b/packages/block-editor/src/components/rich-text/use-enter.js @@ -37,7 +37,6 @@ export function useEnter( props ) { value, onReplace, onSplit, - onSplitMiddle, multilineTag, onChange, disableLineBreaks, @@ -78,7 +77,6 @@ export function useEnter( props ) { value: _value, onReplace, onSplit, - onSplitMiddle, multilineTag, } ); } else { @@ -100,7 +98,6 @@ export function useEnter( props ) { value: _value, onReplace, onSplit, - onSplitMiddle, multilineTag, } ); } diff --git a/packages/block-editor/src/components/rich-text/use-paste-handler.js b/packages/block-editor/src/components/rich-text/use-paste-handler.js index d86691ced7097..d64d7ca6b15bb 100644 --- a/packages/block-editor/src/components/rich-text/use-paste-handler.js +++ b/packages/block-editor/src/components/rich-text/use-paste-handler.js @@ -58,7 +58,6 @@ export function usePasteHandler( props ) { tagName, onReplace, onSplit, - onSplitMiddle, __unstableEmbedURLOnPaste, multilineTag, preserveWhiteSpace, @@ -179,7 +178,6 @@ export function usePasteHandler( props ) { pastedBlocks: blocks, onReplace, onSplit, - onSplitMiddle, multilineTag, } ); } @@ -239,7 +237,6 @@ export function usePasteHandler( props ) { pastedBlocks: content, onReplace, onSplit, - onSplitMiddle, multilineTag, } ); }