Preserve Undo History in Markdown Preview Mode #22026
Open
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.
What type of PR is this? (check all applicable)
Description
This new feature aims to improve the user experience when creating content.
Currently, when editing a post and switching to Preview mode, the browser loses the history of the changes made, preventing the user from using the Ctrl+Z shortcut to undo previous edits. With this feature, the Markdown editor remains in the DOM even during preview. This way, the browser retains the edit history, allowing the user to revert changes after returning to edit mode.
Additionally, the feature ensures that while in Preview mode, the Ctrl+Z shortcut has no effect. This guarantees that Preview remains strictly a viewing mode, without permitting any content changes.
-This implementation renders the Form even when the user
switches to Preview. In addition, so that its not allowed
to make changes in Preview mode, this feature ignores the
ctrl+z event while in Preview mode.
-Two E2E tests and 1 unit test were implemented to ensure
this behaviour.
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Added/updated tests?
have not been included