您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

hooks.ts 706B

12345678910111213141516171819202122232425
  1. import { useSelector } from 'react-redux';
  2. import { isMobileBrowser } from '../base/environment/utils';
  3. import KeyboardShortcutsButton from './components/KeyboardShortcutsButton';
  4. import { areKeyboardShortcutsEnabled } from './functions';
  5. const shortcuts = {
  6. key: 'shortcuts',
  7. Content: KeyboardShortcutsButton,
  8. group: 4
  9. };
  10. /**
  11. * A hook that returns the keyboard shortcuts button if it is enabled and undefined otherwise.
  12. *
  13. * @returns {Object | undefined}
  14. */
  15. export function useKeyboardShortcutsButton() {
  16. const _areKeyboardShortcutsEnabled = useSelector(areKeyboardShortcutsEnabled);
  17. if (!isMobileBrowser() && _areKeyboardShortcutsEnabled) {
  18. return shortcuts;
  19. }
  20. }