This pull request addresses the issue of the lack of undo functionality for paste actions in the main prompt text box of Anything LLM. Specifically, it ensures that when users press Ctrl+Z on Windows or Command+Z on Mac after pasting text, the paste operation is undone, and the pasted text is removed from the text box. This change improves the user experience by allowing users to easily revert paste actions without manually deleting the text.
Additional Information
The implementation includes modifications to the event handling for the main prompt text box to correctly process Ctrl+Z and Command+Z as undo operations for paste actions.
Also includes implementation of redo using Ctrl+Shift+Z and Command+Shift+Z
Manual tests have been performed to verify that the undo functionality works as expected across pasting, and text input.
This update enhances the usability of the text box, aligning with common text editing behaviors found in other applications, thereby making the interaction more intuitive for users.
No additional dependencies were added in this PR. Existing functionality was extended to include proper handling of undo operations for pasted text.
Code conforms to the pattern found in the same file and prettier rules have been followed/adjusted for.
Developer Validations
[x] I ran yarn lint from the root of the repo & committed changes
Pull Request Type
Original by @MrSimonC on #2591
Relevant Issues
resolves #2590 closes #2591
What is in this change?
This pull request addresses the issue of the lack of undo functionality for paste actions in the main prompt text box of Anything LLM. Specifically, it ensures that when users press
Ctrl+Z
on Windows orCommand+Z
on Mac after pasting text, the paste operation is undone, and the pasted text is removed from the text box. This change improves the user experience by allowing users to easily revert paste actions without manually deleting the text.Additional Information
Ctrl+Z
andCommand+Z
as undo operations for paste actions.Ctrl+Shift+Z
andCommand+Shift+Z
Developer Validations
yarn lint
from the root of the repo & committed changes