Skip to content

Table of Contents: fix undo history quirk #41031

@ZebulanStanphill

Description

@ZebulanStanphill

Description

As noted in #29739, there is an undesirable quirk with the current implementation of the Table of Contents block:

When a Table of Contents block is present, every letter typed in a Heading block counts as a separate undo step, in contrast to the default behavior of multiple letters typed in sequence being combined into a single undo step. This only affects typing in Heading blocks; other blocks continue to behave as expected, with whole strings of sequentially typed text counted as a single undo step as expected.

Unfortunately, I am not aware of any way to fix this, so I could use some expert technical help here.

Step-by-step reproduction instructions

  1. Insert a Table of Contents block.
  2. Insert a Heading block.
  3. Type "Hello world" into the Heading block.
  4. Click the "Undo" button in the main toolbar of the editor.
  5. Notice that each undo step removes a single character, instead of the entire sequence of typed text.

Screenshots, screen recording, code snippet

No response

Environment info

  • WP 6.0-alpha-52828
  • Gutenberg trunk as of ff56d57

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

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