Skip to content

Add support for custom onSplit, onSplitMiddle #47806

Closed

Description

@kosiew

What problem does this address?

There are occasions when we would like to modify onSplit behaviour.
In the example below, we want the split Heading to be a paragraph.

patch package Feb-04-2023 09-31-57

We had to use patch-package to make the above change:

image

What is your proposed solution?

Currently, onSplit is a prop of the RichText child of BlockEdit and we don't have a way to manipulate it.

Request - allow custom onSplit, onSplitMiddle behaviour.

Activity

  1. github-actions commented on Aug 7, 2023

    @github-actions

    Hi,
    This issue has gone 180 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps.
    Thanks for helping out.

  2. ellatrix commented on Jul 8, 2024

    @ellatrix
    Member

    Hi @kosiew! I recommend using a ref to override the keydown native event and use event.preventDefault to prevent RichText default behaviour. Note that this won't work with React events atm.

  3. youknowriad commented on Oct 22, 2026

    @youknowriad
    Contributor

    Thanks for the report, @kosiew! The example here is now core behaviour: since #61891, splitting a Heading turns the second half into a paragraph (the default block), so the patch shouldn't be needed anymore. More generally, splitting moved out of RichText into the block editor store in #54543 and is now opted into with the "splitting" support in block.json, which is why the RichText onSplit prop was deprecated rather than extended. Closing thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions