Implement Alert Feature for Unsaved Changes in Editor
hacktoberfest
This pull request implements the "Better Save" feature (issue #11) by introducing an alert mechanism that warns users of unsaved changes when attempting to leave the screen without saving their content. The changes are contained within the editor.js file.
**Changes**:
Added a new alert feature that triggers when the user attempts to navigate away from the editor screen without saving their changes.
Implemented a check to detect unsaved changes and display a confirmation prompt to the user.
**Related Issues:**
Closes #11: Better Save feature implementation
**Notes:**
This implementation uses a flag called `prevent_save` and function `checkForUnsavedChanges` to check for unsaved changes. Also added a `beforeunload` event listener to make changes to prevent_save flag based on user choice.
合并状态:已合并 合并于 2024-10-07 关闭于 2024-10-07 3 条评论