In the below lines of code users can start saving the file but not successfully complete saving the file (eg: cancelling the save popup).
|
try { |
|
if (isTauri) await this.saveFileInTauri(saveAs); |
|
else if (typeof showSaveFilePicker != 'undefined') { |
|
await this.saveFileInDesktopBrowser(saveAs); |
|
} else await this.saveFileLegacy(); |
|
|
|
Notpad.editors.setIsSaved(Notpad.editors.getActive().id, true); |
|
} catch (err) { |
|
console.error(err); |
|
} |
In other words, there no validation that the user saved the file successfully, it just assumes, which is not best practice here. Instead it should check the status of saving process and only set Notpad.editors.setIsSaved(Notpad.editors.getActive().id, true); if it was successfully saved to local.
This can't be achieved in web browsers as stated here: https://stackoverflow.com/questions/41334881/detect-when-user-accepts-to-download-a-file
In the below lines of code users can start saving the file but not successfully complete saving the file (eg: cancelling the save popup).
Notpad/src/lib/helpers/menubar/file-options.ts
Lines 241 to 250 in f28b5f5
In other words, there no validation that the user saved the file successfully, it just assumes, which is not best practice here. Instead it should check the status of saving process and only set
Notpad.editors.setIsSaved(Notpad.editors.getActive().id, true);if it was successfully saved to local.This can't be achieved in web browsers as stated here: https://stackoverflow.com/questions/41334881/detect-when-user-accepts-to-download-a-file