sys-bio / AntimonyEditor

Antimony Web Editor: A Web Editor for the Antimony Modeling Language
https://sys-bio.github.io/AntimonyEditor/
MIT License
0 stars 1 forks source link

Persist on refresh and delete file functionality. #12

Closed SamChou05 closed 7 months ago

SamChou05 commented 8 months ago

I store the selected file index to local storage using useEffect in the file explorer and then get the index stored in the local storage to get the content from the selected file. This keeps the selected file highlighted and its contents on the screen even if the page refreshes. The file being deleted is managed separately so you can delete a file that isn't currently being displayed without changing the file contents being displayed. The context menu for deleting a file is brought up by right clicking a file and selecting the delete option. If the file currently selected is deleted the displayed content returns to a default state.