solana-playground
solana-playground copied to clipboard
Undo delete functionality for files and folders
What happened:
I was editing in this browser, and all to quickly hit the 'delete' key while focused on the wrong part of the page. I was already about to type 'Enter', and so I deleted my entire lib.rs file with no way of recovery.
What would help: An "Undo Delete" feature would improve the usability of this project by helping users avoid painful losses from a mistroke of the keyboard.
Possible Implementation, High-Level: All files and folders could be deleted "softly", so that if the user focuses the sidebar and presses 'Crl+Z', or clicks an 'Undo' icon, they can restore their file. This would likely require storing the file data in either localStorage, or not really removing it from state and instead moving it to a 'deleted' state, that can be recovered.
- Factors like the size of the file(s) deleted or time after deletion could also be used to hard delete files if that optimization is desired
Sorry that this happened to you, will definitely integrate this feature after moving file system to indexed db(which is next on my todo list).
I figured out that if you forward delete on Mac (fn + delete), even if you are in the editor typing, this opens the pop-up to confirm the file delete! This should not happen. The editor even deleted the character after I closed the popup. The app should check for a selected file or folder in the sidebar before enabling a delete from the keyboard like this!
Agreed, that shouldn't happen. Thanks for reporting, fixed in 1a9b7375e4b6e28f13674cb225785c95fc3f4926.