8000 Preserve Undo History in Markdown Preview Mode by l28j · Pull Request #22026 · forem/forem · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Preserve Undo History in Markdown Preview Mode #22026

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

l28j
Copy link
Contributor
@l28j l28j commented Jun 13, 2025

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

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

See the video of QA

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

JMTeixeira7 and others added 2 commits June 6, 2025 16:46
Feat Description: The feature aims to allow the user to
undo the changes of a post if he doesnt like the way
they look in preview mode. Current version doesnt
allow this, because the Form is lefted out of the DOM
when user switches to Preview Mode.

-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.

Co-authored-by: João Lucas <joao.lucas.m.c.t.r@tecnico.ulisboa.pt>
@l28j l28j requested review from a team as code owners June 13, 2025 13:35
Copy link
Contributor

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

@benhalpern benhalpern requested a review from mikeydorje June 13, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0