Conversation
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
2677d21 to
282ba60
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new user preference to disable table editor shortcuts and migrates existing user preferences from cookies to localStorage for improved management.
- Added a method to toggle table editor shortcuts in the table editor module.
- Updated the statusbar UI to include a checkbox for disabling table editor shortcuts.
- Implemented a Storage utility and a migration routine in the main index file to transition preference storage from cookies to localStorage.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| public/js/lib/editor/table-editor.js | Adds a new API to enable/disable shortcuts and checks the saved cookie value. |
| public/js/lib/editor/statusbar.html | Updates the dropdown menu to include a control for table editor shortcuts. |
| public/js/lib/editor/index.js | Implements a Storage utility and migrates preferences from cookies to localStorage. |
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
1b84a39 to
81611f2
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new user preference to disable table editor shortcuts and migrates user preferences from cookies to localStorage to improve manageability.
- Adds a new method in the table editor to toggle keyboard shortcuts based on user preference.
- Adds a new checkbox in the status bar to disable table editor shortcuts.
- Implements a Storage utility and updates preference handling in the Editor class to use localStorage.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| public/js/lib/editor/table-editor.js | Added setShortcutsEnabled to enable/disable keymap based on preference |
| public/js/lib/editor/statusbar.html | Inserted a new checkbox for disabling table editor shortcuts |
| public/js/lib/editor/index.js | Introduced Storage utility, migrated preference keys from cookies to localStorage, and updated related preference operations |
Comments suppressed due to low confidence (1)
public/js/lib/editor/table-editor.js:136
- Consider verifying that 'lastActive' is defined in every relevant context to avoid potential runtime errors if it's undefined.
if (!enabled && lastActive) {
| Storage.set(key, cookieValue) | ||
| console.log(`Migrated preference ${key} from cookies to localStorage`) |
There was a problem hiding this comment.
[nitpick] Consider removing each migrated cookie after a successful transfer to localStorage to avoid retaining stale data.
| Storage.set(key, cookieValue) | |
| console.log(`Migrated preference ${key} from cookies to localStorage`) | |
| if (Storage.set(key, cookieValue)) { | |
| // Remove the cookie after successful migration | |
| Cookies.remove(key) | |
| console.log(`Migrated and removed cookie for preference ${key} from cookies to localStorage`) | |
| } |
Introduce a new preference option to disable shortcuts in the table editor and migrate user preferences from cookies to localStorage for better management.