-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(hotkeys): Migrate hotkeys to customization service and fix issues with overrides #4777
Conversation
- Implemented undo and redo commands in Cornerstone extension - Added Undo and Redo toolbar buttons in longitudinal mode - Integrated hotkey bindings for Ctrl+Z and Ctrl+Y - Created a utility function for generating hash values - Updated HotkeysManager to improve hotkey handling
- Updated hotkey loading priority in Mode route - Added support for global, mode-specific, and default hotkey configurations - Improved HotkeysManager with better default binding and destroy methods - Removed unnecessary logging and commented code
- Removed default hotkey bindings from core defaults - Updated modes to remove hardcoded hotkey configurations - Introduced customization service for managing hotkey bindings - Added support for dynamic hotkey configuration in different modes - Simplified hotkey management in Mode route and HotkeysManager
- Moved tours configuration from global config to customization service - Updated Onboarding component to accept tours as a prop - Removed tours configuration from default and Netlify config files - Updated documentation for tour configuration - Added tour customization module in default extension
- Renamed tour customization module to onboarding - Refactored HotkeysManager to support user-preferred key bindings - Simplified hotkey configuration in Mode route - Added persistent storage for user-defined hotkey preferences - Introduced more robust hotkey registration and management
✅ Deploy Preview for ohif-dev canceled.
|
✅ Deploy Preview for ohif-platform-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
extensions/default/src/customizations/hotkeyBindingsCustomization.ts
Outdated
Show resolved
Hide resolved
@@ -293,305 +293,4 @@ window.config = { | |||
// )) | |||
// }, | |||
// }, | |||
hotkeys: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need an example somewhere of how to add a custom binding? Probably something in e2e.js that demonstrates customizing the configuration bindings by adding a specific customization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the changes:
Define the bindings for the extension in the extension
Define an array of customizations in the mode that combined define the hotkeys extensions to use
Define the default array of customizations in the extensions, and apply that as the default customizations to apply for a mode (so that modes do not need to define hotkey bindings customizations, but get something to apply by default)
Add a customization to the extensions in the e2e config that over-writes at least one hotkey to demonstrate how to use customization to add hotkey bindings.
Add at least one hotkey binding which has no keys, but is editable to demonstrate the ability to list hotkey commands which could be customized for the user should they choose to do so.
Generally I really like this change - I think it is a significant improvement
As we discussed,
|
- Simplified HotkeysManager initialization by setting default values - Added documentation for global and mode-specific hotkey customization - Updated Onboarding component to handle optional tours - Introduced sample customization for hotkey bindings in configuration
- Added default hotkey bindings in core defaults - Implemented migration utility for legacy hotkey definitions - Updated HotkeysManager to support migrating old hotkey configurations - Simplified hotkey bindings customization in default extension
Viewers
|
Project |
Viewers
|
Branch Review |
feat/undo-redo
|
Run status |
|
Run duration | 02m 11s |
Commit |
|
Committer | sedghi |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
2
|
|
0
|
|
44
|
View all changes introduced in this branch ↗︎ |
- Added default window level presets to core defaults - Modified hotkey binding method in basic test mode from $set to $push - Removed unused hash generation utilities from core utils
Hotkeys
Key Changes:
hotkeys: [...hotkeys.defaults.hotkeyBindings]
customizationService
under the keyohif.hotkeyBindings
HotkeysManager
has undergone significant updates including better handling of defaults, key persistence, and cleanupMigration Steps:
1. Remove hotkeys array from mode factory definition
Before:
After:
2. Set custom hotkeys using the customization service
There are several methods to modify hotkeys using the customization service:
a. Completely replace all hotkeys using
$set
:b. Add new hotkeys using
$push
:4. Update configuration file if you were setting window.config.hotkeys
If you were previously defining hotkeys in your window.config.js file, it was not really
taken into account. So you can safely remove it now.
Before:
After:
5. Be aware that user preferences are now handled differently
The new system automatically handles user-preferred hotkey mappings:
localStorage
under the keyuser-preferred-keys
Tours
1. Update any direct references to window.config.tours
If you have any code that directly references window.config.tours, update it to use the customization service:
2. Use config update patterns for configuring tours
Before:
After: