-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table of Contents: fix undo history quirk #41031
Comments
I believe this issue is caused by having to do As I mentioned in this comment of how and why "undo trap" is an issue, although this issue is technically not that kind of issue, they are similar in a way that most practices still apply. If we edit a Heading block character-on-character, (I think) this happens:
However, if we add a ToC block to the post, something changes because of the
I'm not sure if there's an easy solution for this, but one possible solution might be refactoring the block into a dynamic block so that it doesn't have to call
|
Scratch that too 😅, I don't think delaying the update is the right approach, it'll still break the undo history. We might have to go for the dynamic block approach in the current architecture. |
I don't think this is a big enough deal to block. Sure, if the block needs to go dynamic to better support identifying headings within the post content, wherever the block is rendered on the page (#41173 (comment)), it's fine to dive in after—but otherwise it's hardly noticeable. |
👋🏼 I'm doing a sweep of high priority issues to keep this label relevant and actionable. This effort has clearly stalled so the label has been removed as it was added in a release specific window. If you believe this should be added back in, please comment with some context. I am making my best estimates across the project and want to get this right! P.S. there's a current effort underway that might nicely address this issue. |
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
Screenshots, screen recording, code snippet
No response
Environment info
trunk
as of ff56d57Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: