Skip to content
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

Fix Live Markdown Input undo/redo history on web #342

Merged
merged 15 commits into from
May 16, 2024

Conversation

Skalakid
Copy link
Collaborator

@Skalakid Skalakid commented May 8, 2024

Details

This PR enhances undo/redo history logic. The main changes are:

  • changed the debouncedAdd function to throttledAdd. Now it instantly adds an item to history and until the throttle time ends, executing it again will only modify the previously added item. After the time ends, launching throttledAdd will add a new element.
    Before these changes debouncedAdd function was adding an element to history after the debounce time
  • fixed cursor positioning when undoing text. Now cursor is positioned at the beginning of the text that was undone

Related Issues

Expensify/App#39255

Manual Tests

  1. Copy and paste text into Live Markdown Input somewhere else than the end of the value inside
  2. Try to undo it immediately after pasting it
  3. Verify if text was undone and if cursor position was set it the place where the undo text was beginning

Linked PRs

@BartoszGrajdek
Copy link
Collaborator

One small bug - cursor position is incorrect here after undo

Video
Screen.Recording.2024-05-10.at.13.29.43.mov

@Skalakid
Copy link
Collaborator Author

@BartoszGrajdek I can't reproduce this issue, did you pull the latest changes?

BartoszGrajdek
BartoszGrajdek previously approved these changes May 13, 2024
Copy link
Collaborator

@BartoszGrajdek BartoszGrajdek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@BartoszGrajdek BartoszGrajdek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Skalakid Skalakid merged commit 3f077ae into main May 16, 2024
4 checks passed
@Skalakid Skalakid deleted the @Skalakid/enhance-input-history branch May 16, 2024 08:24
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