fix: Combined Hotkeys for special characters (#1233)
* fix: Combined Hotkeys for special characters * add record method to hotkey manager * fix record plugin * remove unused component * add record to modal props * rename record method * replace handlers to use hotkeyRecord * fix combined keys * change expected result count from 18 to 17 * autoformat * Remove duplicate test, that was testing the wrong things; fix label; update configs * Revert "Remove duplicate test, that was testing the wrong things; fix label; update configs" This reverts commit 4292f4fe67351962d61cae623b920dcbd87dd71d. * Fix the record plugin's registration * fix exposed record method usage * adding logging for info level items * Hotkey definitions don't need to be globally reactive; use localstorage/appconfig as sources of truth; not redux * Tidy up test * Remove unused code from UserPreferencesForm * Log info when we run a command * fix hotkey preference restore * use application configured hotkeys if there are no user preferred * Avoid logging circular ref * Fix callouts * Fix small issue with array * Fix langua issue after refactor and merge * Refactor on recordCurrentCombo as Rodrigo did before * Separating components in 2 files * WIP Refactor to simplify the user preferences and move into each form the save and controll functionalities * Remove context * Remove unused import * Initial work on Field treatment * Refactor General preferences * Small refactor removing type from HotkeyField * small update on style * Refactor and layout fixed * Make hotkeys preferences working with old hotkeys row * Move error handling out of hotkey row/input component * WIP custom form * Moving validation function to component * Exposing hotkeyRecord as it does not depend on HotkeyManager Class * Making hotkeyField as much detached possible from parent component * Small refactors * Refactor on user preferences * Clean up into the changes * Small fix to let save working * Style finish * move about docs into about folder * Fix double tap on single keys * Style refactor * Remove log * Fix log issues on unit tests * Fix unit test breaking on ohif/core index * Fixing hotkeys unpause unit test issue * Rename file to adopt lowercase * Rename file to adopt lowercase * Fixing callouts * Big refactor miving some of the components into viewer and creating small components into ohif/ui * Typo on folder name * Updating ohif ui docs * Remove comments * Fix binding of combo keys * Fix some cypress tests failures * Fixing onCancel button * Fixing e2e tests * Small style update * Fixing unit tests failing after fix issue * Remove some not used code * Remove left over after debug * Adding prevent default on hotkeys events * Fixinf existing hotkeys validator with 3 keys pressed * Exposing hotkeys as root level on ohif-core * Clean up * Exposing all availableLanguages with labels and fixing an issue on language switcher * Fixing e2e cypress tests * Preveinting some simple errors * Treating error once we try to set hotkey definitions * Adding ui notification on setHotkeys errors * Implementing a service queue request to hold until functions are implemented * Making sure toFixed is only called on Numbers Co-authored-by: Danny Brown <danny.ri.brown@gmail.com> Co-authored-by: Gustavo André Lelis <galelis@gmail.com>
This commit is contained in:
69 files changed
+1211
-1632
No files matched your search
+21
-25
@@ -53,7 +53,6 @@ import store from './store';
|
||||
import WhiteLabellingContext from './context/WhiteLabellingContext';
|
||||
import UserManagerContext from './context/UserManagerContext';
|
||||
import AppContext from './context/AppContext';
|
||||
const { setUserPreferences } = reduxOHIF.actions;
|
||||
|
||||
/** ~~~~~~~~~~~~~ Application Setup */
|
||||
const commandsManagerConfig = {
|
||||
@@ -63,8 +62,8 @@ const commandsManagerConfig = {
|
||||
|
||||
/** Managers */
|
||||
const commandsManager = new CommandsManager(commandsManagerConfig);
|
||||
const hotkeysManager = new HotkeysManager(commandsManager);
|
||||
const servicesManager = new ServicesManager();
|
||||
const hotkeysManager = new HotkeysManager(commandsManager, servicesManager);
|
||||
let extensionManager;
|
||||
/** ~~~~~~~~~~~~~ End Application Setup */
|
||||
|
||||
@@ -116,7 +115,7 @@ class App extends Component {
|
||||
|
||||
const {
|
||||
servers,
|
||||
hotkeys,
|
||||
hotkeys: appConfigHotkeys,
|
||||
cornerstoneExtensionConfig,
|
||||
extensions,
|
||||
oidc,
|
||||
@@ -139,7 +138,7 @@ class App extends Component {
|
||||
* Must run after extension commands are registered
|
||||
* if there is no hotkeys from localStorage set up from config.
|
||||
*/
|
||||
_initHotkeys(hotkeys);
|
||||
_initHotkeys(appConfigHotkeys);
|
||||
_initServers(servers);
|
||||
initWebWorkers();
|
||||
}
|
||||
@@ -263,30 +262,27 @@ function _initExtensions(extensions, cornerstoneExtensionConfig, appConfig) {
|
||||
extensionManager.registerExtensions(mergedExtensions);
|
||||
}
|
||||
|
||||
function _initHotkeys(hotkeys) {
|
||||
const { hotkeyDefinitions = {} } = store.getState().preferences || {};
|
||||
let updateStore = false;
|
||||
let hotkeysToUse = hotkeyDefinitions;
|
||||
/**
|
||||
*
|
||||
* @param {Object} appConfigHotkeys - Default hotkeys, as defined by app config
|
||||
*/
|
||||
function _initHotkeys(appConfigHotkeys) {
|
||||
// TODO: Use something more resilient
|
||||
// TODO: Mozilla has a special library for this
|
||||
const userPreferredHotkeys = JSON.parse(
|
||||
localStorage.getItem('hotkey-definitions') || '{}'
|
||||
);
|
||||
|
||||
if (!Object.keys(hotkeyDefinitions).length) {
|
||||
hotkeysToUse = hotkeys;
|
||||
updateStore = true;
|
||||
// TODO: hotkeysManager.isValidDefinitionObject(/* */)
|
||||
const hasUserPreferences =
|
||||
userPreferredHotkeys && Object.keys(userPreferredHotkeys).length > 0;
|
||||
if (hasUserPreferences) {
|
||||
hotkeysManager.setHotkeys(userPreferredHotkeys);
|
||||
} else {
|
||||
hotkeysManager.setHotkeys(appConfigHotkeys);
|
||||
}
|
||||
|
||||
if (hotkeysToUse) {
|
||||
hotkeysManager.setHotkeys(hotkeysToUse);
|
||||
|
||||
/* Set hotkeys default based on app config. */
|
||||
hotkeysManager.setDefaultHotKeys(hotkeys);
|
||||
|
||||
if (updateStore) {
|
||||
const { hotkeyDefinitions } = hotkeysManager;
|
||||
const windowLevelData = {};
|
||||
store.dispatch(
|
||||
setUserPreferences({ windowLevelData, hotkeyDefinitions })
|
||||
);
|
||||
}
|
||||
}
|
||||
hotkeysManager.setDefaultHotKeys(appConfigHotkeys);
|
||||
}
|
||||
|
||||
function _initServers(servers) {
|
||||
|
||||
Reference in new issue
Block a user