whscullin / apple2js

An Apple II emulator originally written in Javascript, now being converted to TypeScript
http://www.scullinsteel.com/apple2/
MIT License
438 stars 57 forks source link

Create a FileChooser component using showOpenFilePicker #116

Closed iflan closed 2 years ago

iflan commented 2 years ago

Before, FileModal always used a file input control for selecting local files. This allowed the emulator to read from the file, but precluded writing back to the file.

With this change, the FileModal delegates to the new FileChooser component. The FileChooser will use showOpenFilePicker if it is available and a regular file input if it's not.

Using showOpenFilePicker has the advantage of allowing the emulator to write back to the file (if the user grants permission). While the emulator does not yet take advantage of this write capability, that will come.

iflan commented 2 years ago

I would just like to say that this is my first time trying to use React/Preact, so I may be doing everything wrong. Feedback is welcome!