State: Batch updates to title (and other post properties) for undo #5553
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #4057
Related: #4956
This pull request seeks to apply the same undo buffering introduced in #4956 for blocks to apply to all post property updates. This particularly impacts the post title, where the changes proposed here will improve undo to apply to aggregate of the changes applied to the title, rather than a single character at a time.
In the process, the
KeyboardShortcuts
component has been updated to acceptchildren
to which keyboard events should be monitored. This was proposed as a future enhancement in the original implementation (#1944).Due to issues with React controlled textareas (facebook/react#8514), key events for undo/redo must be monitored manually within the title, and redirected as dispatching actions to the editor store.
Testing instructions:
Verify that when entering a title, pressing Undo no longer reverts one character at a time, but rather all changes made in sequence.
This same behavior applies to any other post property change (e.g. status, author, etc).