fix: Store hotkeys to specified name (#3280)
* fix: Store hotkeys to specified name * fix: Move hotkey name into a new hotkey object
This commit is contained in:
1 parent
b2128976a3
commit
2f33e42004
4 files changed
+32
-16
No files matched your search
@@ -114,7 +114,15 @@ export default function ModeRoute({
|
||||
hangingProtocolService,
|
||||
} = (servicesManager as ServicesManager).services;
|
||||
|
||||
const { extensions, sopClassHandlers, hotkeys, hangingProtocol } = mode;
|
||||
const {
|
||||
extensions,
|
||||
sopClassHandlers,
|
||||
hotkeys: hotkeyObj,
|
||||
hangingProtocol,
|
||||
} = mode;
|
||||
// Preserve the old array interface for hotkeys
|
||||
const hotkeys = Array.isArray(hotkeyObj) ? hotkeyObj : hotkeyObj?.hotkeys;
|
||||
const hotkeyName = hotkeyObj?.name || 'hotkey-definitions-v2';
|
||||
|
||||
if (dataSourceName === undefined) {
|
||||
dataSourceName = extensionManager.defaultDataSourceName;
|
||||
@@ -204,14 +212,12 @@ export default function ModeRoute({
|
||||
|
||||
hotkeysManager.setDefaultHotKeys(hotkeys);
|
||||
|
||||
const userPreferredHotkeys = JSON.parse(
|
||||
localStorage.getItem('hotkey-definitions')
|
||||
);
|
||||
const userPreferredHotkeys = JSON.parse(localStorage.getItem(hotkeyName));
|
||||
|
||||
if (userPreferredHotkeys?.length) {
|
||||
hotkeysManager.setHotkeys(userPreferredHotkeys);
|
||||
hotkeysManager.setHotkeys(userPreferredHotkeys, hotkeyName);
|
||||
} else {
|
||||
hotkeysManager.setHotkeys(hotkeys);
|
||||
hotkeysManager.setHotkeys(hotkeys, hotkeyName);
|
||||
}
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in new issue
Block a user