RAIRLab / Peirce-My-Heart

A graphical web application for interactive theorem proving in Charles Peirce's alpha existential graph system.
https://rairlab.github.io/Peirce-My-Heart/
MIT License
11 stars 0 forks source link

Firefox Cannot Save or Load Files #388

Closed RyanR712 closed 7 months ago

RyanR712 commented 7 months ago

Describe the bug Neither CTRL+S or clicking the save button on Firefox download files. There is no difference in behavior between Draw Mode and Proof Mode downloads.

CTRL+S will attempt to download the .webp file and clicking the save file button will bring up a 404 error.

To Reproduce Access PMH via Firefox. Then,

Create some drawing or some proof and attempt to save it through CTRL+S or clicking the save button.

In the former case, you will download a .webp file instead.

In the latter case, you will get redirected to a 404 error.

Expected behavior CTRL+S and clicking the save button should prompt the user to download a .json file to their downloads folder.

Screenshots Or Video Improper CTRL+S behavior. image

Improper save button behavior. image

James-Oswald commented 7 months ago

Cause: Firefox does not have "showSaveFilePicker" https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker image This triggers quick download code, which behaves differently on Firefox, as clicking a link opens a new tab rather than starting a download.

const f = document.createElement("a");
f.href = aegStringify(data);
f.download = name + ".json";
f.click();
James-Oswald commented 7 months ago

Bug also applies to loading files