* OHIF-330: Update Modal Styles * feat/ohif-332: finish raw ui * feat/ohif-332: update mode configuration strategy * feat/ohif-332: fix hotkey errors * feat/ohif-332: update hotkey logic with recent merged changes * feat/ohif-322: wrap * feat/ohif-322: add disable state * ohif-332: cr updates * ohif-332: disable * ohif-332: cr updates * ohif-332: extract header component * ohif-332: cr update to fix merge conflicts and design issue Co-authored-by: Rodrigo Antinarelli <rodrigoantinarelli@gmail.com>
32 lines
854 B
JavaScript
32 lines
854 B
JavaScript
/**
|
|
* Take the pressed key array and return the readable string for the keys
|
|
*
|
|
* @param {Array} [keys=[]]
|
|
* @returns {string} string representation of an array of keys
|
|
*/
|
|
const formatKeysForInput = (keys = []) => keys.join('+');
|
|
|
|
/**
|
|
* formats given keys sequence to insert the modifier keys in the first index of the array
|
|
* @param {string} sequence keys sequence from MouseTrap Record -> "shift+left"
|
|
* @returns {Array} keys in array-format -> ['shift','left']
|
|
*/
|
|
const getKeys = ({ sequence, modifierKeys }) => {
|
|
const keysArray = sequence.join(' ').split('+');
|
|
let keys = [];
|
|
let modifiers = [];
|
|
keysArray.forEach(key => {
|
|
if (modifierKeys && modifierKeys.includes(key)) {
|
|
modifiers.push(key);
|
|
} else {
|
|
keys.push(key);
|
|
}
|
|
});
|
|
return [...modifiers, ...keys];
|
|
};
|
|
|
|
export {
|
|
getKeys,
|
|
formatKeysForInput
|
|
};
|